@import url('https://fonts.googleapis.com/css2?family=Kumbh+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #f0f4f2;
  --bg-deep: #e4ece8;
  --ink: #12201c;
  --muted: #5f716b;
  --line: #d3ddd8;
  --card: #ffffff;
  --sidebar: #0d2a24;
  --sidebar-2: #134037;
  --accent: #0e7a66;
  --accent-2: #0a5c4d;
  --accent-soft: #e6f5f0;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --ok: #067647;
  --ok-soft: #ecfdf3;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --info: #175cd3;
  --info-soft: #eff8ff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 40, 32, 0.04), 0 8px 24px rgba(16, 40, 32, 0.06);
  --font: "Kumbh Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at -10% -20%, #d7ebe4 0%, transparent 55%),
    radial-gradient(900px 500px at 110% 0%, #e8efe6 0%, transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; font-weight: 500; }
a:hover { color: var(--accent-2); text-decoration: underline; }

.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  color: #e8f2ef;
  padding: 1.4rem 1rem 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}
.brand {
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
  display: block;
  color: #fff;
  text-decoration: none;
}
.brand-sub {
  color: #8fb5ab;
  font-size: 0.75rem;
  font-weight: 500;
  margin: 0 0 1.5rem 0.15rem;
}
.nav { display: flex; flex-direction: column; gap: 0.2rem; flex: 1; }
.nav a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: #c5ddd6;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
}
.nav a:hover { background: rgba(255,255,255,0.07); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(255,255,255,0.12); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08); }
.nav-group { display: flex; flex-direction: column; gap: 0.15rem; }
.nav-group .nav-parent { margin: 0; }
.nav-sub {
  display: none;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.15rem 0 0.35rem 0.55rem;
  margin: 0 0 0.15rem 0.35rem;
  border-left: 2px solid rgba(255,255,255,0.12);
}
.nav-group.open .nav-sub,
.nav-group:hover .nav-sub { display: flex; }
.nav-sub a {
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0.45rem 0.7rem;
  color: #a8c7be;
}
.nav-sub a.active { color: #fff; background: rgba(255,255,255,0.1); }
.nav-sub-empty { color: #7fa89d; font-size: 0.78rem; padding: 0.35rem 0.7rem; }
.sidebar-foot { color: #7fa89d; font-size: 0.75rem; padding: 0.75rem 0.4rem 0; border-top: 1px solid rgba(255,255,255,0.08); margin-top: 1rem; }

.main { padding: 1.5rem 1.75rem 2.75rem; min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.35rem;
}
.topbar h1 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.page-sub { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.92rem; }
.user-meta { color: var(--muted); font-size: 0.9rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.card h2 {
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.card-head h2 { margin: 0; }

.grid-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.1rem;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--accent);
}
.stat .n { font-size: 1.85rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: 0.82rem; font-weight: 600; margin-top: 0.35rem; text-transform: uppercase; letter-spacing: 0.04em; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: end;
  margin-bottom: 1rem;
}
.filters .field { min-width: 160px; flex: 1; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.75rem 0 0; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.7rem 0.5rem; border-bottom: 1px solid var(--line); font-size: 0.9rem; vertical-align: middle; }
th { color: var(--muted); font-weight: 700; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; }
tr:hover td { background: #f8fbf9; }
.table-wrap { overflow-x: auto; }

label { display: block; margin-bottom: 0.85rem; font-size: 0.86rem; font-weight: 600; color: var(--ink); }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=file], input[type=tel],
select, textarea {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  font: inherit;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 122, 102, 0.15);
}
textarea { min-height: 140px; font-family: ui-monospace, Consolas, monospace; font-size: 0.85rem; }
textarea.rich { font-family: var(--font); min-height: 120px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.85rem; }

.btn, button.btn, a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: #c8ebe3;
  color: #0a5c4d !important;
  border: 1px solid #9fd9cc;
  border-radius: 9px;
  padding: 0.58rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none !important;
  transition: background .15s, border-color .15s, transform .1s;
  box-shadow: none;
}
.btn:hover, button.btn:hover, a.btn:hover { background: #b5e3d8; border-color: #7fc9b8; }
.btn:active { transform: translateY(1px); }

/* Primary — create / save / queue */
.btn-primary, .btn:not([class*="btn-"]) {
  background: #c8ebe3;
  color: #0a5c4d !important;
  border-color: #9fd9cc;
}

/* Secondary — test / alternate actions */
.btn-secondary {
  background: #d6e4f7;
  color: #1e4e8c !important;
  border-color: #b3c9eb;
}
.btn-secondary:hover { background: #c5d8f2; border-color: #9bb6e0; }

/* Info — design / view report */
.btn-info {
  background: #e4ddf7;
  color: #5b3d9e !important;
  border-color: #cbbceb;
}
.btn-info:hover { background: #d8cef3; }

/* Success — confirm send-ish */
.btn-success {
  background: #d8f0d4;
  color: #2d6a32 !important;
  border-color: #b5deb0;
}
.btn-success:hover { background: #c8e9c3; }

/* Warning */
.btn-warning {
  background: #fde9c8;
  color: #8a5a00 !important;
  border-color: #f0d19a;
}
.btn-warning:hover { background: #fbe0b0; }

/* Danger — delete */
.btn-danger {
  background: #fad9d7;
  color: #9b2c2c !important;
  border-color: #f0b8b4;
}
.btn-danger:hover { background: #f5c8c5; }

/* Ghost / neutral */
.btn-ghost {
  background: #eef2f0;
  color: #4a5c56 !important;
  border: 1px solid #d5ddd9;
}
.btn-ghost:hover { background: #e4ebe8; color: #0a5c4d !important; border-color: #c5d4ce; }

.btn-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0 !important;
  border-radius: 9px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.btn-icon svg.icon,
.btn svg.icon {
  display: block !important;
  width: 18px !important;
  height: 18px !important;
  flex-shrink: 0;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: none;
}
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.82rem; }
.btn-icon.btn-danger { background: #fad9d7; color: #9b2c2c !important; border-color: #f0b8b4; }
.btn-icon.btn-info { background: #e4ddf7; color: #5b3d9e !important; border-color: #cbbceb; }
.btn-icon.btn-ghost { background: #e8f2ef; color: #3d5a52 !important; border-color: #c5d9d2; }
.btn-icon.btn-ghost:hover { background: #d9ebe5; }
.actions { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }
.row-actions { display: inline-flex; gap: 0.3rem; }

.alert { padding: 0.8rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-weight: 500; }
.alert-success { background: var(--ok-soft); color: var(--ok); border: 1px solid #abe0c0; }
.alert-error { background: var(--danger-soft); color: var(--danger); border: 1px solid #f3c4bf; }
.muted { color: var(--muted); }
.badge {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: #ebe6dc;
  color: #444;
  text-transform: capitalize;
}
.badge-sent, .badge-subscribed, .badge-completed, .badge-interested, .badge-opened, .badge-clicked { background: var(--ok-soft); color: var(--ok); }
.badge-sending, .badge-queued, .badge-pending, .badge-new, .badge-follow_up, .badge-contacted { background: var(--warn-soft); color: var(--warn); }
.badge-paused { background: #fef3c7; color: #92400e; }
.badge-failed, .badge-unsubscribed, .badge-lost { background: var(--danger-soft); color: var(--danger); }
.badge-draft, .badge-future { background: #eef2f0; color: #475467; }
.badge-universal { background: var(--info-soft); color: var(--info); }

.guest {
  display: grid;
  place-items: center;
  padding: 2rem;
  min-height: 100vh;
}
.guest-card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.75rem;
  box-shadow: var(--shadow);
}
.guest-card h1 { margin-top: 0; font-weight: 800; letter-spacing: -0.03em; }

.help { font-size: 0.82rem; color: var(--muted); margin: 0.25rem 0 0.75rem; font-weight: 500; }
code { background: #e8efeB; padding: 0.12rem 0.4rem; border-radius: 5px; font-size: 0.85em; }

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.pager-links {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin-left: auto;
}
.pager-page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.45rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  line-height: 1;
}
.pager-page:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.pager-page.is-current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  cursor: default;
}
.pager-gap {
  color: var(--muted);
  font-weight: 700;
  padding: 0 0.15rem;
  user-select: none;
}

.list-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  background: #f7faf8;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.list-toolbar .grow { flex: 1; min-width: 220px; }
.list-toolbar label,
.search-label {
  margin-bottom: 0;
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.list-toolbar .field label { margin-bottom: 0; }
.list-toolbar .field { min-width: 140px; }

.search-field { display: flex; flex-direction: column; gap: 0.35rem; }
.search-box {
  display: flex;
  align-items: stretch;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(16, 40, 32, 0.04);
  transition: border-color .15s, box-shadow .15s;
}
.search-box:focus-within {
  border-color: #9fd9cc;
  box-shadow: 0 0 0 3px rgba(14, 122, 102, 0.12);
}
.search-box-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.65rem 0 0.85rem;
  opacity: 0.7;
}
.search-box input[type="search"] {
  flex: 1;
  border: 0 !important;
  box-shadow: none !important;
  margin: 0 !important;
  padding: 0.65rem 0.5rem !important;
  border-radius: 0 !important;
  background: transparent !important;
  min-width: 0;
  font-size: 0.95rem;
}
.search-box input[type="search"]:focus {
  outline: none;
  box-shadow: none !important;
}
.search-box input[type="search"]::-webkit-search-cancel-button {
  margin-right: 0.35rem;
}
.search-submit {
  border: 0 !important;
  border-left: 1px solid var(--line) !important;
  border-radius: 0 !important;
  padding: 0 1rem !important;
  gap: 0.4rem;
  white-space: nowrap;
}
.search-submit svg { display: block; width: 16px; height: 16px; }

.list-toolbar select {
  margin-top: 0.35rem;
  min-height: 42px;
}

.th-sort {
  color: var(--muted) !important;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}
.th-sort:hover, .th-sort.active { color: var(--accent) !important; }
.sort-arrow { font-size: 0.7rem; }

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}
.chip:hover { border-color: #9fd9cc; color: #0a5c4d; text-decoration: none; background: #eefaf6; }
.chip.active { background: #c8ebe3; border-color: #9fd9cc; color: #0a5c4d; }

/* SweetAlert pastel */
.swal2-popup { font-family: var(--font) !important; border-radius: 14px !important; }
.swal2-confirm {
  background: #c8ebe3 !important;
  color: #0a5c4d !important;
  border: 1px solid #9fd9cc !important;
  box-shadow: none !important;
  font-weight: 700 !important;
}
.swal2-cancel {
  background: #eef2f0 !important;
  color: #4a5c56 !important;
  border: 1px solid #d5ddd9 !important;
  font-weight: 700 !important;
}
.swal2-deny {
  background: #fad9d7 !important;
  color: #9b2c2c !important;
  border: 1px solid #f0b8b4 !important;
  font-weight: 700 !important;
}

.link-name {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0.2rem 0.35rem;
  margin: -0.2rem -0.35rem;
  border-radius: 6px;
  font: inherit;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: rgba(14, 122, 102, 0.4);
  text-underline-offset: 3px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease, background 0.15s ease;
}
.link-name::after {
  content: "›";
  font-weight: 800;
  opacity: 0.55;
  text-decoration: none;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.link-name:hover {
  color: var(--accent-2);
  text-decoration-color: var(--accent-2);
  background: var(--accent-soft);
}
.link-name:hover::after {
  opacity: 1;
  transform: translateX(2px);
}
.link-name:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.brand-lockup {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1.35rem;
  text-decoration: none;
}
.brand-lockup:hover { text-decoration: none; }
.brand-lockup img {
  max-width: 172px;
  height: auto;
  display: block;
  /* PNG has a solid black plate — lift it on the dark sidebar */
  mix-blend-mode: lighten;
}
.brand-lockup .brand-sub {
  margin: 0;
  color: #8fb5ab;
  font-size: 0.75rem;
  font-weight: 500;
}

.guest-logo {
  display: block;
  max-width: 200px;
  margin: 0 auto 1.25rem;
  height: auto;
}

/* Reminder date + time */
.rem-due-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 0.75rem;
  align-items: start;
}
.pebble-date {
  position: relative;
}
.pebble-date-trigger {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.pebble-date-trigger:hover,
.pebble-date.open .pebble-date-trigger {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 122, 102, 0.12);
}
.pebble-date-icon {
  flex-shrink: 0;
  color: var(--accent);
}
.rem-due-grid select {
  margin-top: 0.25rem;
  min-height: 44px;
  width: 100%;
}
.pebble-date-cal {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  width: min(280px, 92vw);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 0.75rem;
  display: none;
}
.pebble-date.open .pebble-date-cal { display: block; }
.pebble-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.55rem;
}
.pebble-cal-head strong {
  font-size: 0.95rem;
}
.pebble-cal-nav {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--accent-soft);
  color: var(--accent-2);
  font-weight: 800;
  cursor: pointer;
}
.pebble-cal-nav:hover { background: #d7efe7; }
.pebble-cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 0.25rem;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}
.pebble-cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.pebble-cal-days button {
  border: 0;
  background: transparent;
  min-height: 34px;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
}
.pebble-cal-days button:hover:not(:disabled) {
  background: var(--accent-soft);
}
.pebble-cal-days button:disabled {
  opacity: 0.25;
  cursor: default;
}
.pebble-cal-days button.is-today {
  box-shadow: inset 0 0 0 1px var(--accent);
}
.pebble-cal-days button.is-selected {
  background: var(--accent);
  color: #fff;
}
.pebble-cal-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 0.55rem;
  gap: 0.5rem;
}
.pebble-cal-foot button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  padding: 0.35rem;
  border-radius: 8px;
}
.pebble-cal-foot button:hover { background: var(--accent-soft); }
@media (max-width: 640px) {
  .rem-due-grid { grid-template-columns: 1fr; }
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 30, 24, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff;
  width: min(720px, 100%);
  max-height: 88vh;
  overflow: auto;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
  border: 1px solid var(--line);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: #fff;
}
.modal-head h3 { margin: 0; font-size: 1.15rem; font-weight: 800; }
.modal-body { padding: 1.15rem 1.25rem 1.4rem; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative;
  padding: 0 0 1rem 1.15rem;
  border-left: 2px solid var(--line);
  margin-left: 0.4rem;
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 0.35rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.timeline .t-meta { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.timeline .t-title { font-weight: 700; margin-top: 0.1rem; }

.sig-preview {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 0.85rem;
  background: #fafcfb;
  margin-top: 0.5rem;
  min-height: 60px;
  overflow-x: auto;
}
.sig-preview img, .email-body-preview img { max-width: 100%; height: auto; }

#preview-frame {
  display: flex;
  justify-content: center;
  padding: 1rem;
  background: #e8eeeb;
  border-radius: 12px;
}
.preview-desktop .email-chrome { width: min(680px, 100%); }
.preview-mobile .email-chrome { width: min(375px, 100%); }
.email-chrome {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.email-chrome-meta {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  background: #f7faf8;
  font-size: 0.9rem;
}
.email-body-preview {
  padding: 1.15rem 1.25rem 1.4rem;
  font-family: "Kumbh Sans", Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: #222;
  min-height: 120px;
  overflow-x: auto;
}
.email-body-preview, .email-body-preview * {
  font-family: "Kumbh Sans", Arial, Helvetica, sans-serif;
}
.sig-preview, .sig-preview * {
  font-family: "Kumbh Sans", Arial, Helvetica, sans-serif;
}

.empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
}
.empty a { font-weight: 700; }

/* TinyMCE sits nicer */
.tox-tinymce { border-radius: 10px !important; border-color: var(--line) !important; }

/* Analytics */
.analytics-filters { margin-bottom: 1rem; }
.analytics-filter-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  align-items: end;
}
.analytics-filter-form label { margin: 0; }
.analytics-kpis {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 1rem;
}
.kpi-rate {
  display: inline-block;
  margin-left: 0.25rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  vertical-align: middle;
}
.analytics-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.analytics-grid > .card { margin-bottom: 0; }
.chart-wrap { position: relative; height: 300px; }
.chart-wrap-sm { height: 220px; }
.analytics-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}
.analytics-legend .lg {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 0.35rem;
  vertical-align: -1px;
}
.lg-click { background: #0a5c4d; }
.lg-open { background: #3d9b84; }
.lg-none { background: #c5d4ce; }
.funnel-stats {
  list-style: none;
  margin: 0.85rem 0 0;
  padding: 0;
  font-size: 0.9rem;
  display: grid;
  gap: 0.35rem;
}
.funnel-stats li { color: var(--ink); }
.mini-stack {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #e8eeeb;
  min-width: 100px;
}
.mini-stack span { display: block; height: 100%; }
.ms-click { background: #0a5c4d; }
.ms-open { background: #3d9b84; }
.ms-none { background: #c5d4ce; }
.analytics-table th { white-space: nowrap; }
.analytics-table th.sortable-th {
  cursor: pointer;
  user-select: none;
  color: var(--muted);
}
.analytics-table th.sortable-th:hover { color: var(--accent); }
.analytics-table th.sortable-th::after {
  content: " ↕";
  font-size: 0.7em;
  opacity: 0.45;
  font-weight: 700;
}
.analytics-table th.sortable-th.sorted-asc::after { content: " ↑"; opacity: 1; color: var(--accent); }
.analytics-table th.sortable-th.sorted-desc::after { content: " ↓"; opacity: 1; color: var(--accent); }
.analytics-table th.sortable-th.sorted-asc,
.analytics-table th.sortable-th.sorted-desc { color: var(--accent); }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .grid-stats { grid-template-columns: 1fr 1fr; }
  .analytics-filter-form { grid-template-columns: 1fr; }
  .analytics-kpis { grid-template-columns: 1fr 1fr 1fr; }
  .analytics-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .grid-stats, .row, .row-3 { grid-template-columns: 1fr; }
  .analytics-kpis { grid-template-columns: 1fr 1fr; }
  .main { padding: 1rem; }
}
