/* ==========================================================================
   ColdVibe - light workspace theme
   ========================================================================== */

:root {
  /* Surfaces and text — neutral, low-chroma, flat. */
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fafafb;
  --surface-3: #f0f1f3;
  --line: #e5e6ea;
  --line-strong: #d2d4db;
  --text: #111216;
  --text-2: #42454d;
  --muted: #71757e;

  /* One accent carries every primary action. */
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef0ff;
  --primary-tint: #fafaff;
  --primary-line: #c7c9fa;

  --ok: #157347;
  --ok-soft: #e9f7ef;
  --ok-line: #bfe6cf;
  --warn: #a8620a;
  --warn-soft: #fdf4e5;
  --warn-line: #f0d9ae;
  --bad: #bd2c2c;
  --bad-soft: #fdeeee;
  --bad-line: #f2caca;
  --blue: #1f5fbf;
  --blue-soft: #eaf1fd;
  --blue-line: #c6d8f7;
  --violet: #6d3bd1;
  --violet-soft: #f2edfc;
  --violet-line: #ddcff8;

  /* Flat elevation: borders and surface shifts only. */
  --radius: 8px;
  --radius-sm: 6px;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0f1116;
  --surface: #161920;
  --surface-2: #1a1e26;
  --surface-3: #21262f;
  --line: #262b35;
  --line-strong: #353c49;
  --text: #eef0f4;
  --text-2: #b7bdc8;
  --muted: #858c9a;

  --primary: #6366f1;
  --primary-hover: #7c7ff5;
  --primary-soft: #1e2233;
  --primary-tint: #171a23;
  --primary-line: #3d4160;

  --ok: #4ade80;
  --ok-soft: #14251a;
  --ok-line: #245c38;
  --warn: #fbbf24;
  --warn-soft: #292111;
  --warn-line: #5c4a1f;
  --bad: #f87171;
  --bad-soft: #2a1618;
  --bad-line: #5c2a2c;
  --blue: #60a5fa;
  --blue-soft: #14202f;
  --blue-line: #29455f;
  --violet: #a78bfa;
  --violet-soft: #201a2f;
  --violet-line: #3f3260;

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { letter-spacing: -0.02em; line-height: 1.2; }

code {
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  font-size: 12px;
  color: #3d3f6b;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.right { text-align: right; }
.text-ok { color: var(--ok); }
.text-bad { color: var(--bad); }

/* ================================ shell ================================= */

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 256px;
  flex: 0 0 256px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px 16px 20px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  z-index: 20;
}

.side-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 8px; }

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
  color: #fff;
  background: var(--text);
  flex: 0 0 36px;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }
.brand-text small { font-size: 11.5px; color: var(--muted); }

.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; }

.nav-group-label {
  margin: 20px 10px 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.nav-group-label:first-child { margin-top: 0; }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.nav-item svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: 0.75; }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item.active svg { opacity: 1; }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 2px;
  border-radius: 2px;
  background: var(--primary);
}

.side-footer { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding: 16px 6px 2px; border-top: 1px solid var(--line); }

.side-status-block { display: flex; flex-direction: column; gap: 12px; }

.side-status { display: flex; align-items: center; gap: 10px; padding: 4px 4px 2px; }
.side-status strong { display: block; font-size: 12.5px; }
.side-status small { display: block; font-size: 11px; color: var(--muted); }

.pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 9px;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(21, 147, 75, 0.45);
  animation: pulse 2.4s infinite;
}
.pulse.off { background: var(--muted); animation: none; box-shadow: none; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(21, 147, 75, 0.4); }
  70% { box-shadow: 0 0 0 7px rgba(21, 147, 75, 0); }
  100% { box-shadow: 0 0 0 0 rgba(21, 147, 75, 0); }
}

/* Account menu at the bottom of the sidebar, laid out like Instantly's:
   avatar + name trigger, 264px popup with 32px rows above it. */

.side-account { position: relative; }

.account-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}

.account-trigger:hover,
.account-trigger[aria-expanded="true"] { background: var(--surface-3); }

.account-trigger:focus-visible { outline: 2px solid var(--primary-line); outline-offset: 1px; }

.account-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 10px;
  background: var(--text);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  user-select: none;
}

.account-ident { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.account-ident strong { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; }
.account-ident small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.account-chevron { width: 16px; height: 16px; flex: 0 0 16px; margin-left: auto; color: var(--muted); transition: transform 0.12s ease; }

.account-trigger[aria-expanded="true"] .account-chevron { transform: rotate(180deg); }

.account-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 40;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.14);
}

.account-menu-head { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }

.account-menu-rule { height: 1px; margin: 6px 0; background: var(--line); }

.account-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}

.account-menu-item:hover { background: var(--surface-3); }
.account-menu-item:focus-visible { outline: 2px solid var(--primary-line); outline-offset: -2px; }

.account-menu-item svg { width: 16px; height: 16px; flex: 0 0 16px; color: var(--muted); }

.account-menu-label { font-weight: 500; }
.account-menu-value { color: var(--text-2); }
.account-menu-arrow { margin-left: auto; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 40px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-left h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.025em; }
.topbar-left p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }

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

.range-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.content { padding: 32px 40px 72px; width: 100%; max-width: 1440px; margin: 0 auto; }

/* =============================== buttons ================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.btn:hover { background: var(--surface-3); border-color: var(--line-strong); }
a.btn { text-decoration: none; }
.btn:active { background: var(--surface-3); }
.btn:disabled { background: var(--surface-3); border-color: var(--line); color: var(--muted); cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--primary-line); outline-offset: 2px; }

.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

.btn.danger { color: var(--bad); border-color: var(--bad-line); background: var(--surface); }
.btn.danger:hover { background: var(--bad-soft); }

.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger.solid:hover { background: #a52626; border-color: #a52626; }
[data-theme="dark"] .btn.danger.solid { color: #1b0f10; }
[data-theme="dark"] .btn.danger.solid:hover { background: #ef5f5f; border-color: #ef5f5f; }

.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }

.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: var(--radius-sm); }
.btn.full { width: 100%; }

.icon-btn {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn:focus-visible { outline: 2px solid var(--primary-line); outline-offset: 2px; }

.theme-icon { width: 17px; height: 17px; display: block; }
.theme-icon-sun { display: none; }
[data-theme="dark"] .theme-icon-sun { display: block; }
[data-theme="dark"] .theme-icon-moon { display: none; }

.link {
  border: 0;
  background: none;
  padding: 0;
  color: var(--primary);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.link:hover { text-decoration: underline; }

/* =============================== headings =============================== */

.page-head,
.hero-row,
.detail-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.page-head h2,
.hero-row h2,
.greeting { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.025em; }
.page-head p,
.hero-row p { margin: 4px 0 0; font-size: 13px; }
.page-head.actions-only { justify-content: flex-end; margin-bottom: 16px; }

.detail-title-row { align-items: flex-start; }
.detail-title-row h2 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.03em; }
.detail-title-row p { margin: 4px 0 0; font-size: 13px; }

.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.breadcrumb span:last-child { color: var(--text-2); font-weight: 600; }

.row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.row.spread { justify-content: space-between; }

/* ================================ cards ================================= */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -0.015em; }
.card-head p { margin: 3px 0 0; font-size: 12.5px; }

.table-card { padding: 24px 0 0; overflow: hidden; }
.table-card .card-head { padding: 0 24px; }
.table-card:not(:has(> .card-head)) { padding-top: 0; }

.compare-pickers { flex-wrap: wrap; align-items: flex-end; gap: 16px; padding: 0 24px 16px; }
.compare-pickers label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.compare-pickers select,
.compare-pickers input { min-width: 165px; }

.spark { display: inline-block; vertical-align: middle; line-height: 0; }
.spark svg { display: block; width: 84px; height: 22px; }
.spark rect { fill: var(--primary-line); }
.spark rect:hover { fill: var(--primary); }

/* ================================ stats ================================= */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

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

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  min-width: 0;
}

.stat-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }

.stat-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  flex: 0 0 28px;
}
.stat-icon.blue { background: var(--blue-soft); color: var(--blue); }
.stat-icon.green { background: var(--ok-soft); color: var(--ok); }
.stat-icon.red { background: var(--bad-soft); color: var(--bad); }
.stat-icon.amber { background: var(--warn-soft); color: var(--warn); }
.stat-icon.violet { background: var(--violet-soft); color: var(--violet); }

.stat-label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.stat-foot { margin-top: 4px; font-size: 12px; color: var(--muted); }

/* ================================ grids ================================= */

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}
.dash-grid > .card { margin-bottom: 0; }

/* ================================ charts ================================ */

.chart-card { padding-bottom: 10px; }
.chart { width: 100%; height: 236px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart text { fill: #9aa1ae; font-size: 10px; font-family: inherit; }
.chart .grid-line { stroke: #eef0f5; stroke-width: 1; }
.chart .sent-line { fill: none; stroke: var(--primary); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .replied-line { fill: none; stroke: var(--ok); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .sent-area { fill: rgba(79, 70, 229, 0.1); }
.chart .point { stroke: #fff; stroke-width: 1.5; }
.chart .point.sent { fill: var(--primary); }
.chart .point.replied { fill: var(--ok); }
.chart .empty-label { fill: var(--muted); font-size: 12px; }

.legend { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.legend-dot.sent { background: var(--primary); }
.legend-dot.replied { background: var(--ok); margin-left: 6px; }

/* ================================ tables ================================ */

.table-wrap { width: 100%; overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

thead th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
thead th.right { text-align: right; }

tbody td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
tbody td strong { color: var(--text); font-weight: 600; }
tbody td.right { text-align: right; }
tbody td .sub { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

tr.clickable { cursor: pointer; }

.empty { text-align: center !important; color: var(--muted); padding: 40px 16px !important; font-size: 13px; }

.progress {
  width: 100%;
  max-width: 120px;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--primary); }
.progress.ok > span { background: var(--ok); }

/* ================================ badges ================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  text-transform: capitalize;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.75;
}

.badge.active, .badge.sent, .badge.on { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.badge.draft, .badge.queued, .badge.off, .badge.unsubscribed, .badge.blocked, .badge.stopped { background: var(--surface-3); border-color: var(--line-strong); color: var(--muted); }
.badge.paused, .badge.warmup { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.badge.completed, .badge.replied { background: var(--blue-soft); border-color: var(--blue-line); color: var(--blue); }
.badge.running { background: var(--blue-soft); border-color: var(--blue-line); color: var(--blue); }
.badge.done { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.badge.cancelled { background: var(--surface-3); border-color: var(--line-strong); color: var(--muted); }
.badge.bounced, .badge.failed, .badge.error { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }

/* =============================== toolbar ================================ */

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

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-3);
}
.segmented button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface); color: var(--text); }

.search-input { min-width: 240px; max-width: 320px; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="time"],
input[type="datetime-local"],
input[type="url"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.12s ease;
}
input::placeholder, textarea::placeholder { color: #a3a7b0; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: 2px solid var(--primary-line); outline-offset: 1px; }
textarea { resize: vertical; line-height: 1.6; }
input[type="file"] { padding: 6px; font-size: 12px; }
input[type="checkbox"] { accent-color: var(--primary); width: 15px; height: 15px; }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371757e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 12px;
  padding-right: 36px;
}

/* ================================ forms ================================= */

.form { display: flex; flex-direction: column; gap: 16px; }

.form label,
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}
.form label > input,
.form label > select,
.form label > textarea { margin-top: 6px; font-weight: 400; color: var(--text); }

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

.form label.check,
label.check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 20px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
}
.form label.check { padding-top: 0; }

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px 20px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
legend { padding: 0 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

.actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.actions .muted { font-size: 12px; }

.hint {
  padding: 12px 16px;
  border: 1px solid var(--primary-line);
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.6;
}
.hint.bad { border-color: var(--bad-line); background: var(--bad-soft); color: #9c2626; }
.hint.ok { border-color: var(--ok-line); background: var(--ok-soft); color: #14683a; }
.hint code { background: var(--surface); }

.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; font-size: 13px; color: var(--text-2); }
.checklist li { position: relative; padding-left: 24px; }
.checklist li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 9px;
  font-weight: 700;
}

/* ============================== dashboard =============================== */

.switch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0 4px;
  cursor: pointer;
}
.switch-row > span:first-child { flex: 1; font-size: 13px; font-weight: 500; color: var(--text-2); }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }

.switch {
  position: relative;
  width: 40px;
  height: 24px;
  flex: 0 0 40px;
  border-radius: 999px;
  background: #d5d7de;
  transition: background 0.15s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
}
.switch-row input:checked + .switch { background: var(--primary); }
.switch-row input:checked + .switch::after { transform: translateX(16px); }

.quick-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

.mini-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.mini-stat { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.mini-stat b { display: block; font-size: 18px; font-weight: 700; line-height: 1.3; }
.mini-stat span { font-size: 11.5px; color: var(--muted); }

.activity-list { display: flex; flex-direction: column; max-height: 372px; overflow-y: auto; }
.activity-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.activity-item:last-child { border-bottom: 0; }
.activity-icon { width: 28px; height: 28px; flex: 0 0 28px; border-radius: var(--radius-sm); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.activity-icon.sent { background: var(--blue-soft); color: var(--blue); }
.activity-icon.replied { background: var(--ok-soft); color: var(--ok); }
.activity-icon.bounced { background: var(--bad-soft); color: var(--bad); }
.activity-icon.warn { background: var(--warn-soft); color: var(--warn); }
.activity-icon.neutral { background: var(--surface-3); color: var(--muted); }
.activity-body { min-width: 0; flex: 1; }
.activity-body strong { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); }
.activity-body small { display: block; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-time { font-size: 11px; color: var(--muted); white-space: nowrap; }

/* ============================== campaign detail ========================= */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 4px 0 24px; overflow-x: auto; }
.tabs button {
  border: 0;
  background: none;
  padding: 12px 16px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); border-bottom-color: var(--primary); }

.sequence-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 24px; align-items: start; }

.sequence-editor { min-width: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.section-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.seq-hint { margin: 0 0 16px; font-size: 12.5px; }

.steps { display: flex; flex-direction: column; gap: 16px; }

.step-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  cursor: default;
  transition: border-color 0.12s ease;
}
.step-card.active { border-color: var(--primary); outline: 2px solid var(--primary-soft); }

.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.step-num {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11.5px;
  font-weight: 700;
}
.step-card.active .step-num { background: var(--primary); color: #fff; }
.step-title { font-size: 13px; font-weight: 600; }
.step-title small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }
.step-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.step-card .step-delay { margin-left: 0; margin-top: 0; display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.step-card .step-delay input { width: 62px; padding: 5px 8px; font-size: 12px; }
.step-remove { color: var(--muted); }
.step-card > label { display: block; font-size: 11.5px; font-weight: 600; color: var(--text-2); margin-top: 9px; }
.step-card > label:first-of-type { margin-top: 0; }
.step-card input, .step-card textarea { margin-top: 4px; }

.preview-pane {
  position: sticky;
  top: 88px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.preview-head { display: flex; justify-content: space-between; align-items: center; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.preview-subject { margin-top: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); font-size: 15px; font-weight: 700; word-break: break-word; }
.preview-to { margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.preview-body { margin-top: 10px; font-size: 13px; line-height: 1.65; color: var(--text-2); white-space: pre-wrap; word-break: break-word; min-height: 150px; max-height: 420px; overflow-y: auto; }
.preview-note { margin: 12px 0 0; font-size: 11px; }

.day-picker { min-width: 0; }
.day-picker .field-label { margin-bottom: 5px; }
.day-toggle {
  height: 32px;
  min-width: 42px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.day-toggle:hover { background: var(--surface-3); }
.day-toggle.active { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary); }

/* ================================ leads ================================= */

.list-bar { padding: 16px 20px; }

.chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}
.chip:hover { background: var(--surface-3); }
.chip.active { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary); font-weight: 600; }
.chip .count { font-size: 11px; opacity: 0.7; }
.chip .chip-x {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  font-size: 11px;
  line-height: 1;
  color: var(--muted);
}
.chip .chip-x:hover { background: rgba(0, 0, 0, 0.08); color: var(--bad); }

.mapping {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

/* =============================== mailboxes ============================== */

.add-card { margin-top: 4px; }

/* ================================ modal ================================= */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 18, 22, 0.5);
}

.modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 24px;
  animation: modal-in 0.16s ease-out;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.modal-head h3 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.modal-head p { margin: 3px 0 0; font-size: 12.5px; }

/* In-app confirmation dialog, replacing window.confirm(). */
.confirm-modal { width: min(440px, 100%); }
.confirm-modal .modal-head { margin-bottom: 0; }
.confirm-modal .modal-head h3 { font-size: 17px; }
.confirm-modal .modal-head p { margin-top: 6px; font-size: 13.5px; line-height: 1.55; color: var(--text-2); }
.confirm-actions { justify-content: flex-end; margin-top: 20px; }

/* ================================ toast ================================= */

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  max-width: min(420px, calc(100vw - 48px));
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: #17181d;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  animation: toast-in 0.16s ease-out;
}
.toast.ok { background: #11693a; }
.toast.bad { background: #b02626; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ================================ auth ================================== */

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.auth-card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
}

.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; }
.auth-card h2 { margin: 0 0 8px; font-size: 24px; font-weight: 700; letter-spacing: -0.025em; }
.auth-card > div > p { margin: 0 0 24px; font-size: 13px; line-height: 1.6; }
.auth-card .form { gap: 16px; }
.auth-foot { margin: 24px 0 0; font-size: 11.5px; color: var(--muted); text-align: center; }

/* ============================== nav badge =============================== */

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
}

/* ============================ variant editor ============================ */

.variant-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.variant-toggle:hover { background: var(--surface-3); color: var(--text-2); }
.variant-toggle input { width: 13px; height: 13px; }

.variant-label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 14px 0 2px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.variant-label:first-of-type { margin-top: 2px; }
.variant-pill {
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  font-size: 10.5px;
  font-weight: 800;
}
.variant-pill.a { background: var(--primary-soft); color: var(--primary); }
.variant-pill.b { background: var(--warn-soft); color: var(--warn); }

.preview-variant { margin-top: 12px; width: 100%; }
.preview-variant button { flex: 1; }

/* =============================== replies ================================ */

.replies-layout {
  display: grid;
  grid-template-columns: minmax(300px, 400px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.replies-list-card { padding: 0; overflow: hidden; }
.replies-list { max-height: calc(100vh - 210px); overflow-y: auto; }

.reply-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 16px 20px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.reply-item:last-child { border-bottom: 0; }
.reply-item:hover { background: var(--surface-2); }
.reply-item.selected { background: var(--primary-soft); border-left: 3px solid var(--primary); padding-left: 17px; }
.reply-item.unread { background: var(--primary-tint); }
.reply-item.unread .reply-subject { font-weight: 700; }

.reply-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.reply-item-top strong { font-size: 12.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-time { font-size: 11px; color: var(--muted); white-space: nowrap; }
.reply-subject { margin-top: 4px; font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-preview { margin-top: 3px; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-item-meta { margin-top: 6px; display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted); }
.unread-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); flex: 0 0 7px; }

.reply-detail { min-height: 420px; }
.reply-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.reply-detail-head h3 { margin: 0; font-size: 19px; letter-spacing: -0.02em; word-break: break-word; }
.reply-detail-head p { margin: 4px 0 0; font-size: 12.5px; }
.reply-detail-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 16px 0 20px; font-size: 11.5px; color: var(--muted); }
.reply-body { white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.7; color: var(--text-2); padding: 16px 0 24px; }
.reply-detail .hint { margin: 0; }

/* ================================ unibox ================================ */

.unibox-layout {
  display: grid;
  grid-template-columns: minmax(300px, 400px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.unibox-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.unibox-thread {
  min-height: 560px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.unibox-empty { padding: 48px 12px; text-align: center; }
.unibox-empty h3 { margin: 0 0 8px; font-size: 16px; }

.unibox-thread-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.unibox-thread-title h3 { margin: 0; font-size: 19px; letter-spacing: -0.02em; word-break: break-word; }
.unibox-thread-title p { margin: 4px 0 0; font-size: 12.5px; }
.unibox-thread-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.interest-select {
  min-width: 130px;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
}
.interest-badge {
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  background: var(--surface-3);
  color: var(--muted);
}
.interest-badge.interested { background: var(--ok-soft); color: var(--ok); }
.interest-badge.not-interested { background: var(--bad-soft); color: var(--bad); }
.interest-badge.out-of-office { background: var(--warn-soft); color: var(--warn); }
.interest-badge.wrong-person { background: var(--surface-3); color: var(--text-2); }

.unibox-label-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.unibox-label-chip,
.unibox-list-label {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 9px;
}
.unibox-label-chip { cursor: pointer; font-family: inherit; }
.unibox-label-chip:hover { border-color: var(--primary); color: var(--primary); }
.unibox-list-label { padding: 1px 7px; font-size: 9.5px; }
.unibox-label-input {
  width: 110px;
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 999px;
  border: 1px dashed var(--line-strong);
  background: transparent;
}
.unibox-label-color {
  width: 26px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}

.unibox-timeline { display: flex; flex-direction: column; gap: 16px; padding: 4px 0; }

.unibox-msg {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--surface);
  max-width: 92%;
}
.unibox-msg.in { align-self: flex-start; border-left: 3px solid var(--primary); }
.unibox-msg.out { align-self: flex-end; background: var(--primary-soft); border-right: 3px solid var(--primary); }
.unibox-msg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.unibox-msg-from { font-size: 12.5px; line-height: 1.5; word-break: break-word; }
.unibox-msg-body {
  margin-top: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-2);
}
.unibox-msg .badge { margin-top: 8px; }
.unibox-html { margin-top: 10px; }
.unibox-html-frame {
  width: 100%;
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.unibox-attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  max-width: 260px;
}
.attachment-chip span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-chip:hover { border-color: var(--primary); color: var(--primary); }
.attachment-x {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 0 0 0 2px;
}
.attachment-x:hover { color: var(--bad); }

.unibox-composer {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.unibox-composer-tabs { display: flex; gap: 6px; }
.unibox-compose-to { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.unibox-compose-to input { flex: 1; }
.unibox-compose-subject { font-size: 12px; color: var(--muted); }
.unibox-composer textarea { width: 100%; resize: vertical; min-height: 96px; }
.unibox-composer-attachments { display: flex; flex-wrap: wrap; gap: 6px; }
.unibox-compose-actions { display: flex; align-items: center; gap: 8px; }

.modal.wide { max-width: 920px; width: 92vw; }
.attachment-preview { max-height: 68vh; overflow: auto; }
.attachment-image { display: block; max-width: 100%; margin: 0 auto; border-radius: var(--radius); }
.attachment-frame { width: 100%; height: 62vh; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.attachment-text {
  margin: 0;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface-3);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ================================== crm ================================= */

.crm-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.crm-badge.unassigned {
  color: var(--muted);
  background: var(--surface-3);
  border-color: var(--line-strong);
}

.status-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.status-row { display: flex; align-items: center; gap: 8px; }
.status-row > input[type="text"] { flex: 1; min-width: 0; }
.status-row > input[type="color"] {
  width: 38px;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.status-row .small { white-space: nowrap; }

.lead-activity { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 20px; }
.lead-activity .section-head { margin-bottom: 12px; }
.activity-group { margin-bottom: 16px; }
.activity-group:last-child { margin-bottom: 0; }
.activity-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.activity-group-head strong { font-size: 11px; font-weight: 600; }
.small { font-size: 11.5px; }

/* ================================= tasks ================================ */

.check-col { width: 38px; text-align: center; }
.check-col input { width: 15px; height: 15px; cursor: pointer; }
.task-title { text-align: left; }
.task-done .task-title { text-decoration: line-through; color: var(--muted); }
.task-done td { color: var(--muted); }

/* ================================ kanban ================================ */

.kanban {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  overflow-x: auto;
  padding: 4px 4px 12px;
}

.kanban-column {
  flex: 0 0 292px;
  min-height: 240px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  transition: border-color 120ms ease, background-color 120ms ease;
}

.kanban-column.drop {
  border-color: var(--primary-line);
  background: var(--primary-tint);
}

.kanban-column-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 12px;
}

.kanban-column-head strong {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.kanban-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
}

.kanban-count {
  min-width: 22px;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.kanban-cards { display: flex; flex-direction: column; gap: 8px; min-height: 60px; }

.kanban-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: grab;
  text-align: left;
}

.kanban-card:hover { border-color: var(--line-strong); }
.kanban-card:focus-visible { outline: 2px solid var(--primary-line); outline-offset: 1px; }
.kanban-card.dragging { opacity: 0.45; }

.kanban-card-name {
  overflow: hidden;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kanban-card-sub,
.kanban-card-email {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kanban-card-sub { color: var(--text-2); font-size: 12px; }
.kanban-card-email { color: var(--muted); font-size: 11.5px; }

.kanban-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}

.kanban-total {
  font-size: 11px;
  font-weight: 700;
  color: var(--ok);
  font-variant-numeric: tabular-nums;
}

.kanban-deal {
  font-size: 11px;
  font-weight: 700;
  color: var(--ok);
  font-variant-numeric: tabular-nums;
}

.funnel-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}

.funnel-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.funnel-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--violet), var(--blue));
}

.kanban-empty {
  margin: 0;
  padding: 18px 8px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 11.5px;
  text-align: center;
}

@media (max-width: 720px) {
  .kanban-column { flex-basis: 248px; }
}

/* ============================ domain health ============================= */

.dns-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface-3);
  font-size: 11.5px;
  font-weight: 700;
}
.dns-score.good { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.dns-score.warning { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.dns-score.bad { background: var(--bad-soft); border-color: var(--bad-line); color: var(--bad); }

.dns-detail-row td { padding: 0 16px 16px; background: var(--surface-2); }
.dns-details { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.dns-records { display: grid; gap: 8px; margin-bottom: 12px; }
.dns-records > div { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; align-items: start; }
.dns-records strong { font-size: 11.5px; color: var(--text-2); }
.dns-records code { display: block; padding: 6px 8px; white-space: pre-wrap; word-break: break-word; font-size: 11.5px; }
.dns-issues { margin: 0 0 12px; padding-left: 20px; color: var(--text-2); font-size: 12.5px; line-height: 1.6; }
.dns-issues li { margin-bottom: 4px; }
.dns-result { margin-top: 16px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.dns-result-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dns-result-head p { margin: 2px 0 0; font-size: 11.5px; }

/* ============================ dark theme tuning ========================== */

[data-theme="dark"] .brand-mark,
[data-theme="dark"] .account-avatar { color: var(--bg); }

[data-theme="dark"] .account-menu { box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5); border-color: var(--line-strong); }

[data-theme="dark"] code { color: #b9bde0; }

[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23858c9a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

[data-theme="dark"] .chart .grid-line { stroke: #262b35; }
[data-theme="dark"] .chart .sent-area { fill: rgba(129, 140, 248, 0.16); }

[data-theme="dark"] .switch { background: #3a414f; }

[data-theme="dark"] .hint code { background: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .hint.bad { color: #fca5a5; }
[data-theme="dark"] .hint.ok { color: #86efac; }

[data-theme="dark"] .toast { background: #242a34; border-color: rgba(255, 255, 255, 0.08); }
[data-theme="dark"] .toast.ok { background: #145c36; }
[data-theme="dark"] .toast.bad { background: #7f2020; }

[data-theme="dark"] .modal-backdrop { background: rgba(4, 6, 10, 0.66); }

/* ============================== responsive ============================== */

@media (max-width: 1180px) {
  .sequence-layout { grid-template-columns: minmax(0, 1fr) 340px; }
  .content { padding: 24px 28px 56px; }
  .topbar { padding: 14px 28px; }
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .app-shell { display: block; }
  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    width: 100%;
    flex: none;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow: visible;
  }
  .side-brand { display: none; }
  .side-nav {
    flex: 1 1 auto;
    min-width: 0;
    flex-direction: row;
    gap: 2px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .side-nav::-webkit-scrollbar { display: none; }
  .nav-group-label { display: none; }
  .nav-item { height: 34px; padding: 0 12px; white-space: nowrap; }
  .nav-item svg { display: none; }
  .nav-item.active::before { display: none; }
  .side-footer {
    display: flex;
    flex-direction: row;
    align-items: center;
    margin-top: 0;
    padding: 0;
    border-top: 0;
  }
  .side-status-block { display: none; }
  .side-account { margin-left: 0; flex: 0 0 auto; }
  .account-trigger { padding: 4px; }
  .account-trigger .account-ident,
  .account-chevron { display: none; }
  .account-menu {
    position: fixed;
    top: 64px;
    right: 12px;
    bottom: auto;
    left: auto;
    width: 248px;
  }
  .topbar { position: static; }
  .dash-grid,
  .sequence-layout,
  .replies-layout,
  .unibox-layout { grid-template-columns: minmax(0, 1fr); }
  .preview-pane { position: static; }
  .replies-list { max-height: 360px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-grid.small { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .content { padding: 20px 16px 48px; }
  .topbar { padding: 12px 16px; }
  .topbar-left p { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .page-head, .hero-row, .detail-title-row { flex-direction: column; align-items: flex-start; }
  .search-input { min-width: 0; width: 100%; }
  .toolbar { align-items: stretch; }
  .segmented { overflow-x: auto; }
  .stat-grid,
  .stat-grid.small { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-value { font-size: 24px; }
  .card { padding: 20px; margin-bottom: 16px; }
  .form label.check { padding-top: 0; }
}

/* --------------------------- spam checker (5.12) -------------------------- */
.spam-result {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.spam-row {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.spam-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.spam-row-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.spam-score {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 15px;
}

.spam-score.ok {
  color: var(--ok);
}

.spam-score.warn {
  color: var(--warn);
}

.spam-score.high {
  color: var(--bad);
}

.spam-issues {
  margin: 8px 0 0 18px;
}

.spam-issues li {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 3px;
}

/* 13.x rules */
.rule-actions-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
}

.rule-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.rule-action {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rule-action select,
.rule-action input {
  flex: 1;
  min-width: 0;
}

.rule-action .rule-action-type {
  flex: 0 0 170px;
}

.rule-actions-empty {
  color: var(--muted);
  font-size: 13px;
}

.rule-toggle {
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.tag-list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11px;
  line-height: 1.6;
}

.tag-chip button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  font-size: 12px;
  line-height: 1;
}

.tag-chip button:hover {
  color: var(--bad);
}

.tag-add-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
}

/* =============================== settings =============================== */
/* Structure follows Instantly's settings page: narrow left sub-nav, one
   column of 880px cards, card header + divider + body, 36px controls. */

.settings-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  align-items: start;
}

.settings-side {
  position: sticky;
  top: 88px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-right: 20px;
  border-right: 1px solid var(--line);
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.settings-nav-item:hover {
  background: var(--surface-3);
  color: var(--text);
}

.settings-nav-item.active {
  background: var(--primary-soft);
  color: var(--text);
  font-weight: 600;
}

.settings-nav-item:focus-visible {
  outline: 2px solid var(--primary-line);
  outline-offset: 1px;
}

.settings-side-foot {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 10px 0;
  border-top: 1px solid var(--line);
}

.settings-side-foot strong {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

.settings-side-foot span {
  font-size: 11.5px;
  color: var(--muted);
}

.settings-body {
  min-width: 0;
  max-width: 880px;
  padding-left: 32px;
}

.settings-panel .card {
  padding: 0;
  margin-bottom: 20px;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

:root[data-theme="dark"] .settings-panel .card {
  box-shadow: none;
}

.settings-panel .card-head {
  position: relative;
  align-items: flex-start;
  padding: 16px 16px 12px;
  margin: 0;
}

.settings-panel .card-head::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 0;
  height: 1px;
  background: var(--line);
}

.settings-panel .card-head h3 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.settings-panel .card-head p {
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.5;
}

.settings-panel .card-body {
  padding: 16px;
}

.settings-panel .form.card-body {
  padding: 16px;
  gap: 14px;
}

.settings-panel .form label {
  font-size: 13px;
  font-weight: 500;
}

.settings-panel .form label > input,
.settings-panel .form label > select,
.settings-panel .form label > textarea {
  margin-top: 6px;
  padding: 7px 12px;
  font-size: 14px;
  line-height: 1.4;
  border-radius: 8px;
}

.settings-panel .btn {
  height: 36px;
  font-size: 13px;
  border-radius: 8px;
}

.settings-panel .btn.sm {
  height: 30px;
}

.settings-panel .hint {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
}

.settings-panel fieldset {
  border-radius: 10px;
  padding: 14px 16px 16px;
}

.settings-panel .form label.switch-row {
  display: flex;
  align-items: center;
  padding-top: 2px;
}

/* Keep the save row in view while a long section scrolls. */
.settings-panel .form.card-body > .actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  margin: 2px -16px -16px;
  padding: 12px 16px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-radius: 0 0 14px 14px;
}

.settings-panel .dns-result {
  margin: 0 16px 16px;
}

/* Profile card, mirroring Instantly's "Basic information". */
.settings-profile {
  display: flex;
  align-items: center;
  gap: 14px;
}

.settings-avatar {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 20px;
  font-weight: 700;
}

.settings-profile-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.settings-profile-text strong {
  font-size: 15px;
  font-weight: 600;
}

.settings-profile-text span {
  font-size: 13px;
  color: var(--muted);
}

@media (max-width: 980px) {
  .settings-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

  .settings-side {
    position: static;
    gap: 10px;
    padding-right: 0;
    border-right: 0;
  }

  .settings-nav {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 6px;
  }

  .settings-nav-item {
    width: auto;
    white-space: nowrap;
  }

  .settings-side-foot {
    display: none;
  }

  .settings-body {
    padding-left: 0;
  }

  .settings-panel .card-head h3 {
    font-size: 16px;
  }
}
