:root, [data-theme="dark"] {
  --bg: #0b0f14;
  --bg2: #111822;
  --panel: #151c27;
  --panel2: #1b2433;
  --line: #2a3548;
  --text: #eef3fb;
  --muted: #93a0b5;
  --green: #22c55e;
  --green2: #16a34a;
  --red: #ef4444;
  --amber: #f59e0b;
  --radius: 14px;
  --shadow: 0 12px 40px rgba(0,0,0,.35);
  --font: "Heebo", "Inter", "Segoe UI", Tahoma, Arial, sans-serif;
  --sidebar: rgba(17,24,34,.96);
}
[data-theme="light"] {
  --bg: #eef2f7;
  --bg2: #ffffff;
  --panel: #ffffff;
  --panel2: #f5f7fb;
  --line: #d5deea;
  --text: #0f172a;
  --muted: #5b6b82;
  --green: #159c4a;
  --green2: #12803d;
  --red: #dc2626;
  --amber: #d97706;
  --sidebar: #ffffff;
  --shadow: 0 10px 28px rgba(15,23,42,.07);
}
[data-density="compact"] .field { margin-bottom: 10px; }
[data-density="compact"] .panel { padding: 14px; }
[data-reduce-motion="1"] * { transition: none !important; animation: none !important; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
[data-theme="dark"] body {
  background: radial-gradient(1100px 520px at 100% -10%, #14301f 0%, transparent 55%), var(--bg);
}
button, input, select, textarea { font-family: inherit; font-size: 0.875rem; }
.app-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar);
  border-inline-end: 1px solid var(--line);
  padding: 20px 14px;
  display: flex; flex-direction: column; gap: 20px;
  position: sticky; top: 0; height: 100vh;
}
.brand { /* layout set in brand block below */ }
.brand-name { display: none !important; }
.brand-sub { font-size: 0.75rem; color: var(--muted); }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  background: transparent; border: 0; color: var(--muted);
  text-align: start; padding: 11px 12px; border-radius: 12px;
  cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 10px;
}
.nav-item:hover { background: var(--panel2); color: var(--text); }
.nav-item.active { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.nav-ico { width: 22px; text-align: center; }
.side-foot { margin-top: auto; display: grid; gap: 8px; padding: 6px; }
.status-pill {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 12px; border-radius: 999px; font-size: 0.75rem; font-weight: 700;
}
.status-wait { background: var(--panel2); color: var(--muted); }
.status-on { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }
.status-off { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.side-port { display: none !important; }
.main { padding: 26px 30px 48px; max-width: 1180px; width: 100%; }
.view { display: none; }
.view.active { display: block; }
.view-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 18px;
}
.view-head h1 { font-size: 1.625rem; font-weight: 800; letter-spacing: -.03em; }
.view-desc { color: var(--muted); margin-top: 6px; max-width: 560px; font-size: 0.875rem; }

.btn {
  border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 700;
  cursor: pointer; transition: .15s ease;
}
.btn-primary { background: linear-gradient(135deg, var(--green), var(--green2)); color: #04210f; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--text); border-color: color-mix(in srgb, var(--green) 40%, var(--line)); }
.btn-danger { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.btn-sm { padding: 8px 12px; font-size: 0.75rem; border-radius: 10px; }

.chip {
  background: var(--panel2); color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 12px; font-size: 0.75rem; font-weight: 700; white-space: nowrap;
}
.chip-off { color: var(--red); }
.chip-on { color: var(--green); border-color: color-mix(in srgb, var(--green) 35%, var(--line)); }

.panel, .connect-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px;
}
.connect-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 18px; }
.toolbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; margin-bottom: 14px;
}
.field { display: grid; gap: 7px; margin-bottom: 12px; }
.field.compact { margin-bottom: 0; min-width: 160px; }
.field span { font-size: 0.75rem; color: var(--muted); font-weight: 600; }
input, select, textarea {
  width: 100%; background: var(--bg2); border: 1px solid var(--line);
  color: var(--text); border-radius: 12px; padding: 11px 13px; outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: color-mix(in srgb, var(--green) 45%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 16%, transparent);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.steps { margin: 14px 0 0; padding-inline-start: 18px; color: var(--muted); font-size: 0.8125rem; display: grid; gap: 6px; }
.qr-panel {
  background: var(--bg2); border: 1px dashed var(--line); border-radius: 16px;
  min-height: 300px; display: grid; place-items: center; padding: 16px; text-align: center;
}
.qr-placeholder { color: var(--muted); font-size: 0.875rem; max-width: 200px; }
#qrImage { width: 220px; height: 220px; background: #fff; border-radius: 12px; padding: 10px; }
.qr-status { margin-top: 10px; font-size: 0.8125rem; color: var(--green); font-weight: 600; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.account-card {
  background: linear-gradient(165deg, color-mix(in srgb, var(--panel) 92%, #0a0f18), var(--panel));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.account-card::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0; bottom: 0;
  width: 3px;
  background: var(--line);
  opacity: .7;
}
.account-card.connected {
  border-color: color-mix(in srgb, var(--green) 50%, var(--line));
  box-shadow: 0 8px 28px color-mix(in srgb, var(--green) 12%, transparent);
}
.account-card.connected::before {
  background: var(--green);
  opacity: 1;
  box-shadow: 0 0 12px color-mix(in srgb, var(--green) 50%, transparent);
}
.account-card:hover {
  border-color: color-mix(in srgb, var(--green) 30%, var(--line));
}
.account-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.account-avatar {
  width: 46px; height: 46px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1rem; flex-shrink: 0;
  background: color-mix(in srgb, var(--green) 16%, var(--panel2));
  color: var(--green);
  border: 1px solid color-mix(in srgb, var(--green) 28%, var(--line));
}
.account-card.connected .account-avatar {
  background: color-mix(in srgb, var(--green) 22%, var(--panel2));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 12%, transparent);
}
.account-card-info { min-width: 0; flex: 1; }
.account-card .title {
  font-weight: 800; font-size: 0.9375rem; margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.account-card .meta {
  color: var(--muted); font-size: 0.75rem;
  display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center;
}
.account-card .meta-id {
  font-size: 0.6875rem; opacity: .75;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.account-card .phone-line {
  font-size: 0.8125rem; font-weight: 700; color: var(--text);
  letter-spacing: 0.01em;
}
.account-card .actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding-top: 2px;
  border-top: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  padding-top: 12px;
}
.account-card .actions .btn {
  flex: 1 1 auto;
  min-width: 0;
  justify-content: center;
}
.account-card .actions .btn-danger {
  flex: 0 0 40px;
  padding-left: 0; padding-right: 0;
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; margin-inline-end: 6px;
  background: var(--muted);
}
.status-dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }
.status-dot.off { background: var(--red); }
.status-dot.wait { background: #f59e0b; }
.badge {
  display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px;
  font-size: 0.6875rem; font-weight: 700;
}
.badge-on { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }
.badge-off { background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); }
.badge-qr { background: color-mix(in srgb, var(--amber) 16%, transparent); color: var(--amber); }

.mailbox {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  gap: 14px;
  min-height: 560px;
  height: min(72vh, 680px);
  align-items: stretch;
}
.mailbox-list {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: 100%;
  box-shadow: 0 4px 24px rgba(0,0,0,.12);
  display: block;
}
.mailbox-list-scroll {
  overflow: auto;
  flex: 1;
  min-height: 0;
}
.mailbox-thread-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  position: relative;
  box-shadow: 0 4px 24px rgba(0,0,0,.12);
}
.thread-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel2) 90%, #000 10%), var(--panel2));
  border-radius: 0;
  flex-shrink: 0;
}
.thread-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.9375rem; flex-shrink: 0;
  background: color-mix(in srgb, var(--green) 22%, var(--panel));
  color: var(--green);
  border: 1px solid color-mix(in srgb, var(--green) 35%, var(--line));
}
.thread-avatar.is-group {
  background: color-mix(in srgb, #3b82f6 22%, var(--panel));
  color: #93c5fd;
  border-color: color-mix(in srgb, #3b82f6 35%, var(--line));
}
.thread-head-text {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  text-align: start;
}
.thread-title {
  font-weight: 800;
  font-size: 0.9375rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.thread-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
  font-weight: 600;
  line-height: 1.3;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thread-meta.is-phone {
  direction: ltr;
  unicode-bidi: plaintext;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.mailbox-thread {
  flex: 1;
  overflow: auto;
  padding: 14px 8px 18px;
  background:
    radial-gradient(ellipse at top, color-mix(in srgb, var(--green) 4%, transparent), transparent 55%),
    var(--panel);
}
.reply-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg2) 85%, var(--panel));
  border-radius: 0;
  flex-shrink: 0;
}
.reply-bar input { flex: 1; margin: 0; }
.chat-item {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  cursor: pointer;
  transition: background .15s ease;
}
.chat-item:hover { background: color-mix(in srgb, var(--panel2) 80%, transparent); }
.chat-item.active {
  background: color-mix(in srgb, var(--green) 12%, var(--panel2));
  box-shadow: inset 3px 0 0 var(--green);
}
.chat-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.875rem; flex-shrink: 0;
  background: color-mix(in srgb, var(--green) 18%, var(--panel2));
  color: var(--green);
  border: 1px solid color-mix(in srgb, var(--green) 28%, var(--line));
}
.chat-avatar.is-group {
  background: color-mix(in srgb, #3b82f6 18%, var(--panel2));
  color: #93c5fd;
  border-color: color-mix(in srgb, #3b82f6 28%, var(--line));
}
.chat-item-body { min-width: 0; }
.chat-name {
  font-weight: 700; font-size: 13.5px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  line-height: 1.35;
}
.chat-name-text {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.chat-preview {
  color: var(--muted); font-size: 0.75rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 3px;
}
.chat-meta {
  color: var(--muted); font-size: 0.6875rem; margin-top: 3px; opacity: .9;
  display: flex; gap: 8px; flex-wrap: wrap;
}
.type-tag {
  display: inline-block; font-size: 10px; font-weight: 800;
  padding: 2px 7px; border-radius: 999px;
  flex-shrink: 0;
}
.type-group { background: color-mix(in srgb, #3b82f6 18%, transparent); color: #60a5fa; }
.type-private { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }
.unread {
  display: inline-flex; min-width: 18px; height: 18px; padding: 0 6px; border-radius: 999px;
  background: var(--green); color: #052e16; font-size: 0.6875rem; font-weight: 800;
  align-items: center; justify-content: center; margin-inline-start: auto;
}
.msg {
  max-width: min(78%, 520px);
  margin: 6px 14px;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.45;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
  word-break: break-word;
}
.msg-out {
  background: color-mix(in srgb, var(--green) 22%, var(--panel));
  margin-inline-start: auto;
  margin-inline-end: 14px;
  border-bottom-left-radius: 6px;
}
.msg-in {
  background: var(--panel2);
  margin-inline-end: auto;
  margin-inline-start: 14px;
  border-bottom-right-radius: 6px;
}
.msg-meta { font-size: 0.6875rem; color: var(--muted); margin-top: 6px; opacity: .9; }
.empty-state { color: var(--muted); padding: 28px; text-align: center; font-size: 0.875rem; }
.muted { color: var(--muted); font-size: 0.8125rem; }
.checks { display: flex; gap: 14px; flex-wrap: wrap; margin: 6px 0 12px; }
.checks.wrap { gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 0.8125rem; }
.check input { width: auto; }

.emoji-toolbar { position: relative; margin: -2px 0 12px; }
.emoji-popover {
  position: absolute; z-index: 20; top: 110%; inset-inline-start: 0;
  width: min(320px, 90vw); max-height: 220px; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px;
  box-shadow: var(--shadow);
}
.emoji-popover button {
  background: transparent; border: 0; font-size: 20px; cursor: pointer; border-radius: 8px; padding: 4px;
}
.emoji-popover button:hover { background: var(--panel2); }

.schedule-box {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px;
}
.schedule-box h3 { font-size: 0.875rem; margin-bottom: 10px; }

.seg {
  display: inline-flex; background: var(--bg2); border: 1px solid var(--line);
  border-radius: 12px; padding: 4px; margin-bottom: 12px;
}
.seg-btn {
  background: transparent; border: 0; color: var(--muted); padding: 8px 14px;
  border-radius: 10px; cursor: pointer; font-weight: 700; font-size: 0.8125rem;
}
.seg-btn.active { background: var(--green); color: #052e16; }
.inner { display: none; }
.inner.active { display: block; }
.result {
  margin-top: 12px; background: var(--bg2); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px; font-size: 0.75rem; max-height: 280px; overflow: auto;
}
.log {
  margin-top: 12px; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px; max-height: 200px; overflow: auto; font-size: 0.75rem; color: var(--muted);
  font-family: ui-monospace, Consolas, monospace;
}
.stats-row {
  display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; color: var(--muted); font-size: 0.8125rem; align-items: center;
}
.stats-row strong { color: var(--text); }
.list-block { margin-top: 12px; display: grid; gap: 8px; }
.group-item {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer;
}
.group-item:hover { border-color: color-mix(in srgb, var(--green) 40%, var(--line)); }
.groups-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.group-add-session-menu { margin: 12px 0; }
.group-add-session-menu summary { cursor: pointer; font-weight: 700; }
.group-add-session-list { display: grid; gap: 6px; margin-top: 8px; max-height: 180px; overflow: auto; }
.group-add-session-list .check { margin: 0; }
.group-add-result { white-space: pre-wrap; min-height: 2.5rem; }
.campaign-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 15px; margin-bottom: 10px;
}
.campaign-card.running { border-color: color-mix(in srgb, var(--green) 40%, var(--line)); }
.campaign-card .c-name { font-weight: 800; margin-bottom: 6px; }
.campaign-card .c-meta { color: var(--muted); font-size: 0.75rem; margin-bottom: 10px; }
.campaign-card .c-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.settings-check { margin-top: 8px; }
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  padding: 12px 18px; border-radius: 12px; z-index: 50;
  transition: transform .25s ease, opacity .2s ease;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  max-width: 90vw; white-space: nowrap;
}
.toast:not(.show) { display: none !important; width: 0 !important; height: 0 !important; padding: 0 !important; border: 0 !important; overflow: hidden !important; }
.toast.show { display: block !important; transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { border-color: color-mix(in srgb, var(--red) 40%, var(--line)); }
.toast.success { border-color: color-mix(in srgb, var(--green) 40%, var(--line)); }
[hidden] { display: none !important; }

@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .connect-grid, .mailbox, .settings-grid, .form-grid, .form-grid.three, .form-grid.two { grid-template-columns: 1fr; }
  .main { padding: 16px; }
}

/* Campaign form layout */
.campaign-form-panel { max-width: 820px; }
.campaign-form-head { margin-bottom: 8px; }
.campaign-form-head h2 { margin-bottom: 4px; }
.camp-section {
  border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  padding-top: 14px;
  margin-top: 6px;
  margin-bottom: 4px;
}
.camp-section-title {
  font-size: 0.8125rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}
.camp-hint { margin: -2px 0 10px; font-size: 0.75rem; }
.camp-two {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
}
.session-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
.session-check-grid .check {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.session-check-grid .check:has(input:checked) {
  border-color: color-mix(in srgb, var(--green) 45%, var(--line));
  background: color-mix(in srgb, var(--green) 8%, var(--bg2));
}
.file-field input[type=file] { padding: 10px; }
.camp-actions { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
@media (max-width: 700px) {
  .camp-two { grid-template-columns: 1fr; }
}

.reply-attach {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--panel2); border: 1px solid var(--line);
  cursor: pointer; flex-shrink: 0;
}
.reply-attach:hover { border-color: color-mix(in srgb, var(--green) 40%, var(--line)); }
.attach-ico { font-size: 1.125rem; line-height: 1; }
.reply-file-name {
  font-size: 0.6875rem; color: var(--muted); max-width: 100px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}








/* ===== Reply composer — equal controls ===== */
.reply-bar {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 12px 14px !important;
  min-height: 66px !important;
  box-sizing: border-box !important;
  position: relative !important;
  z-index: 30 !important;
  overflow: visible !important;
  border-top: 1px solid var(--line);
  background: var(--panel, #12161f);
}
.reply-tools {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  height: 44px !important;
  flex-shrink: 0 !important;
}
/* BOTH buttons identical box model */
.reply-tools .reply-tool-btn,
.reply-tools label.reply-attach,
.reply-tools button.btn-emoji-ico,
#btnReplyEmoji,
label.reply-attach {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  max-width: 44px !important;
  max-height: 44px !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 12px !important;
  border: 1px solid var(--line) !important;
  background: #1a2030 !important;
  color: #e8eefc !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  line-height: 0 !important;
  flex: 0 0 44px !important;
  cursor: pointer !important;
  vertical-align: middle !important;
}
.reply-tools .reply-tool-btn svg {
  width: 18px !important;
  height: 18px !important;
  display: block !important;
}
#btnReplyEmoji {
  font-size: 20px !important;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif !important;
}
.reply-emoji-wrap {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 44px !important;
  width: 44px !important;
  flex: 0 0 44px !important;
  position: relative !important;
  margin: 0 !important;
  padding: 0 !important;
}
#replyText {
  flex: 1 1 auto !important;
  height: 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;
  margin: 0 !important;
  padding: 0 14px !important;
  border-radius: 12px !important;
  box-sizing: border-box !important;
}
#btnReply.btn-reply-send,
#btnReply {
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 18px !important;
  border-radius: 12px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}

/* Fixed portal panel — centered above the emoji button */
.emoji-popover-portal {
  position: fixed !important;
  z-index: 2147483647 !important;
  width: 320px !important;
  max-height: 280px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 12px !important;
  display: grid !important;
  grid-template-columns: repeat(8, 1fr) !important;
  gap: 6px !important;
  background: #151b28 !important;
  border: 1px solid rgba(255,255,255,0.16) !important;
  border-radius: 14px !important;
  box-shadow: 0 16px 48px rgba(0,0,0,0.55) !important;
  box-sizing: border-box !important;
}
.emoji-popover-portal[hidden] { display: none !important; }
.emoji-popover-portal button {
  border: 0 !important;
  background: transparent !important;
  font-size: 22px !important;
  cursor: pointer !important;
  border-radius: 10px !important;
  padding: 6px 2px !important;
  line-height: 1.15 !important;
}
.emoji-popover-portal button:hover { background: rgba(255,255,255,0.1) !important; }




/* Date / time inputs — calendar/clock icons match theme */
input[type="date"],
input[type="time"] {
  color-scheme: dark;
  color: var(--text, #e8eefc);
  background: var(--bg2, var(--panel2, #1a2030));
  border: 1px solid var(--line);
  border-radius: 12px;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 1;
  /* native icons are dark; invert → light gray/white for dark UI */
  filter: invert(1) brightness(0.92) contrast(0.95);
  padding: 2px;
  border-radius: 4px;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
  filter: invert(1) brightness(1.05);
  background: rgba(255,255,255,0.06);
}
input[type="date"]::-webkit-datetime-edit,
input[type="time"]::-webkit-datetime-edit,
input[type="date"]::-webkit-datetime-edit-fields-wrapper,
input[type="time"]::-webkit-datetime-edit-fields-wrapper {
  color: var(--text, #e8eefc);
}
input[type="date"]::-webkit-datetime-edit-text,
input[type="time"]::-webkit-datetime-edit-text {
  color: var(--muted, #94a3b8);
}
input[type="date"]::-webkit-datetime-edit-year-field,
input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="time"]::-webkit-datetime-edit-hour-field,
input[type="time"]::-webkit-datetime-edit-minute-field,
input[type="time"]::-webkit-datetime-edit-ampm-field {
  color: var(--text, #e8eefc);
}

/* Light theme — keep dark-gray icons (no invert) */
[data-theme="light"] input[type="date"],
[data-theme="light"] input[type="time"] {
  color-scheme: light;
  color: var(--text, #0f172a);
  background: #fff;
  border-color: var(--line);
}
[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="light"] input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(0.35) brightness(0.85);
  opacity: 0.85;
}
[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator:hover,
[data-theme="light"] input[type="time"]::-webkit-calendar-picker-indicator:hover {
  filter: invert(0.25) brightness(0.7);
  background: rgba(0,0,0,0.04);
}
[data-theme="light"] input[type="date"]::-webkit-datetime-edit,
[data-theme="light"] input[type="time"]::-webkit-datetime-edit,
[data-theme="light"] input[type="date"]::-webkit-datetime-edit-year-field,
[data-theme="light"] input[type="date"]::-webkit-datetime-edit-month-field,
[data-theme="light"] input[type="date"]::-webkit-datetime-edit-day-field,
[data-theme="light"] input[type="time"]::-webkit-datetime-edit-hour-field,
[data-theme="light"] input[type="time"]::-webkit-datetime-edit-minute-field {
  color: var(--text, #0f172a);
}
[data-theme="light"] input[type="date"]::-webkit-datetime-edit-text,
[data-theme="light"] input[type="time"]::-webkit-datetime-edit-text {
  color: var(--muted, #64748b);
}
.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  margin-top: 10px;
}
.send-options { margin-top: 16px; }
.schedule-box {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel2, #151b28);
}
.schedule-box h3 { margin: 0 0 12px; font-size: 0.875rem; }


/* Stats dashboard */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
}
.stat-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: 6px;
}
.stat-value {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
}
.stat-sub {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--muted);
}
.stats-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--panel2);
  border: 1px solid var(--line);
  font-size: 0.75rem;
}
.stat-chip strong { font-weight: 800; }
.activity-log {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel2);
}
.activity-row {
  display: grid;
  grid-template-columns: 150px 90px 1fr 70px;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 0.75rem;
  align-items: center;
}
.activity-row:last-child { border-bottom: 0; }
.activity-row .ok { color: var(--green); font-weight: 700; }
.activity-row .fail { color: #f87171; font-weight: 700; }
.activity-row .cat {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--green) 12%, transparent);
  color: var(--green);
  font-weight: 700;
  font-size: 0.6875rem;
}
.head-actions { display: flex; gap: 8px; align-items: center; }

/* minor global polish */
.panel { border-radius: 16px; }
.view-head { margin-bottom: 14px; }


/* Campaign cards — compact, log inside card */
.campaign-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--panel);
  margin-bottom: 10px;
}
.campaign-card.running {
  border-color: color-mix(in srgb, var(--green) 45%, var(--line));
}
.campaign-card .c-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.campaign-card .c-name {
  font-weight: 800;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.campaign-card .c-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.campaign-card .c-meta {
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.campaign-card .c-progress {
  margin-top: 8px;
  height: 4px;
  border-radius: 99px;
  background: var(--panel2);
  overflow: hidden;
}
.campaign-card .c-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--green2, #34d399));
  border-radius: 99px;
  transition: width .3s ease;
}
.campaign-card .c-log {
  margin-top: 8px;
  max-height: 96px;
  overflow: auto;
  font-size: 0.6875rem;
  color: var(--muted);
  border-top: 1px dashed var(--line);
  padding-top: 6px;
}
.campaign-card .c-log:empty { display: none; }
.campaign-card .c-log-line { padding: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge-on {
  background: color-mix(in srgb, var(--green) 20%, transparent);
  color: var(--green);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 800;
}

/* denser global panels */
.panel { padding: 14px 16px; }
.view-desc { opacity: .75; font-size: 0.8125rem; }
.session-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

.activity-row {
  grid-template-columns: 140px 100px 1fr 56px !important;
  direction: rtl;
}
.activity-row .act-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.activity-row .act-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-value { font-variant-numeric: tabular-nums; }








/* ===== Nav stroke icons ===== */
.side-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
}
.side-nav .nav-ico {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--muted, #9aa6bf);
  opacity: 0.9;
}
.side-nav .nav-ico svg {
  width: 18px;
  height: 18px;
  display: block;
}
.side-nav .nav-item:hover .nav-ico,
.side-nav .nav-item.active .nav-ico {
  color: var(--green, #34d399);
  opacity: 1;
}


/* nav icons stay consistent */
.side-nav .nav-ico svg {
  width: 18px;
  height: 18px;
  display: block;
}


/* Light theme polish */
[data-theme="light"] body,
[data-theme="light"] .app-shell { background: var(--bg); color: var(--text); }
[data-theme="light"] .sidebar {
  background: #ffffff;
  border-inline-end: 1px solid var(--line);
  box-shadow: 4px 0 24px rgba(15,23,42,.04);
}
[data-theme="light"] .nav-item {
  color: #334155;
}
[data-theme="light"] .nav-item:hover {
  background: #f1f5f9;
}
[data-theme="light"] .nav-item.active {
  background: color-mix(in srgb, var(--green) 16%, #ffffff);
  color: var(--green2);
}
[data-theme="light"] .panel,
[data-theme="light"] .stat-card,
[data-theme="light"] .campaign-card {
  background: var(--panel);
  border-color: var(--line);
  box-shadow: var(--shadow);
}
[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}
[data-theme="light"] .btn-ghost {
  background: #f8fafc;
  border-color: var(--line);
  color: var(--text);
}
[data-theme="light"] .muted { color: var(--muted); }
[data-theme="light"] .sidebar .brand-name { color: #0f172a; }
[data-theme="light"] .status-pill { border-color: var(--line); }


/* Density */
[data-density="compact"] .panel { padding: 12px 14px; }
[data-density="compact"] .view-head { margin-bottom: 10px; }
[data-density="compact"] .nav-item { padding: 8px 12px; }
[data-density="compact"] .stat-card { padding: 10px 12px; }
[data-density="compact"] .field { margin-bottom: 8px; }
[data-density="compact"] .btn { padding: 8px 12px; }

/* Reduce motion */
[data-reduce-motion="1"] *,
[data-reduce-motion="1"] *::before,
[data-reduce-motion="1"] *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

/* Font scale */
html {
  font-size: calc(16px * var(--font-scale, 1));
}
body {
  font-size: 1rem !important;
}

/* Settings layout */
.settings-h {
  font-size: 0.875rem;
  font-weight: 800;
  margin: 0 0 12px;
  letter-spacing: .02em;
}
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px 16px;
}
.settings-checks {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}
.settings-actions { margin-top: 12px; }
.settings-check { gap: 8px; }


/* Light theme — professional buttons & chrome */
[data-theme="light"] .btn-primary {
  background: linear-gradient(180deg, #22c55e, #16a34a);
  color: #fff;
  border: 1px solid #15803d;
  box-shadow: 0 1px 2px rgba(15,23,42,.08);
}
[data-theme="light"] .btn-primary:hover {
  filter: brightness(1.03);
}
[data-theme="light"] .btn-ghost {
  background: #fff;
  border: 1px solid var(--line);
  color: #0f172a;
}
[data-theme="light"] .btn-ghost:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}
[data-theme="light"] .btn-danger {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}
[data-theme="light"] .seg-btn {
  background: #f8fafc;
  border-color: var(--line);
  color: #334155;
}
[data-theme="light"] .seg-btn.active {
  background: color-mix(in srgb, var(--green) 14%, #fff);
  color: var(--green2);
  border-color: color-mix(in srgb, var(--green) 35%, var(--line));
}
[data-theme="light"] .status-pill {
  background: #f8fafc;
  color: #0f172a;
}
[data-theme="light"] .toast {
  background: #0f172a;
  color: #fff;
}
[data-theme="light"] .activity-log,
[data-theme="light"] .emoji-popover-portal {
  background: #fff;
  border-color: var(--line);
}
[data-theme="light"] .stat-card {
  background: #fff;
}

/* Stats filter row — aligned, not cramped */
.stats-filter-panel { margin-top: 16px; }
.stats-filter-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.stats-cat-field {
  flex: 1 1 220px;
  margin: 0 !important;
  max-width: 320px;
}
.stats-filter-row #btnStatsFilter {
  height: 42px;
  min-width: 88px;
  margin-bottom: 0;
  align-self: flex-end;
}
.stats-activity-title {
  margin: 16px 0 8px;
  font-size: 0.875rem;
  font-weight: 800;
}
.about-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  margin: 0 0 12px;
}
.about-ver {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  background: color-mix(in srgb, var(--green) 14%, transparent);
  color: var(--green);
  border: 1px solid color-mix(in srgb, var(--green) 30%, var(--line));
}


/* Light theme — reply tools (emoji / attach) */
[data-theme="light"] .reply-tool-btn,
[data-theme="light"] label.reply-attach,
[data-theme="light"] #btnReplyEmoji,
[data-theme="light"] .btn-emoji-ico {
  background: #f1f5f9 !important;
  border: 1px solid #d5deea !important;
  color: #0f172a !important;
}
[data-theme="light"] .reply-tool-btn:hover,
[data-theme="light"] #btnReplyEmoji:hover {
  background: #e2e8f0 !important;
  border-color: #cbd5e1 !important;
  color: var(--green2) !important;
}
[data-theme="light"] .reply-bar {
  background: #ffffff !important;
  border-top-color: var(--line) !important;
}
[data-theme="light"] #replyText {
  background: #fff !important;
  color: #0f172a !important;
  border: 1px solid #d5deea !important;
}

[data-theme="light"] .thread-header {
  background: #fff;
  border-color: var(--line);
}


/* Mailbox composer polish */
#replyBox.reply-bar {
  backdrop-filter: blur(8px);
}
#btnReply.btn-reply-send,
#btnReply {
  background: var(--green) !important;
  color: #042f1a !important;
  font-weight: 800 !important;
  border: none !important;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--green) 35%, transparent);
}
#btnReply:hover {
  filter: brightness(1.06);
}
.reply-file-name {
  font-size: 0.75rem;
  color: var(--muted);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mailbox .toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 12px;
}
@media (max-width: 900px) {
  .mailbox {
    grid-template-columns: 1fr;
    height: auto;
  }
  .mailbox-list { max-height: 280px; }
  .mailbox-thread-wrap { min-height: 420px; }
}


/* Mailbox toolbar alignment — all controls same height */
.mailbox-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}
.mailbox-toolbar .field.compact {
  flex: 1 1 160px;
  min-width: 140px;
  max-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mailbox-toolbar .field.compact > span {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.2;
  min-height: 1.2em;
}
.mailbox-toolbar .toolbar-actions {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-inline-start: auto;
  height: auto;
  padding-bottom: 0;
}
.mailbox-toolbar .toolbar-actions .btn {
  height: 44px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
}
.mailbox-toolbar .toolbar-actions .btn:hover {
  border-color: color-mix(in srgb, var(--green) 40%, var(--line));
  color: var(--green);
}
.mailbox-toolbar select {
  height: 44px;
  min-height: 44px;
  padding-top: 0;
  padding-bottom: 0;
  box-sizing: border-box;
}
/* Media segment — same 44px height as account/type selects */
.mailbox-toolbar #mailboxMediaSeg.seg,
.mailbox-toolbar .seg {
  display: inline-flex;
  align-items: stretch;
  height: 44px;
  min-height: 44px;
  padding: 3px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel2);
  box-sizing: border-box;
  gap: 2px;
}
.mailbox-toolbar .seg .seg-btn {
  height: 100%;
  min-height: 0;
  padding: 0 14px;
  border-radius: 9px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  white-space: nowrap;
}
.mailbox-toolbar .seg .seg-btn.active {
  background: var(--green);
  color: #052e16;
}
.mailbox-toolbar .seg .seg-btn:not(.active):hover {
  color: var(--text);
}

/* Sidebar copyright */
.side-copyright {
  text-align: center;
  font-size: 10.5px;
  line-height: 1.35;
  color: var(--muted);
  opacity: 0.85;
  padding: 4px 6px 2px;
  letter-spacing: 0.02em;
  font-weight: 600;
}

/* Custom file pickers — hide native browser label language */
.file-field {
  position: relative;
}
.file-field input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  z-index: 2;
}
.file-field .file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  font-weight: 700;
  font-size: 0.8125rem;
  width: fit-content;
  pointer-events: none;
}
.file-field .file-chosen {
  display: block;
  margin-top: 6px;
  font-size: 0.75rem;
}

.badge { display: inline-flex; align-items: center; gap: 4px; }
.badge .status-dot { margin: 0; }
.badge-on { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); padding: 3px 8px; border-radius: 999px; font-size: 0.6875rem; font-weight: 800; }
.badge-off { background: var(--panel2); color: var(--muted); padding: 3px 8px; border-radius: 999px; font-size: 0.6875rem; font-weight: 700; }
.badge-qr { background: color-mix(in srgb, #f59e0b 18%, transparent); color: #fbbf24; padding: 3px 8px; border-radius: 999px; font-size: 0.6875rem; font-weight: 800; }

.schedule-box input[type="date"],
.schedule-box input[type="time"] {
  min-height: 42px;
}

/* phone hidden in side list — only thread header shows number */
.mailbox-list .chat-phone { display: none !important; }
.chat-phone {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  margin-top: 2px;
  letter-spacing: 0.01em;
  direction: ltr;
  unicode-bidi: plaintext;
}
.thread-meta {
  direction: ltr;
  unicode-bidi: plaintext;
}

.warmer-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin: 12px 0 16px;
}
.warmer-card {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}
.warmer-card.is-ready {
  border-color: color-mix(in srgb, var(--green) 45%, var(--line));
  box-shadow: 0 6px 20px color-mix(in srgb, var(--green) 12%, transparent);
}
.warmer-card-top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.warmer-card-name { font-weight: 800; font-size: 0.8125rem; }
.warmer-card-meta { font-size: 0.6875rem; color: var(--muted); margin-top: 4px; direction: ltr; unicode-bidi: plaintext; }
.warmer-bar {
  height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--line) 80%, transparent);
  margin-top: 10px; overflow: hidden;
}
.warmer-bar-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--green) 70%, #0ea5e9), var(--green));
  transition: width .35s ease;
}
.warmer-card-stats { font-size: 0.6875rem; color: var(--muted); margin-top: 6px; font-weight: 600; }
.camp-section-title {
  font-size: 0.8125rem; font-weight: 800; margin: 14px 0 8px; color: var(--text);
}

/* Thread header: phone / members under name */
.thread-title { font-weight: 800; font-size: 0.9375rem; line-height: 1.3; }
.thread-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 3px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* Anti-ban / options panels — clean stacked layout */
.camp-section {
  margin-top: 16px;
  padding-top: 4px;
}
.camp-section-title {
  font-size: 0.8125rem;
  font-weight: 800;
  margin: 0 0 12px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.safe-send-panel {
  background: color-mix(in srgb, var(--panel2) 88%, transparent);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 16px 14px;
  margin-top: 16px;
}
.safe-send-panel .camp-section-title {
  margin-bottom: 14px;
}
.safe-send-panel .form-grid {
  margin-bottom: 10px;
}
.safe-send-panel .form-grid:last-of-type {
  margin-bottom: 6px;
}
.safe-hint {
  margin: 8px 0 0;
  font-size: 0.75rem;
  line-height: 1.45;
}
.checks-row,
.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  align-items: center;
  margin-top: 12px;
}
.schedule-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel2);
  font-weight: 700;
  cursor: pointer;
}
.schedule-toggle:hover {
  border-color: color-mix(in srgb, var(--green) 35%, var(--line));
}
.schedule-box {
  margin-top: 12px;
}
.send-options .form-grid.three .field,
.camp-section .form-grid.three .field {
  min-width: 0;
}
@media (max-width: 720px) {
  .form-grid.three {
    grid-template-columns: 1fr;
  }
}


/* Warmer summary stats — spaced, clean */
.warmer-actions {
  margin-top: 14px;
  margin-bottom: 4px;
}
.warmer-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 8px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel2) 88%, transparent);
}
.warmer-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 88px;
  padding: 6px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 70%, transparent);
}
.warmer-stat-label {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.warmer-stat strong {
  font-size: 0.9375rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}
.warmer-stat-ready strong {
  color: var(--green);
}
.warmer-live-block {
  margin-top: 20px;
  padding-top: 4px;
}
.warmer-live-block .camp-section-title {
  margin-bottom: 12px;
}
.warmer-status-grid {
  gap: 12px;
}





/* Send page — clean section separators */
#tab-send .panel > .camp-section:first-of-type,
#tab-send .panel > .field:first-of-type,
#tab-send .panel > .session-check-grid {
  border-top: none !important;
}
#tab-send .camp-section {
  border-top: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
  margin-top: 18px;
  padding-top: 16px;
}
#tab-send .camp-section:first-child,
#tab-send .panel > .camp-section.send-options {
  /* keep subtle only between blocks, not under empty top */
}
#tab-send .panel::before {
  display: none !important;
}
/* remove double line above schedule toggle */
#tab-send .camp-section:has(.schedule-toggle) {
  border-top: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
  margin-top: 14px;
  padding-top: 14px;
}
#tab-send .schedule-toggle {
  border: none !important;
  background: transparent !important;
  padding-inline: 0 !important;
  box-shadow: none !important;
}
#tab-campaigns .camp-section:first-child {
  border-top: none !important;
  margin-top: 0;
  padding-top: 0;
}


/* Send page visual cleanup — no stray top/bottom rules */
#tab-send .panel {
  overflow: hidden;
}
#tab-send .panel > *:first-child {
  border-top: none !important;
  margin-top: 0 !important;
  padding-top: 0 !important;
}
#tab-send .camp-section.send-options {
  border-top: 1px solid color-mix(in srgb, var(--line) 50%, transparent);
}
#tab-send .safe-send-panel {
  border-radius: 14px;
  margin-top: 12px;
}
#tab-send .camp-section:has(#sendScheduleEn),
#tab-send .camp-section:has(.schedule-toggle) {
  border-top: 1px solid color-mix(in srgb, var(--line) 50%, transparent);
  margin-top: 12px;
  padding-top: 12px;
}
#tab-send .schedule-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-top: 8px;
  background: var(--panel2);
}


/* Campaign form — clean schedule divider (same as send) */
#tab-campaigns .campaign-form-panel .camp-section:first-child {
  border-top: none !important;
  margin-top: 0 !important;
  padding-top: 0 !important;
}
#tab-campaigns .campaign-form-panel > *:first-child {
  border-top: none !important;
}
#tab-campaigns .camp-section:has(.schedule-toggle),
#tab-campaigns .camp-section:has(#campScheduleEn) {
  border-top: 1px solid color-mix(in srgb, var(--line) 50%, transparent);
  margin-top: 12px;
  padding-top: 12px;
}
#tab-campaigns .schedule-toggle {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding-inline: 0 !important;
}
#tab-campaigns .safe-send-panel {
  border-radius: 14px;
}
#tab-campaigns .camp-actions {
  border-top: 1px solid color-mix(in srgb, var(--line) 50%, transparent);
  margin-top: 14px;
  padding-top: 14px;
}

/* ============================================================
   Impeccable visual polish — WASender
   Quiet density, no decorative gradients, clear hierarchy
   ============================================================ */

:root, [data-theme="dark"] {
  --bg: #0a0e13;
  --bg2: #0f1520;
  --panel: #141b26;
  --panel2: #1a2332;
  --line: #263142;
  --text: #f1f5f9;
  --muted: #8b9bb0;
  --green: #22c55e;
  --green2: #16a34a;
  --red: #f04343;
  --amber: #f5a524;
  --radius: 12px;
  --radius-sm: 10px;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px rgba(0,0,0,.28);
  --focus: 0 0 0 2px color-mix(in srgb, var(--green) 28%, transparent);
  --sidebar-w: 248px;
}

[data-theme="light"] {
  --bg: #f0f3f8;
  --bg2: #ffffff;
  --panel: #ffffff;
  --panel2: #f4f6fa;
  --line: #d8e0ec;
  --text: #0f172a;
  --muted: #64748b;
  --green: #16a34a;
  --green2: #15803d;
  --red: #dc2626;
  --amber: #d97706;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 20px rgba(15,23,42,.05);
  --focus: 0 0 0 2px color-mix(in srgb, var(--green) 22%, transparent);
}

/* Kill decorative page glow (AI-slop tell) */
[data-theme="dark"] body {
  background: var(--bg) !important;
}

body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: 0.01em;
}

.app-shell {
  grid-template-columns: var(--sidebar-w) 1fr;
}

.sidebar {
  padding: 18px 12px 16px;
  gap: 16px;
  background: color-mix(in srgb, var(--bg2) 88%, #000);
  border-inline-end: 1px solid var(--line);
}

[data-theme="light"] .sidebar {
  background: var(--panel);
}

.side-nav { gap: 2px; }

.nav-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  transition: background .12s ease, color .12s ease;
}

.nav-item:hover {
  background: var(--panel2);
  color: var(--text);
}

.nav-item.active {
  background: color-mix(in srgb, var(--green) 12%, var(--panel2));
  color: var(--green);
  box-shadow: inset 3px 0 0 var(--green);
}

[dir="rtl"] .nav-item.active {
  box-shadow: inset -3px 0 0 var(--green);
}

.nav-ico {
  width: 20px;
  opacity: 0.9;
}

.main {
  padding: 28px 32px 56px;
  max-width: 1120px;
}

.view-head {
  margin-bottom: 20px;
  padding-bottom: 4px;
}

.view-head h1 {
  font-size: 1.5rem;
  font-weight: 750;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.view-desc {
  margin-top: 6px;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--muted);
  max-width: 520px;
}

/* Panels — flat, precise */
.panel, .connect-card, .toolbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
}

.panel, .connect-card {
  padding: 16px 18px;
  margin-bottom: 12px;
}

.toolbar {
  padding: 12px 14px;
  margin-bottom: 12px;
  gap: 10px;
  align-items: flex-end;
}

/* Buttons — solid primary, no loud gradient */
.btn {
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-weight: 650;
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
  transition: background .12s ease, border-color .12s ease, color .12s ease, filter .12s ease;
}

.btn-primary {
  background: var(--green) !important;
  color: #04140a !important;
  border: 1px solid color-mix(in srgb, var(--green2) 70%, #000);
}

.btn-primary:hover {
  filter: brightness(1.06);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.btn-ghost:hover {
  color: var(--text);
  background: var(--panel2);
  border-color: color-mix(in srgb, var(--line) 70%, var(--muted));
}

.btn-danger {
  background: color-mix(in srgb, var(--red) 12%, transparent);
  color: var(--red);
  border: 1px solid color-mix(in srgb, var(--red) 25%, transparent);
}

.btn-danger:hover {
  background: color-mix(in srgb, var(--red) 18%, transparent);
}

.btn-sm {
  padding: 7px 11px;
  font-size: 0.75rem;
  border-radius: 8px;
}

/* Inputs */
input, select, textarea {
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--bg2);
  transition: border-color .12s ease, box-shadow .12s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: color-mix(in srgb, var(--green) 50%, var(--line));
  box-shadow: var(--focus);
}

.field span {
  font-size: 0.6875rem;
  text-transform: none;
  letter-spacing: 0.02em;
  font-weight: 650;
}

/* Chips & status */
.chip, .status-pill {
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 6px 10px;
  border: 1px solid var(--line);
}

.status-on, .chip-on, .badge-on {
  background: color-mix(in srgb, var(--green) 14%, transparent);
  color: var(--green);
  border-color: color-mix(in srgb, var(--green) 28%, var(--line));
}

.status-off, .chip-off, .badge-off {
  background: color-mix(in srgb, var(--red) 12%, transparent);
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 22%, var(--line));
}

.status-dot.on { box-shadow: none; }

/* Account cards — clean, no fake gradient skin */
.account-card {
  background: var(--panel) !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius) !important;
  padding: 14px 14px 12px !important;
  box-shadow: none !important;
  transition: border-color .12s ease, background .12s ease;
}

.account-card::before {
  display: none !important;
}

.account-card:hover {
  border-color: color-mix(in srgb, var(--green) 30%, var(--line)) !important;
  background: color-mix(in srgb, var(--panel) 92%, var(--panel2)) !important;
}

.account-card.connected {
  border-color: color-mix(in srgb, var(--green) 35%, var(--line)) !important;
}

.account-card .title {
  font-weight: 700;
  font-size: 0.9375rem;
}

.account-card .meta,
.account-card .phone-line {
  color: var(--muted);
  font-size: 0.75rem;
}

.account-card .actions {
  gap: 8px;
  margin-top: 10px;
}

/* Mailbox — tighter, clearer hierarchy */
.mailbox {
  gap: 12px;
  min-height: 580px;
  height: min(74vh, 720px);
}

.mailbox-list,
.mailbox-thread-wrap {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: none;
}

.chat-item {
  padding: 10px 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  transition: background .1s ease;
}

.chat-item:hover {
  background: var(--panel2);
}

.chat-item.active {
  background: color-mix(in srgb, var(--green) 10%, var(--panel2));
  border-inline-start: 3px solid var(--green);
}

[dir="ltr"] .chat-item.active {
  border-inline-start: 3px solid var(--green);
}

.chat-title {
  font-weight: 700;
  font-size: 0.875rem;
}

.chat-preview, .chat-meta {
  color: var(--muted);
  font-size: 0.75rem;
}

/* Composer bar */
.composer, .mailbox-composer {
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  gap: 8px;
  background: color-mix(in srgb, var(--panel) 90%, var(--bg2));
}

/* QR */
.qr-panel {
  border: 1px solid var(--line);
  border-style: solid;
  background: var(--bg2);
  border-radius: var(--radius);
}

#qrImage {
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
}

/* Tables / logs / previews */
.log, .contacts-preview, pre, .extract-result {
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
}

/* Warmer stats */
.warmer-stats-row {
  background: transparent !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius) !important;
}

.warmer-stat {
  background: var(--panel) !important;
}

/* Sidebar footer */
.side-foot {
  padding-top: 10px;
  border-top: 1px solid var(--line);
  gap: 8px;
}

.side-foot .status-pill {
  width: 100%;
  justify-content: center;
}

/* Brand block breathing room */
.sidebar .brand {
  padding: 4px 6px 8px;
  margin-bottom: 4px;
}

.sidebar .brand-sub {
  font-size: 0.6875rem;
  color: var(--muted);
  opacity: 0.9;
}

/* Scrollbars — quiet */
.mailbox-list-scroll,
.mailbox-thread,
.log {
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

/* Login page alignment if classes shared */
.login-wrap, .login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: none;
}

/* Responsive */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    border-inline-end: 0;
    border-bottom: 1px solid var(--line);
  }
  .main { padding: 18px 16px 40px; }
}




/* ============================================================
   Scroll: real mouse-wheel, no visible bars (Send-page feel)
   ============================================================ */

/* Main column — normal document scroll, bar hidden */
.main {
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;          /* Firefox */
  -ms-overflow-style: none;
}
.main::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
}

/* Mailbox layout — fixed panel under toolbar */
#tab-mailbox .mailbox {
  display: grid !important;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr) !important;
  gap: 12px !important;
  height: calc(100vh - 200px) !important;
  max-height: calc(100vh - 180px) !important;
  min-height: 440px !important;
  align-items: stretch !important;
  overflow: visible !important;
}

/* Chat LIST box — real scroll, scrollbar hidden */
#mailboxChats,
#mailboxChats.mailbox-list,
#tab-mailbox aside.mailbox-list {
  height: 100% !important;
  max-height: 100% !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: auto;
  scrollbar-width: none;          /* hide bar, keep wheel */
  -ms-overflow-style: none;
}
#mailboxChats::-webkit-scrollbar,
#mailboxChats.mailbox-list::-webkit-scrollbar,
#tab-mailbox aside.mailbox-list::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
  background: transparent !important;
}

/* Thread wrap */
#tab-mailbox .mailbox-thread-wrap {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  max-height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

#tab-mailbox .thread-header {
  flex: 0 0 auto !important;
}

/* Messages — real scroll, bar hidden */
#mailboxMessages,
#mailboxMessages.mailbox-thread,
#tab-mailbox .mailbox-thread {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: auto !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
#mailboxMessages::-webkit-scrollbar,
#mailboxMessages.mailbox-thread::-webkit-scrollbar,
#tab-mailbox .mailbox-thread::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
}

#tab-mailbox .reply-bar,
#replyBox.reply-bar {
  flex: 0 0 auto !important;
}

/* Kill any leftover page lock from older patches */
body:has(#tab-mailbox.view.active) {
  overflow: auto !important;
}
body:has(#tab-mailbox.view.active) .main {
  overflow-y: auto !important;
  height: auto !important;
  max-height: none !important;
}
#tab-mailbox.view.active {
  overflow: visible !important;
  height: auto !important;
  max-height: none !important;
  display: block !important;
}

@media (max-width: 900px) {
  #tab-mailbox .mailbox {
    grid-template-columns: 1fr !important;
    height: auto !important;
    max-height: none !important;
  }
  #mailboxChats,
  #mailboxChats.mailbox-list {
    height: 300px !important;
    max-height: 300px !important;
  }
  #tab-mailbox .mailbox-thread-wrap {
    height: min(60vh, 480px) !important;
  }
}

/* —— Campaign phone preview + warmer smart limits —— */
.camp-msg-preview-row {
  display: grid;
  grid-template-columns: 1fr minmax(180px, 220px);
  gap: 20px;
  align-items: start;
}
.camp-phone-preview { display: flex; justify-content: center; }
.phone-frame {
  width: 200px;
  border-radius: 28px;
  border: 3px solid #1f2937;
  background: #0b141a;
  padding: 10px 8px 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
}
.phone-notch {
  width: 64px;
  height: 8px;
  border-radius: 8px;
  background: #111;
  margin: 0 auto 10px;
}
.phone-screen {
  background: #0b141a;
  min-height: 220px;
  border-radius: 12px;
  padding: 8px;
}
.phone-wa-header {
  color: #8696a0;
  font-size: 11px;
  text-align: center;
  margin-bottom: 10px;
}
.phone-bubble {
  background: #005c4b;
  color: #e9edef;
  border-radius: 8px 8px 2px 8px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 180px;
  overflow: auto;
}
.warmer-smart-panel {
  margin: 16px 0;
}
.warmer-stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 16px;
  margin-top: 18px;
  padding-top: 8px;
}
.warmer-stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--panel-2, rgba(255,255,255,.04));
}
.warmer-stat-label {
  font-size: 12px;
  opacity: .7;
}
.warmer-live-block {
  margin-top: 20px;
}
.warmer-card-stats {
  font-size: 12px;
  opacity: .85;
  margin-top: 6px;
}
@media (max-width: 800px) {
  .camp-msg-preview-row {
    grid-template-columns: 1fr;
  }
  .phone-frame { width: 160px; }
}

/* —— Dashboard KPI —— */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kpi-card {
  background: var(--panel, rgba(255,255,255,.04));
  border: 1px solid var(--border, rgba(255,255,255,.08));
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kpi-label { font-size: 12px; opacity: .7; font-weight: 500; }
.kpi-value { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.kpi-sub { font-size: 12px; opacity: .55; }
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.dash-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.dash-recent {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}
.dash-recent-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,.03);
  font-size: 13px;
}
.dash-recent-item .ts { opacity: .5; font-size: 11px; white-space: nowrap; }

/* —— Campaign wizard —— */
.wizard-steps {
  display: flex;
  gap: 8px;
  margin: 8px 0 18px;
  flex-wrap: wrap;
}
.wizard-step {
  flex: 1;
  min-width: 120px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border, rgba(255,255,255,.1));
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  opacity: .65;
  transition: .15s ease;
}
.wizard-step.is-active {
  opacity: 1;
  border-color: var(--accent, #22c55e);
  background: rgba(34, 197, 94, .08);
}
.wizard-step.is-done { opacity: .9; }
.wizard-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  background: rgba(255,255,255,.08);
}
.wizard-step.is-active .wizard-num {
  background: var(--accent, #22c55e);
  color: #04140a;
}
.camp-section[data-camp-step],
.schedule-box[data-camp-step] {
  /* controlled by JS */
}

/* —— Flows list —— */
.flow-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border, rgba(255,255,255,.08));
  background: var(--panel, rgba(255,255,255,.03));
  margin-bottom: 10px;
}
.flow-card-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.flow-card-title { font-weight: 600; }
.flow-card-meta { font-size: 12px; opacity: .65; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow-card-actions { display: flex; gap: 8px; flex-shrink: 0; }

@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}


/* First section inside a panel — no hairline above title */
.panel > .camp-section:first-child,
.panel > .camp-section:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}
#tab-warmer .panel > .camp-section:first-child {
  border-top: none !important;
  padding-top: 0 !important;
  margin-top: 0 !important;
}

/* ===== Unified message tools (emoji / attach / format) ===== */
.msg-tools-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 6px 0 12px;
  position: relative;
}
.msg-tool-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
  flex: 0 0 auto;
}
.msg-tool-btn:hover {
  border-color: color-mix(in srgb, var(--green) 40%, var(--line));
  background: color-mix(in srgb, var(--green) 12%, transparent);
  color: var(--green);
}
.msg-tool-btn svg {
  width: 18px;
  height: 18px;
  display: block;
  pointer-events: none;
}
.msg-tool-btn.fmt-btn svg {
  width: 15px;
  height: 15px;
}
.msg-attach {
  position: relative;
  overflow: hidden;
}
.msg-attach input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  z-index: 2;
}
.msg-tools-sep {
  width: 1px;
  height: 22px;
  background: var(--line);
  margin: 0 4px;
  flex: 0 0 auto;
  opacity: .8;
}
.fmt-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.msg-file-name {
  font-size: 0.75rem;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-inline-start: 4px;
}

/* Compact modern emoji picker */
.emoji-popover-portal,
.emoji-popover {
  position: fixed !important;
  z-index: 99999 !important;
  width: 280px !important;
  max-width: min(280px, calc(100vw - 16px)) !important;
  max-height: 220px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  display: grid !important;
  grid-template-columns: repeat(8, 1fr) !important;
  gap: 2px !important;
  padding: 8px !important;
  border-radius: 14px !important;
  border: 1px solid var(--line) !important;
  background: color-mix(in srgb, var(--panel) 96%, #000) !important;
  box-shadow: 0 12px 40px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.04) !important;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--muted) 50%, transparent) transparent;
}
.emoji-popover-portal::-webkit-scrollbar,
.emoji-popover::-webkit-scrollbar { width: 6px; }
.emoji-popover-portal::-webkit-scrollbar-thumb,
.emoji-popover::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted) 45%, transparent);
  border-radius: 8px;
}
.emoji-popover-portal button,
.emoji-popover button {
  width: 100% !important;
  aspect-ratio: 1 !important;
  height: auto !important;
  min-height: 0 !important;
  border: none !important;
  background: transparent !important;
  border-radius: 8px !important;
  font-size: 1.15rem !important;
  line-height: 1 !important;
  cursor: pointer !important;
  padding: 4px !important;
  display: grid !important;
  place-items: center !important;
}
.emoji-popover-portal button:hover,
.emoji-popover button:hover {
  background: color-mix(in srgb, var(--green) 14%, transparent) !important;
}

/* Mailbox reply compose */
.reply-compose {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
  width: 100%;
}
.reply-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.reply-input-row #replyText {
  flex: 1;
  min-width: 0;
}
.reply-bar {
  flex-wrap: wrap;
}
.reply-bar .reply-compose {
  flex: 1 1 100%;
}
.reply-fmt-row {
  margin: 0 0 2px;
}

[data-theme="light"] .msg-tool-btn {
  background: #f3f5f9;
  color: #1a2332;
}
[data-theme="light"] .msg-tool-btn:hover {
  background: color-mix(in srgb, var(--green) 12%, #fff);
  color: var(--green);
}
[data-theme="light"] .emoji-popover-portal,
[data-theme="light"] .emoji-popover {
  background: #fff !important;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .12) !important;
}

/* Force uniform tool buttons everywhere (mailbox / send / campaign) */
.msg-tools-bar .msg-tool-btn,
.msg-tools-bar label.msg-tool-btn,
.msg-tools-bar button.msg-tool-btn,
.reply-fmt-row .msg-tool-btn,
.reply-compose .msg-tool-btn {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  max-width: 36px !important;
  max-height: 36px !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 10px !important;
  border: 1px solid var(--line) !important;
  background: transparent !important;
  color: var(--text) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  flex: 0 0 36px !important;
  line-height: 0 !important;
  font-size: 0 !important;
}
.msg-tools-bar .msg-tool-btn svg,
.reply-compose .msg-tool-btn svg {
  width: 16px !important;
  height: 16px !important;
  display: block !important;
  flex-shrink: 0 !important;
}
.msg-tools-bar .msg-tool-btn:hover,
.reply-compose .msg-tool-btn:hover {
  border-color: color-mix(in srgb, var(--green) 40%, var(--line)) !important;
  background: color-mix(in srgb, var(--green) 12%, transparent) !important;
  color: var(--green) !important;
}

/* Campaign numbers file row */
.numbers-file-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.numbers-file-label {
  font-size: 0.8125rem;
  font-weight: 600;
  opacity: 0.85;
}
.numbers-upload-btn {
  position: relative;
  overflow: hidden;
}

/* Send page — single clean upload zone (numbers list) */
.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 22px 16px;
  border-radius: 14px;
  border: 1.5px dashed color-mix(in srgb, var(--line) 90%, var(--green) 10%);
  background: color-mix(in srgb, var(--panel2) 70%, transparent);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  text-align: center;
}
.upload-zone:hover,
.upload-zone.is-drag {
  border-color: var(--green);
  background: color-mix(in srgb, var(--green) 8%, var(--panel2));
}
.upload-zone-ico {
  color: var(--muted);
  margin-bottom: 2px;
}
.upload-zone:hover .upload-zone-ico { color: var(--green); }
.upload-zone-title {
  font-size: 0.875rem;
  font-weight: 700;
}
.upload-zone-sub {
  font-size: 0.75rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 8px;
}
#inner-file .row-actions {
  justify-content: flex-start;
}


/* ===== Emoji picker — final layout (overrides all previous) ===== */
.emoji-popover-portal,
.emoji-popover {
  position: fixed !important;
  z-index: 100000 !important;
  box-sizing: border-box !important;
  width: 300px !important;
  max-width: min(300px, calc(100vw - 20px)) !important;
  height: auto !important;
  max-height: 260px !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  padding: 10px !important;
  margin: 0 !important;
  border-radius: 14px !important;
  border: 1px solid var(--line) !important;
  background: #121820 !important;
  box-shadow: 0 16px 48px rgba(0,0,0,.55) !important;
  display: block !important;
  direction: ltr !important;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.25) transparent;
}
.emoji-popover-portal[hidden],
.emoji-popover[hidden] {
  display: none !important;
}
.emoji-popover-portal .emoji-grid,
.emoji-popover .emoji-grid {
  display: grid !important;
  grid-template-columns: repeat(8, 32px) !important;
  grid-auto-rows: 32px !important;
  gap: 4px !important;
  justify-content: center !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}
.emoji-popover-portal .emoji-grid button,
.emoji-popover .emoji-grid button,
.emoji-popover-portal button,
.emoji-popover button {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  min-height: 32px !important;
  max-width: 32px !important;
  max-height: 32px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 8px !important;
  background: transparent !important;
  font-size: 20px !important;
  line-height: 32px !important;
  text-align: center !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  aspect-ratio: auto !important;
  flex: none !important;
  float: none !important;
  position: static !important;
}
.emoji-popover-portal .emoji-grid button:hover,
.emoji-popover .emoji-grid button:hover,
.emoji-popover-portal button:hover,
.emoji-popover button:hover {
  background: rgba(34, 197, 94, 0.18) !important;
}
[data-theme="light"] .emoji-popover-portal,
[data-theme="light"] .emoji-popover {
  background: #ffffff !important;
  box-shadow: 0 12px 36px rgba(15,23,42,.15) !important;
}

.send-start-row {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-start;
}
.btn-lg {
  min-height: 46px;
  padding: 0 28px;
  font-size: 0.9375rem;
  font-weight: 700;
}


/* Campaign wizard: honor hidden even if section has display rules */
#campaignForm [data-camp-step][hidden],
#campaignForm .camp-section[hidden],
#campaignForm .schedule-box[hidden] {
  display: none !important;
}

/* Mailbox / tools — force identical icon button size (emoji included) */
.msg-tools-bar .msg-tool-btn,
.msg-tools-bar #btnReplyEmoji,
.msg-tools-bar #btnCampEmoji,
.msg-tools-bar #btnSendEmoji,
.reply-compose .msg-tool-btn,
.reply-fmt-row .msg-tool-btn,
#btnReplyEmoji.msg-tool-btn {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  max-width: 36px !important;
  max-height: 36px !important;
  padding: 0 !important;
  font-size: 0 !important;
  line-height: 0 !important;
  flex: 0 0 36px !important;
}
.msg-tools-bar .msg-tool-btn svg,
.reply-compose .msg-tool-btn svg,
#btnReplyEmoji svg {
  width: 16px !important;
  height: 16px !important;
}


/* ===== Rich text editors (live bold/italic/strike/mono) ===== */
.rich-editor {
  width: 100%;
  min-height: 44px;
  max-height: 280px;
  overflow-y: auto;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  font: inherit;
  line-height: 1.5;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
  box-sizing: border-box;
  direction: inherit;
  text-align: start;
}
.rich-editor:focus {
  border-color: color-mix(in srgb, var(--green) 55%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent);
}
.rich-editor:empty:before {
  content: attr(data-placeholder);
  color: var(--muted);
  opacity: 0.75;
  pointer-events: none;
}
.rich-editor b, .rich-editor strong { font-weight: 700; }
.rich-editor i, .rich-editor em { font-style: italic; }
.rich-editor s, .rich-editor strike, .rich-editor del { text-decoration: line-through; opacity: 0.9; }
.rich-editor code, .rich-editor pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: color-mix(in srgb, var(--panel) 70%, #000);
  padding: 0 4px;
  border-radius: 4px;
}

/* Send page — taller compose */
.rich-editor.send-rich {
  min-height: 140px;
  max-height: 320px;
}
.rich-editor.camp-rich {
  min-height: 120px;
  max-height: 280px;
}
.rich-editor.reply-rich {
  min-height: 42px;
  max-height: 120px;
  padding: 10px 12px;
  border-radius: 22px;
  flex: 1;
}
.reply-compose .rich-editor.reply-rich {
  border-radius: 20px;
}
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  border: 0;
}

/* ===== WhatsApp phone mockup (campaign + send) ===== */
.camp-msg-preview-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 300px) !important;
  gap: 24px !important;
  align-items: start !important;
}
.send-compose-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 300px);
  gap: 24px;
  align-items: start;
  margin-bottom: 8px;
}
.send-compose-main { min-width: 0; }

.wa-phone-stage {
  display: flex;
  justify-content: center;
  position: sticky;
  top: 16px;
}
.wa-phone {
  width: 280px;
  max-width: 100%;
  filter: drop-shadow(0 18px 40px rgba(0,0,0,.45));
}
.wa-phone-bezel {
  background: linear-gradient(160deg, #2a2f36 0%, #111418 40%, #0a0c0f 100%);
  border-radius: 36px;
  padding: 12px 10px 14px;
  border: 1px solid rgba(255,255,255,.08);
  position: relative;
}
.wa-phone-speaker {
  width: 72px;
  height: 7px;
  border-radius: 6px;
  background: #0a0a0a;
  margin: 2px auto 10px;
  box-shadow: inset 0 1px 2px rgba(255,255,255,.08);
}
.wa-phone-home {
  width: 96px;
  height: 4px;
  border-radius: 4px;
  background: rgba(255,255,255,.22);
  margin: 10px auto 0;
}
.wa-phone-screen {
  background: #0b141a;
  border-radius: 22px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 480px;
  max-height: min(480px, 62vh);
  border: 1px solid rgba(0,0,0,.5);
}
.wa-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px 2px;
  color: #e9edef;
  font-size: 11px;
  font-weight: 600;
  background: #1f2c34;
}
.wa-status-icons {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  opacity: .95;
}
.wa-chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #1f2c34;
  border-bottom: 1px solid rgba(0,0,0,.25);
}
.wa-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(145deg, #00a884, #025c4c);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.wa-chat-meta { min-width: 0; }
.wa-chat-name {
  color: #e9edef;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wa-chat-sub {
  color: #8696a0;
  font-size: 11px;
}
.wa-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px 12px;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(0,168,132,.06), transparent 50%),
    #0b141a;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wa-day-chip {
  align-self: center;
  background: #182229;
  color: #8696a0;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 8px;
  margin-bottom: 4px;
}
.wa-bubble-out {
  align-self: flex-end;
  max-width: 88%;
  background: #005c4b;
  color: #e9edef;
  border-radius: 10px 10px 2px 10px;
  padding: 6px 8px 4px;
  box-shadow: 0 1px 0.5px rgba(0,0,0,.13);
  position: relative;
}
.wa-bubble-text {
  font-size: 13.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 2px 4px 0;
}
.wa-bubble-text .wa-placeholder {
  color: rgba(233,237,239,.45);
  font-style: italic;
}
.wa-bubble-text b, .wa-bubble-text strong { font-weight: 700; }
.wa-bubble-text i, .wa-bubble-text em { font-style: italic; }
.wa-bubble-text s, .wa-bubble-text strike { text-decoration: line-through; opacity: .9; }
.wa-bubble-text code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: rgba(0,0,0,.2);
  padding: 0 3px;
  border-radius: 3px;
}
.wa-bubble-media {
  margin: 0 0 6px;
  border-radius: 8px;
  overflow: hidden;
  background: #0b141a;
  max-height: 220px;
}
.wa-bubble-media img,
.wa-bubble-media video {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  background: #000;
}
.wa-bubble-media[hidden] { display: none !important; }
.wa-bubble-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  padding: 0 2px 1px;
}
.wa-bubble-time {
  font-size: 10.5px;
  color: rgba(233,237,239,.7);
}
.wa-ticks { display: inline-flex; line-height: 0; }
.wa-compose-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 8px;
  background: #1f2c34;
}
.wa-compose-input {
  flex: 1;
  background: #2a3942;
  color: #8696a0;
  border-radius: 20px;
  padding: 8px 12px;
  font-size: 12px;
}
.wa-compose-mic {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #00a884;
  flex-shrink: 0;
  position: relative;
}
.wa-compose-mic::after {
  content: '';
  position: absolute;
  inset: 9px 12px 9px 12px;
  border: 2px solid #fff;
  border-radius: 8px 8px 10px 10px;
  border-bottom-width: 3px;
}

@media (max-width: 960px) {
  .camp-msg-preview-row,
  .send-compose-split {
    grid-template-columns: 1fr !important;
  }
  .wa-phone-stage { position: static; }
  .wa-phone { width: 260px; }
  .wa-phone-screen { height: 420px; }
}

/* Reply rich editor — vertically centered text */
.reply-compose {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}
.reply-compose .rich-editor.reply-rich {
  display: flex !important;
  align-items: center !important;
  min-height: 44px !important;
  max-height: 120px !important;
  padding: 10px 14px !important;
  line-height: 1.35 !important;
  border-radius: 22px !important;
  overflow-y: auto !important;
}
.reply-compose .rich-editor.reply-rich:empty:before {
  line-height: 1.35;
  margin: 0;
}
.reply-bar {
  align-items: center;
}
.reply-bar .btn {
  align-self: center;
}

/* Force visible bold/italic in all rich editors */
.rich-editor b, .rich-editor strong,
.wa-bubble-text b, .wa-bubble-text strong {
  font-weight: 700 !important;
}
.rich-editor i, .rich-editor em,
.wa-bubble-text i, .wa-bubble-text em {
  font-style: italic !important;
}
.rich-editor s, .rich-editor strike, .rich-editor del,
.wa-bubble-text s, .wa-bubble-text strike {
  text-decoration: line-through !important;
}

/* Video thumb (WA style) */
.wa-video-thumb {
  position: relative;
  width: 100%;
  min-height: 140px;
  background: #0a1014;
  border-radius: 8px;
  overflow: hidden;
}
.wa-video-thumb img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  background: #0a1014;
}
.wa-video-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.wa-video-play::before {
  content: '';
  position: absolute;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  border: 1.5px solid rgba(255,255,255,.85);
}
.wa-video-play svg {
  position: relative;
  z-index: 1;
  margin-left: 3px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.4));
}

/* ===== iPhone-style frame ===== */
.wa-phone {
  width: 290px !important;
  max-width: 100%;
}
.wa-phone-bezel {
  background: linear-gradient(165deg, #3a3a3c 0%, #1c1c1e 28%, #0c0c0e 100%) !important;
  border-radius: 44px !important;
  padding: 11px 9px 12px !important;
  border: 2px solid #2c2c2e !important;
  box-shadow:
    0 0 0 1px rgba(255,255,255,.06) inset,
    0 22px 50px rgba(0,0,0,.5) !important;
  position: relative;
}
.wa-phone-bezel::before {
  /* side buttons hint */
  content: '';
  position: absolute;
  left: -3px;
  top: 96px;
  width: 3px;
  height: 28px;
  border-radius: 2px 0 0 2px;
  background: #2c2c2e;
  box-shadow: 0 42px 0 #2c2c2e, 0 78px 0 #2c2c2e;
}
.wa-phone-bezel::after {
  content: '';
  position: absolute;
  right: -3px;
  top: 120px;
  width: 3px;
  height: 52px;
  border-radius: 0 2px 2px 0;
  background: #2c2c2e;
}
.wa-phone-speaker {
  /* Dynamic Island */
  width: 96px !important;
  height: 26px !important;
  border-radius: 16px !important;
  background: #000 !important;
  margin: 4px auto 8px !important;
  position: relative;
  box-shadow: none !important;
}
.wa-phone-speaker::after {
  content: '';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #0a1a12;
  box-shadow: inset 0 0 0 1.5px #1a3a28;
}
.wa-phone-screen {
  border-radius: 34px !important;
  height: 520px !important;
  max-height: min(520px, 68vh) !important;
  border: none !important;
}
.wa-phone-home {
  width: 108px !important;
  height: 5px !important;
  border-radius: 4px !important;
  background: rgba(255,255,255,.28) !important;
  margin: 8px auto 2px !important;
}
.wa-chat-body {
  background:
    url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h60v60H0z' fill='%230b141a'/%3E%3Cpath d='M8 12c2 0 3 1 3 3s-1 3-3 3-3-1-3-3 1-3 3-3zm22 18c1.5 0 2.5.8 2.5 2s-1 2-2.5 2-2.5-.8-2.5-2 1-2 2.5-2zm-14 14c1 0 1.5.5 1.5 1.2S17 46.5 16 46.5 14.5 46 14.5 45.3 15 44.5 16 44.5z' fill='%23121c22' fill-opacity='.55'/%3E%3C/svg%3E") repeat,
    #0b141a !important;
}
.wa-bubble-out {
  background: #005c4b !important;
  border-radius: 12px 12px 4px 12px !important;
  padding: 6px 8px 5px !important;
}
.wa-status-bar {
  padding-top: 10px !important;
  background: #1f2c34 !important;
}

/* ===== Reply input: stable caret + placeholder ===== */
.reply-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.reply-input-row .rich-editor.reply-rich {
  flex: 1;
  display: block !important;
  align-items: unset !important;
  min-height: 44px !important;
  max-height: 120px !important;
  padding: 11px 16px !important;
  line-height: 22px !important;
  font-size: 14px !important;
  border-radius: 22px !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  white-space: pre-wrap !important;
  word-break: break-word !important;
  box-sizing: border-box !important;
}
.reply-input-row .rich-editor.reply-rich:empty:before,
.reply-input-row .rich-editor.reply-rich.is-empty:before {
  content: attr(data-placeholder);
  color: var(--muted);
  opacity: 0.7;
  pointer-events: none;
  line-height: 22px;
  display: block;
}
.reply-compose {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 8px !important;
}
.reply-compose .msg-tools-bar {
  order: 0;
}
.reply-compose .reply-input-row {
  order: 1;
}

/* Bubble newlines must show */
.wa-bubble-text {
  white-space: pre-wrap !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
  line-height: 1.45 !important;
}
.wa-bubble-text br {
  display: block !important;
  content: '' !important;
  margin-top: 0 !important;
  line-height: 1.45 !important;
}

/* ===== iPhone frame — modern, theme-aware ===== */
.wa-phone {
  width: 300px !important;
  max-width: 100%;
}
.wa-phone-bezel {
  background: #1a1a1c !important;
  border-radius: 48px !important;
  padding: 12px !important;
  border: 3px solid #2e2e32 !important;
  box-shadow:
    0 0 0 1px rgba(255,255,255,.04),
    0 0 0 6px #0d0d0f,
    0 25px 60px rgba(0,0,0,.55) !important;
  position: relative;
}
.wa-phone-bezel::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 110px;
  width: 3px;
  height: 32px;
  border-radius: 2px 0 0 2px;
  background: #3a3a3e;
  box-shadow: 0 48px 0 #3a3a3e, 0 88px 0 #3a3a3e;
}
.wa-phone-bezel::after {
  content: '';
  position: absolute;
  right: -4px;
  top: 140px;
  width: 3px;
  height: 64px;
  border-radius: 0 2px 2px 0;
  background: #3a3a3e;
}
.wa-phone-speaker {
  width: 110px !important;
  height: 28px !important;
  border-radius: 18px !important;
  background: #000 !important;
  margin: 6px auto 10px !important;
  position: relative;
  z-index: 2;
}
.wa-phone-speaker::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #1a4a3a, #051510 70%);
  box-shadow: inset 0 0 0 1px rgba(0,200,120,.25);
}
.wa-phone-screen {
  border-radius: 38px !important;
  height: 560px !important;
  max-height: min(560px, 70vh) !important;
  overflow: hidden !important;
  border: none !important;
  background: #000 !important;
}
.wa-phone-home {
  width: 120px !important;
  height: 5px !important;
  border-radius: 4px !important;
  background: rgba(255,255,255,.22) !important;
  margin: 10px auto 4px !important;
}

/* Light theme phone */
[data-theme="light"] .wa-phone-bezel {
  background: #e8e8ed !important;
  border-color: #c5c5cc !important;
  box-shadow:
    0 0 0 1px rgba(0,0,0,.04),
    0 0 0 6px #f2f2f7,
    0 25px 50px rgba(0,0,0,.18) !important;
}
[data-theme="light"] .wa-phone-bezel::before,
[data-theme="light"] .wa-phone-bezel::after {
  background: #b0b0b8;
}
[data-theme="light"] .wa-phone-speaker {
  background: #1c1c1e !important;
}
[data-theme="light"] .wa-phone-home {
  background: rgba(0,0,0,.2) !important;
}
[data-theme="light"] .wa-status-bar,
[data-theme="light"] .wa-chat-header,
[data-theme="light"] .wa-compose-bar {
  background: #f0f2f5 !important;
  color: #111b21;
}
[data-theme="light"] .wa-status-bar { color: #111b21; }
[data-theme="light"] .wa-chat-name { color: #111b21 !important; }
[data-theme="light"] .wa-chat-sub { color: #667781 !important; }
[data-theme="light"] .wa-chat-body {
  background:
    url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h60v60H0z' fill='%23efeae2'/%3E%3Cpath d='M10 14c1.5 0 2.5 1 2.5 2.5S11.5 19 10 19s-2.5-1-2.5-2.5S8.5 14 10 14zm24 20c1 0 2 .7 2 1.8s-1 1.8-2 1.8-2-.7-2-1.8 1-1.8 2-1.8z' fill='%23d9d1c4' fill-opacity='.7'/%3E%3C/svg%3E") repeat,
    #efeae2 !important;
}
[data-theme="light"] .wa-day-chip {
  background: #ffffff !important;
  color: #54656f !important;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
[data-theme="light"] .wa-bubble-out {
  background: #d9fdd3 !important;
  color: #111b21 !important;
}
[data-theme="light"] .wa-bubble-time { color: rgba(17,27,33,.55) !important; }
[data-theme="light"] .wa-compose-input {
  background: #fff !important;
  color: #667781 !important;
}
[data-theme="light"] .wa-placeholder {
  color: rgba(17,27,33,.4) !important;
}
[data-theme="light"] .wa-ticks svg path { fill: #53bdeb; }

@media (max-width: 960px) {
  .wa-phone { width: 270px !important; }
  .wa-phone-screen { height: 500px !important; }
}

/* ===== Phone: screen fills the bezel (edge-to-edge) ===== */
.wa-phone {
  width: 312px !important;
  max-width: 100%;
}
.wa-phone-bezel {
  padding: 10px !important;
  border-radius: 46px !important;
}
.wa-phone-speaker {
  position: absolute !important;
  top: 18px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  margin: 0 !important;
  z-index: 5 !important;
  width: 100px !important;
  height: 26px !important;
  border-radius: 14px !important;
}
.wa-phone-screen {
  height: 640px !important;
  max-height: min(640px, 78vh) !important;
  border-radius: 38px !important;
  width: 100% !important;
  margin: 0 !important;
}
.wa-phone-home {
  position: absolute !important;
  bottom: 14px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  margin: 0 !important;
  z-index: 5 !important;
  width: 110px !important;
  height: 4px !important;
}
.wa-status-bar {
  padding-top: 36px !important; /* room for Dynamic Island overlay */
}
.wa-compose-bar {
  padding-bottom: 18px !important; /* room for home indicator */
}

/* Bubble: hard guarantee for line breaks */
.wa-bubble-out {
  max-width: 92% !important;
  width: max-content !important;
  min-width: 120px;
  box-sizing: border-box;
}
.wa-bubble-text {
  display: block !important;
  white-space: pre-wrap !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
}
.wa-bubble-text br {
  display: block !important;
  content: "" !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.45 !important;
}

/* Media area — full bubble width from frame 0 (no jump) */
.wa-bubble-media {
  display: block !important;
  width: 100% !important;
  min-width: 200px !important;
  margin: 0 0 6px 0 !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  background: #0a1014;
}
.wa-bubble-media[hidden] {
  display: none !important;
}
.wa-bubble-media.has-media {
  display: block !important;
  width: 220px !important;
  max-width: 100% !important;
}
.wa-bubble-out:has(.wa-bubble-media.has-media) {
  width: 240px !important;
  max-width: 92% !important;
}
.wa-media-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 260px;
  object-fit: cover;
  vertical-align: top;
}

/* Video thumb — fixed aspect, poster + play always visible */
.wa-video-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  min-height: 148px;
  background: #0a1014;
  border-radius: 8px;
  overflow: hidden;
}
.wa-video-poster {
  position: absolute;
  inset: 0;
  background: #111c22 center/cover no-repeat;
}
.wa-video-thumb.is-loading .wa-video-poster {
  background: linear-gradient(135deg, #0d1a1f 0%, #12262c 50%, #0d1a1f 100%);
}
.wa-video-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  pointer-events: none;
}
.wa-video-play-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(0,0,0,.42);
  border: 2px solid rgba(255,255,255,.9);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.35);
}
.wa-video-play-btn svg {
  margin-left: 3px;
}

@media (max-width: 960px) {
  .wa-phone { width: 280px !important; }
  .wa-phone-screen { height: 560px !important; }
}

/* Bubble text lines — force visual line breaks */
.wa-bubble-text {
  display: block !important;
  white-space: pre-wrap !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
  line-height: 1.45 !important;
}
.wa-bubble-text br {
  display: block !important;
  content: "" !important;
  height: 0 !important;
  line-height: 1.45 !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Media isolated from text reflow flicker */
.wa-bubble-media.has-media {
  flex-shrink: 0;
  contain: layout paint;
}
.wa-bubble-out {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* Reply empty: always first-line placeholder */
.rich-editor.reply-rich.is-empty,
.rich-editor.reply-rich:empty {
  min-height: 44px !important;
}
.rich-editor.reply-rich.is-empty:before,
.rich-editor.reply-rich:empty:before {
  content: attr(data-placeholder) !important;
  color: var(--muted) !important;
  opacity: 0.7 !important;
  pointer-events: none !important;
  display: inline !important;
  line-height: 22px !important;
}

/* WA compose send button (preview) — paper-plane style */
.wa-compose-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #00a884;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.wa-compose-send svg {
  display: block;
  /* slight nudge so plane looks centered */
  margin-left: 2px;
  transform: rotate(-15deg);
}
[data-theme="light"] .wa-compose-send {
  background: #00a884;
  color: #fff;
}
/* hide old mic if any leftover */
.wa-compose-mic { display: none !important; }

/* Format buttons — active / pressed state */
.fmt-btn.is-active,
.msg-tools-bar .fmt-btn.is-active,
.reply-compose .fmt-btn.is-active {
  background: color-mix(in srgb, var(--green) 22%, var(--panel2)) !important;
  border-color: color-mix(in srgb, var(--green) 55%, var(--line)) !important;
  color: var(--green) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--green) 25%, transparent) !important;
}
.fmt-btn.is-active svg {
  stroke: var(--green) !important;
}
[data-theme="light"] .fmt-btn.is-active {
  background: color-mix(in srgb, var(--green) 14%, #fff) !important;
  color: var(--green) !important;
  border-color: color-mix(in srgb, var(--green) 45%, #ccc) !important;
}


/* fmt-toolbar z-index fix — stay clickable above panels */
.fmt-toolbar {
  position: relative;
  z-index: 5;
}
.msg-tools-bar {
  position: relative;
  z-index: 5;
}
#tab-send .fmt-toolbar,
#tab-campaigns .fmt-toolbar,
#campaignForm .fmt-toolbar {
  pointer-events: auto !important;
}
#tab-send .fmt-btn,
#tab-campaigns .fmt-btn,
#campaignForm .fmt-btn {
  pointer-events: auto !important;
  cursor: pointer !important;
}


/* ===== Session picker (campaigns / send / warmer) ===== */
.sess-picker,
.session-check-grid.sess-picker {
  display: block;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}
.sess-picker-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.sess-picker-count {
  margin-inline-start: auto;
  font-size: 0.8125rem;
  font-weight: 600;
}
.sess-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  max-height: min(42vh, 360px);
  overflow-y: auto;
  padding: 4px 2px 8px;
  scrollbar-gutter: stable;
}
.sess-picker-empty {
  padding: 16px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 12px;
}
.sess-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel2);
  cursor: pointer;
  user-select: none;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
  min-height: 52px;
}
.sess-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}
.sess-chip-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--green) 16%, var(--panel));
  color: var(--green);
  border: 1px solid color-mix(in srgb, var(--green) 30%, var(--line));
}
.sess-chip-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
  text-align: start;
}
.sess-chip-name {
  font-weight: 700;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sess-chip-phone {
  font-size: 0.75rem;
  color: var(--muted);
  direction: ltr;
  unicode-bidi: plaintext;
  font-variant-numeric: tabular-nums;
}
.sess-chip-mark {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--line-strong, var(--line));
  flex-shrink: 0;
  background: var(--input-bg, var(--panel));
  position: relative;
  transition: background .15s ease, border-color .15s ease;
}
.sess-chip.is-checked {
  border-color: color-mix(in srgb, var(--green) 50%, var(--line));
  background: color-mix(in srgb, var(--green) 10%, var(--panel2));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--green) 20%, transparent);
}
.sess-chip.is-checked .sess-chip-mark {
  background: var(--green);
  border-color: var(--green);
}
.sess-chip.is-checked .sess-chip-mark::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.sess-chip:hover {
  border-color: color-mix(in srgb, var(--green) 35%, var(--line));
}
@media (max-width: 560px) {
  .sess-picker-grid {
    grid-template-columns: 1fr;
    max-height: 50vh;
  }
}


/* Campaign cards */
#campaignsList {
  display: grid;
  gap: 14px;
}
.camp-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.camp-card.is-running {
  border-color: color-mix(in srgb, var(--green) 45%, var(--line));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--green) 20%, transparent), 0 8px 24px rgba(0,0,0,.15);
}
.camp-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.camp-card-title-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.camp-card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.camp-status {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.camp-status-running {
  background: color-mix(in srgb, var(--green) 18%, transparent);
  color: var(--green);
}
.camp-status-idle {
  background: var(--panel2);
  color: var(--muted);
}
.camp-status-done {
  background: color-mix(in srgb, #3b82f6 16%, transparent);
  color: #93c5fd;
}
.camp-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.camp-card-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.camp-stat {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}
.camp-stat-val {
  display: block;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.camp-stat-lbl {
  display: block;
  margin-top: 2px;
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
}
.camp-card-progress {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: var(--panel2);
  border: 1px solid var(--line);
  overflow: hidden;
  margin-bottom: 8px;
}
.camp-card-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--green2, #0e9f5a), var(--green));
  border-radius: 999px;
  transition: width .35s ease;
}
.camp-card-progress-label {
  position: absolute;
  inset-inline-end: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text);
  opacity: 0.85;
}
.camp-card-log {
  font-size: 0.78rem;
  color: var(--muted);
  direction: ltr;
  text-align: start;
  min-height: 1.2em;
}
.wizard-step.is-locked {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: auto;
}
@media (max-width: 640px) {
  .camp-card-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* ===== Flows UI polish ===== */
.flow-sessions-block {
  margin: 14px 0 18px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel2) 80%, transparent);
}
.flow-sessions-label {
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 4px;
  opacity: 0.9;
}
.flow-sessions-hint {
  font-size: 0.75rem;
  margin: 0 0 12px;
  opacity: 0.7;
}
.flow-sess-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.flow-sess-empty {
  font-size: 0.8125rem;
  padding: 6px 0;
}
.flow-sess-chip {
  position: relative;
  cursor: pointer;
  user-select: none;
  margin: 0;
}
.flow-sess-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.flow-sess-chip-ui {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: border-color .15s, background .15s, box-shadow .15s, color .15s;
}
.flow-sess-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
  flex-shrink: 0;
}
.flow-sess-chip.is-live .flow-sess-dot {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}
.flow-sess-check {
  display: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.flow-sess-chip input:checked + .flow-sess-chip-ui {
  border-color: color-mix(in srgb, var(--green) 55%, var(--line));
  background: color-mix(in srgb, var(--green) 12%, var(--panel));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--green) 18%, transparent);
  color: var(--text);
}
.flow-sess-chip input:checked + .flow-sess-chip-ui .flow-sess-check {
  display: inline-flex;
}
.flow-sess-chip:hover .flow-sess-chip-ui {
  border-color: color-mix(in srgb, var(--green) 35%, var(--line));
}

/* Flow cards */
#flowsList {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}
.flow-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 1px 0 rgba(0,0,0,.04);
  transition: border-color .15s, box-shadow .15s;
}
.flow-card:hover {
  border-color: color-mix(in srgb, var(--green) 30%, var(--line));
  box-shadow: 0 6px 20px rgba(0,0,0,.08);
}
.flow-card.is-off {
  opacity: 0.72;
}
.flow-card-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.flow-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.flow-card-title {
  font-weight: 650;
  font-size: 0.95rem;
}
.flow-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.flow-badge.on {
  background: color-mix(in srgb, #22c55e 18%, transparent);
  color: #4ade80;
}
.flow-badge.off {
  background: color-mix(in srgb, #94a3b8 16%, transparent);
  color: #94a3b8;
}
[data-theme="light"] .flow-badge.on {
  background: #dcfce7;
  color: #15803d;
}
[data-theme="light"] .flow-badge.off {
  background: #f1f5f9;
  color: #64748b;
}
.flow-card-rule {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  font-size: 0.8125rem;
  line-height: 1.4;
}
.flow-pill {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--panel2) 90%, #000);
  border: 1px solid var(--line);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: lowercase;
  opacity: 0.9;
}
.flow-quote {
  color: var(--text);
  opacity: 0.92;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flow-quote.reply {
  opacity: 0.75;
}
.flow-arrow {
  opacity: 0.45;
  font-weight: 600;
}
.flow-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.75rem;
  opacity: 0.65;
}
.flow-card-stats strong {
  font-weight: 650;
  opacity: 1;
  color: var(--text);
}
.flow-stat-sep { opacity: 0.5; }
.flow-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
  align-items: center;
}
.flow-card-actions .btn-sm {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 0.75rem;
}
.flow-card-actions .btn-danger {
  background: color-mix(in srgb, #ef4444 12%, transparent);
  color: #f87171;
  border: 1px solid color-mix(in srgb, #ef4444 30%, transparent);
}
.flow-card-actions .btn-danger:hover {
  background: color-mix(in srgb, #ef4444 22%, transparent);
  color: #fecaca;
}
[data-theme="light"] .flow-card-actions .btn-danger {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

@media (max-width: 720px) {
  .flow-card {
    flex-direction: column;
    align-items: stretch;
  }
  .flow-card-actions {
    justify-content: flex-start;
  }
}

/* Flows — use unified sess-chip picker */
#flowSessions.sess-picker {
  margin-top: 4px;
}
.flow-sessions-block {
  background: transparent;
  border: none;
  padding: 0;
  margin: 12px 0 8px;
}

/* ===== Intelligence: Health + Send Guard ===== */
.intel-guard-card {
  margin: 16px 0 8px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid rgba(52, 211, 153, 0.28);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(15, 23, 42, 0.35));
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.intel-guard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.intel-guard-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.intel-guard-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #34d399;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.25);
}
.intel-guard-icon svg { display: block; }
.intel-guard-title {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  color: var(--text, #e8eaed);
}
.intel-guard-sub {
  display: block;
  font-size: 0.78rem;
  opacity: 0.65;
  margin-top: 2px;
}
.intel-guard-badge {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  white-space: nowrap;
}
.intel-guard-badge.level-green {
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.35);
}
.intel-guard-badge.level-yellow {
  background: rgba(234, 179, 8, 0.18);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.35);
}
.intel-guard-badge.level-red {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}
.intel-guard-rec {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.45;
  opacity: 0.88;
  min-height: 1.2em;
}
.intel-guard-reasons {
  margin: 0;
  padding-inline-start: 18px;
  font-size: 0.8rem;
  opacity: 0.75;
  display: grid;
  gap: 3px;
}
.intel-guard-reasons:empty { display: none; }
.intel-guard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 4px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}
.intel-guard-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.intel-split {
  margin: 0;
  font-size: 0.84rem;
}
.send-start-row {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.camp-actions {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
/* keep guard only on step 3 via existing data-camp-step visibility rules */
.health-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
}
.health-pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #64748b;
}
.health-pill.level-green .dot { background: #22c55e; }
.health-pill.level-yellow .dot { background: #eab308; }
.health-pill.level-red .dot { background: #ef4444; }

body.light .intel-guard-card {
  background: linear-gradient(135deg, #ecfdf5, #f8fafc);
  border-color: #a7f3d0;
}
body.light .intel-guard-icon {
  background: #d1fae5;
  border-color: #6ee7b7;
  color: #059669;
}
body.light .intel-guard-title { color: #0f172a; }
body.light .intel-guard-footer { border-top-color: #e2e8f0; }
body.light .intel-guard-badge { background: #e2e8f0; color: #334155; }
body.light .intel-guard-badge.level-green { background: #dcfce7; color: #166534; }
body.light .intel-guard-badge.level-yellow { background: #fef9c3; color: #854d0e; }
body.light .intel-guard-badge.level-red { background: #fee2e2; color: #991b1b; }

.intel-protect-line {
  margin: 0;
  font-size: 0.78rem;
  color: #fbbf24;
  opacity: 0.95;
}
.intel-protect-line.is-open { color: #f87171; }


/* ===== Protection center ===== */
#tab-protect.view {
  padding-bottom: 32px;
}
.protect-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.protect-header-text h1 {
  margin: 0 0 6px;
  font-size: 1.45rem;
  font-weight: 700;
}
.protect-header-text .muted {
  margin: 0;
  max-width: 520px;
  line-height: 1.45;
  font-size: 0.9rem;
}
.protect-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.protect-top-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) {
  .protect-top-grid { grid-template-columns: 1fr; }
}
.protect-card {
  padding: 18px 18px 16px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 160px;
}
.protect-card-wide {
  min-height: 0;
}
.protect-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.protect-card-ico {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: #34d399;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.22);
}
.protect-card-head h2 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 650;
  line-height: 1.3;
}
.protect-card-sub {
  margin: 4px 0 0;
  font-size: 0.78rem;
  opacity: 0.65;
  line-height: 1.4;
}
.protect-list,
.protect-events {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  min-height: 72px;
}
.protect-list.is-empty,
.protect-events.is-empty {
  display: grid;
  place-items: center;
  text-align: center;
  opacity: 0.55;
  font-size: 0.88rem;
  border: 1px dashed rgba(148, 163, 184, 0.22);
  border-radius: 10px;
  padding: 20px 12px;
}
.protect-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(148,163,184,0.12);
  font-size: 0.86rem;
}
.protect-row .meta {
  opacity: 0.65;
  font-size: 0.76rem;
  margin-top: 3px;
}
.protect-row .actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.badge-state {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  text-transform: lowercase;
}
.badge-state.closed { background: rgba(34,197,94,0.15); color: #4ade80; }
.badge-state.throttle { background: rgba(234,179,8,0.15); color: #facc15; }
.badge-state.open { background: rgba(239,68,68,0.15); color: #f87171; }

.protect-drip-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.protect-drip-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 420px;
}
.protect-drip-numbers textarea {
  min-height: 120px;
  resize: vertical;
}
.protect-drip-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-start;
}
.protect-drip-result {
  margin: 0;
  max-height: 240px;
  overflow: auto;
  font-size: 0.8rem;
}
body.light .protect-card-ico {
  background: #d1fae5;
  border-color: #6ee7b7;
  color: #059669;
}
body.light .protect-row {
  background: #f8fafc;
  border-color: #e2e8f0;
}
body.light .protect-list.is-empty,
body.light .protect-events.is-empty {
  border-color: #cbd5e1;
}

/* ===== Global UI polish: page icons, headers, cards ===== */
.view-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.page-title-stack {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
  flex: 1;
}
.page-title-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.page-title-text h1 { margin: 0; }
.page-title-text .view-desc,
.page-title-text .muted { margin: 0; }
.page-ico {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #34d399;
  background: linear-gradient(145deg, rgba(52,211,153,0.16), rgba(52,211,153,0.05));
  border: 1px solid rgba(52, 211, 153, 0.28);
  box-shadow: 0 0 0 1px rgba(52,211,153,0.04), 0 6px 16px rgba(0,0,0,0.12);
}
.page-ico svg {
  display: block;
}
.view-head h1 {
  margin: 0 0 6px;
  font-size: 1.42rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.view-head .view-desc,
.view-head .muted {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  opacity: 0.72;
  max-width: 560px;
}

/* Side nav active glow */
.side-nav .nav-item {
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.side-nav .nav-item.active {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.2);
}
.side-nav .nav-item .nav-ico {
  opacity: 0.9;
}

/* Cards / panels subtle depth */
.panel,
.card {
  border-radius: 14px;
}
.kpi-grid {
  gap: 14px;
}
.kpi-card,
.account-card,
.camp-card {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.account-card:hover,
.camp-card:hover {
  border-color: rgba(52, 211, 153, 0.25);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

/* Section titles inside panels */
.camp-section-title,
.settings-h,
.panel h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
}

/* Empty states */
.empty-state {
  padding: 28px 16px;
  text-align: center;
  border-radius: 12px;
  border: 1px dashed rgba(148, 163, 184, 0.25);
  opacity: 0.75;
  font-size: 0.92rem;
}

/* Buttons consistency */
.btn {
  border-radius: 10px;
  transition: transform 0.08s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.2);
}

/* Status pills */
.status-pill {
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.status-pill.status-on {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}
.status-pill.status-wait {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
}

/* Form fields soft focus */
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: rgba(52, 211, 153, 0.55);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.12);
}

/* Light theme page icons */
body.light .page-ico {
  color: #059669;
  background: linear-gradient(145deg, #d1fae5, #ecfdf5);
  border-color: #6ee7b7;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.08);
}
body.light .side-nav .nav-item.active {
  background: #d1fae5;
  border-color: #a7f3d0;
}
body.light .empty-state {
  border-color: #cbd5e1;
}
body.light .account-card:hover,
body.light .camp-card:hover {
  border-color: #6ee7b7;
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.08);
}
body.light .btn-primary {
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.18);
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .btn, .side-nav .nav-item, .account-card, .camp-card {
    transition: none;
  }
}

/* Drip plan readable results */
.drip-plan-panel {
  margin-top: 4px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(52, 211, 153, 0.22);
  background: rgba(16, 185, 129, 0.06);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.drip-plan-summary {
  font-size: 0.92rem;
  line-height: 1.5;
}
.drip-plan-summary strong { font-weight: 700; }
.drip-plan-days {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.drip-day-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(148,163,184,0.12);
  font-size: 0.86rem;
}
.drip-day-row .day-label {
  font-weight: 700;
  color: #34d399;
}
.drip-day-row .day-meta { opacity: 0.75; font-size: 0.8rem; }
.drip-plan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.drip-plan-note {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
}
body.light .drip-plan-panel {
  background: #ecfdf5;
  border-color: #a7f3d0;
}
body.light .drip-day-row {
  background: #f8fafc;
  border-color: #e2e8f0;
}
body.light .drip-day-row .day-label { color: #059669; }

/* WhatsApp number check results */
.check-result-panel {
  margin-top: 16px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel2);
}
.check-result-head {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 12px;
}
.check-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.check-stat {
  text-align: center;
  padding: 10px 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.check-stat-val {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.2;
}
.check-stat-lbl {
  font-size: 0.7rem;
  opacity: 0.7;
  margin-top: 2px;
}
.check-stat.ok .check-stat-val { color: #22c55e; }
.check-stat.bad .check-stat-val { color: #f87171; }
.check-stat.warn .check-stat-val { color: #fbbf24; }
.check-result-actions { margin-bottom: 12px; }
.check-section { margin-top: 12px; }
.check-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.check-section-title.ok { color: #22c55e; }
.check-section-title.bad { color: #f87171; }
.check-section-title.warn { color: #fbbf24; }
.check-num-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}
.check-num-item {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
}
.check-num-item:last-child { border-bottom: none; }
.check-num-val { direction: ltr; unicode-bidi: isolate; }
.check-note { font-size: 0.75rem; margin-top: 12px; margin-bottom: 0; }
.check-pending, .check-error { padding: 12px; font-size: 0.9rem; }
.check-error { color: #f87171; }
@media (max-width: 640px) {
  .check-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.type-tag.type-channel {
  background: color-mix(in srgb, #a78bfa 22%, transparent);
  color: #c4b5fd;
  border: 1px solid color-mix(in srgb, #a78bfa 35%, transparent);
}
.chat-avatar.is-channel, .thread-avatar.is-channel {
  background: color-mix(in srgb, #a78bfa 18%, var(--panel));
  color: #c4b5fd;
  border-color: color-mix(in srgb, #a78bfa 35%, var(--line));
}
.chat-phone {
  font-size: 0.75rem;
  opacity: 0.75;
  direction: ltr;
  unicode-bidi: isolate;
  margin-top: 1px;
}
.channel-readonly-note {
  padding: 10px 14px;
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
  text-align: center;
}
.thread-meta.is-phone {
  direction: ltr;
  unicode-bidi: isolate;
  font-variant-numeric: tabular-nums;
}

.thread-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.thread-title-row .thread-title {
  font-weight: 700;
  font-size: 0.95rem;
}


/* —— Group Add Human Shield / Risk —— */
.ga-risk {
  margin: 12px 0 14px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.08);
  background: color-mix(in srgb, var(--panel, #121a2b) 88%, #000);
}
.ga-risk.is-low { border-color: rgba(34,197,94,.35); }
.ga-risk.is-medium { border-color: rgba(245,158,11,.4); }
.ga-risk.is-high { border-color: rgba(249,115,22,.45); }
.ga-risk.is-critical { border-color: rgba(239,68,68,.55); background: color-mix(in srgb, #7f1d1d 25%, var(--panel, #121a2b)); }
.ga-risk-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ga-risk-title { font-size: 12px; opacity: .75; margin-bottom: 2px; }
.ga-risk-level { font-weight: 700; font-size: 15px; }
.ga-risk-score { text-align: end; }
.ga-risk-score .num { font-size: 28px; font-weight: 800; line-height: 1; }
.ga-risk-score .lbl { font-size: 12px; opacity: .6; margin-inline-start: 4px; }
.ga-risk-bar { height: 6px; border-radius: 99px; background: rgba(255,255,255,.08); margin: 12px 0 10px; overflow: hidden; }
.ga-risk-bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #22c55e, #eab308, #ef4444); }
.ga-risk-recs { margin: 8px 0 0; padding-inline-start: 18px; font-size: 13px; line-height: 1.5; }
.ga-risk-recs li { margin: 3px 0; }
.ga-human-opts .check { font-size: 13px; }

.chip-warn{background:rgba(245,158,11,.18);color:#fbbf24;border:1px solid rgba(245,158,11,.35);}

.warm-gates{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
.warm-gate{font-size:11px;opacity:.75;padding:2px 7px;border-radius:999px;border:1px solid rgba(255,255,255,.08)}
.warm-gate.ok{opacity:1;border-color:rgba(34,197,94,.4);color:#86efac}
.warm-eta{font-size:11px;opacity:.7;margin-top:6px}


/* ===== FIX: composer tools strip + editor surface (dark/light) ===== */
.msg-tools-bar,
.reply-fmt-row {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin: 8px 0 0 !important;
  width: auto !important;
  max-width: 100%;
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  /* sit under editor, no full-bleed bar */
  justify-content: flex-start;
}
.msg-tools-bar::before,
.msg-tools-bar::after,
.reply-fmt-row::before,
.reply-fmt-row::after {
  content: none !important;
  display: none !important;
}

/* Editor matches parent panel — no nested darker slab */
.rich-editor,
.rich-editor.send-rich,
.rich-editor.camp-rich {
  background: var(--panel) !important;
  border: 1px solid var(--line) !important;
  box-shadow: none !important;
}
.rich-editor:focus,
.rich-editor.send-rich:focus,
.rich-editor.camp-rich:focus {
  background: var(--panel) !important;
  border-color: color-mix(in srgb, var(--green) 50%, var(--line)) !important;
}
[data-theme="light"] .rich-editor,
[data-theme="light"] .rich-editor.send-rich,
[data-theme="light"] .rich-editor.camp-rich {
  background: #fff !important;
  border-color: #e2e8f0 !important;
}
[data-theme="light"] .msg-tool-btn {
  background: #fff !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
}
[data-theme="light"] .msg-tool-btn:hover {
  border-color: color-mix(in srgb, var(--green) 45%, #e2e8f0) !important;
  background: color-mix(in srgb, var(--green) 8%, #fff) !important;
}

/* Campaign message editor column — no extra dark wrapper */
.camp-msg-editor {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}
.camp-msg-editor .field {
  margin: 0 !important;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
}
.camp-msg-editor .camp-section-title {
  margin-bottom: 8px;
}

/* Mailbox reply: tools above input, no strip */
.reply-compose .msg-tools-bar.reply-fmt-row {
  margin: 0 0 6px !important;
  order: 0;
}
.reply-compose .reply-input-row {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}
.reply-compose .rich-editor.reply-rich {
  background: var(--panel) !important;
  border: 1px solid var(--line) !important;
}
[data-theme="light"] .reply-compose .rich-editor.reply-rich {
  background: #fff !important;
}

/* Tool buttons: same surface as panel, not panel2 slab */
.msg-tools-bar .msg-tool-btn,
.msg-tools-bar label.msg-tool-btn,
.msg-tools-bar button.msg-tool-btn,
.reply-fmt-row .msg-tool-btn,
.reply-compose .msg-tool-btn {
  background: var(--panel) !important;
  border: 1px solid var(--line) !important;
}


/* ===== COMPOSER BOX: unified editor + tools (kills the mismatched strip) ===== */
.composer-box {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: var(--panel) !important;
  border: 1px solid var(--line) !important;
  border-radius: 14px !important;
  overflow: hidden;
  box-shadow: none !important;
}
[data-theme="light"] .composer-box {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}

.composer-box > .field {
  margin: 0 !important;
  padding: 0 !important;
  gap: 0 !important;
  background: transparent !important;
  border: none !important;
}

.composer-box .rich-editor,
.composer-box .rich-editor.send-rich,
.composer-box .rich-editor.camp-rich,
.composer-box .rich-editor.reply-rich {
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  width: 100% !important;
}
.composer-box .rich-editor:focus {
  box-shadow: none !important;
  border: none !important;
  outline: none !important;
}

/* Tools row: same background as box — NOT a separate painted bar */
.composer-box .msg-tools-bar,
.composer-box .msg-tools-bar.reply-fmt-row,
.composer-box .reply-fmt-row {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 6px !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 8px 10px !important;
  background: transparent !important;
  border: none !important;
  border-top: 1px solid var(--line) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  min-height: 0 !important;
  box-sizing: border-box !important;
}
[data-theme="light"] .composer-box .msg-tools-bar {
  border-top-color: #e2e8f0 !important;
  background: transparent !important;
}

.composer-box .msg-tool-btn,
.composer-box label.msg-tool-btn,
.composer-box button.msg-tool-btn {
  background: transparent !important;
  border: 1px solid var(--line) !important;
}
[data-theme="light"] .composer-box .msg-tool-btn {
  background: transparent !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
}

/* Reply: input row inside same box */
.composer-box-reply {
  flex-direction: column;
}
.composer-box-reply .msg-tools-bar {
  order: 0;
  border-top: none !important;
  border-bottom: 1px solid var(--line) !important;
}
.composer-box-reply .reply-input-row {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 8px 10px !important;
  margin: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  width: 100% !important;
  box-sizing: border-box !important;
}
.composer-box-reply .rich-editor.reply-rich {
  flex: 1 !important;
  min-height: 40px !important;
  padding: 8px 10px !important;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
}

/* Outside any leftover standalone tools bars (should not paint a slab) */
#tab-send .msg-tools-bar:not(.composer-box .msg-tools-bar),
#tab-campaigns .msg-tools-bar:not(.composer-box .msg-tools-bar),
#tab-mailbox .msg-tools-bar:not(.composer-box .msg-tools-bar) {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* Campaign title above box stays outside */
.camp-msg-editor > .camp-section-title {
  margin-bottom: 8px;
}
.camp-msg-editor .composer-box {
  margin-top: 0;
}


/* =====================================================================
   COMPOSER FINAL — mailbox / send / campaigns (Oct 2026)
   ===================================================================== */

/* --- Mailbox: tools + input separated, no outer slab --- */
#tab-mailbox .reply-compose,
.reply-compose {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 8px !important;
  width: 100% !important;
  padding: 10px 12px 12px !important;
  margin: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}
#tab-mailbox .reply-compose .msg-tools-bar,
#tab-mailbox .reply-compose .reply-fmt-row,
.reply-compose .msg-tools-bar,
.reply-compose .reply-fmt-row {
  display: inline-flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 6px !important;
  width: fit-content !important;
  max-width: 100% !important;
  align-self: flex-end !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  min-height: 0 !important;
}
#tab-mailbox .reply-compose .reply-input-row,
.reply-compose .reply-input-row {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}
#tab-mailbox .reply-compose .rich-editor.reply-rich,
.reply-compose .rich-editor.reply-rich {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  min-height: 44px !important;
  max-height: 120px !important;
  padding: 10px 14px !important;
  border-radius: 22px !important;
  border: 1px solid var(--line) !important;
  background: var(--bg2, var(--panel2)) !important;
  box-shadow: none !important;
}
[data-theme="light"] #tab-mailbox .reply-compose .rich-editor.reply-rich,
[data-theme="light"] .reply-compose .rich-editor.reply-rich {
  background: #fff !important;
  border-color: #e2e8f0 !important;
}
#tab-mailbox .reply-compose .btn-reply-send,
.reply-compose .btn-reply-send {
  flex: 0 0 auto !important;
  border-radius: 999px !important;
  min-width: 64px !important;
}

/* --- Campaign / Send: single clean composer, no dark outer block --- */
.camp-msg-editor,
.send-compose-main,
.field.send-msg-field {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}
.camp-msg-editor .camp-section-title,
.field.send-msg-field > span {
  background: transparent !important;
  margin-bottom: 8px !important;
  display: block !important;
}

.composer-box {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  background: var(--bg2, var(--panel2)) !important;
  border: 1px solid var(--line) !important;
  border-radius: 14px !important;
  overflow: hidden !important;
  box-shadow: none !important;
  margin: 0 !important;
  padding: 0 !important;
}
[data-theme="light"] .composer-box {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}

.composer-box .rich-editor,
.composer-box .rich-editor.send-rich,
.composer-box .rich-editor.camp-rich {
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  width: 100% !important;
}
.composer-box .rich-editor:focus {
  outline: none !important;
  box-shadow: none !important;
}

.composer-box .msg-tools-bar {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 6px !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 8px 10px !important;
  background: transparent !important;
  border: none !important;
  border-top: 1px solid var(--line) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  box-sizing: border-box !important;
}
[data-theme="light"] .composer-box .msg-tools-bar {
  border-top-color: #e2e8f0 !important;
}

.composer-box .msg-tool-btn,
.composer-box label.msg-tool-btn,
.composer-box button.msg-tool-btn {
  background: color-mix(in srgb, var(--panel) 80%, transparent) !important;
  border: 1px solid var(--line) !important;
}
[data-theme="light"] .composer-box .msg-tool-btn {
  background: transparent !important;
  border-color: #e2e8f0 !important;
}

/* Kill any leftover full-width painted strip outside composer-box */
#tab-send .msg-tools-bar:not(.composer-box *),
#tab-campaigns .msg-tools-bar:not(.composer-box *),
#tab-mailbox .msg-tools-bar {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* Campaign section around message: no nested dark panel */
#tab-campaigns .camp-msg-preview-row,
#tab-campaigns .camp-msg-editor,
#tab-campaigns .camp-section.camp-msg-preview-row {
  background: transparent !important;
  box-shadow: none !important;
}
#tab-send .send-compose-split,
#tab-send .send-compose-main {
  background: transparent !important;
}


/* ===== LAYOUT + TOOL BTN FINAL FIX ===== */
.send-compose-split,
#tab-send .send-compose-split {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 300px) !important;
  gap: 24px !important;
  align-items: start !important;
  width: 100% !important;
}
.camp-msg-preview-row,
#tab-campaigns .camp-msg-preview-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 300px) !important;
  gap: 24px !important;
  align-items: start !important;
}
@media (max-width: 960px) {
  .send-compose-split,
  #tab-send .send-compose-split,
  .camp-msg-preview-row,
  #tab-campaigns .camp-msg-preview-row {
    grid-template-columns: 1fr !important;
  }
}

/* Tool buttons: no mismatched slab — blend with parent */
.msg-tool-btn,
.msg-tools-bar .msg-tool-btn,
.msg-tools-bar label.msg-tool-btn,
.msg-tools-bar button.msg-tool-btn,
.reply-fmt-row .msg-tool-btn,
.reply-compose .msg-tool-btn,
.composer-box .msg-tool-btn,
.composer-box label.msg-tool-btn,
.composer-box button.msg-tool-btn,
#btnReplyEmoji.msg-tool-btn,
#btnSendEmoji.msg-tool-btn,
#btnCampEmoji.msg-tool-btn {
  background: transparent !important;
  border: 1px solid var(--line) !important;
  color: var(--text) !important;
  box-shadow: none !important;
}
.msg-tool-btn:hover,
.msg-tools-bar .msg-tool-btn:hover,
.reply-compose .msg-tool-btn:hover,
.composer-box .msg-tool-btn:hover {
  background: color-mix(in srgb, var(--green) 12%, transparent) !important;
  border-color: color-mix(in srgb, var(--green) 40%, var(--line)) !important;
  color: var(--green) !important;
}
.fmt-btn.is-active,
.msg-tools-bar .fmt-btn.is-active,
.composer-box .fmt-btn.is-active,
.reply-compose .fmt-btn.is-active {
  background: color-mix(in srgb, var(--green) 18%, transparent) !important;
  border-color: color-mix(in srgb, var(--green) 50%, var(--line)) !important;
  color: var(--green) !important;
}
[data-theme="light"] .msg-tool-btn,
[data-theme="light"] .msg-tools-bar .msg-tool-btn,
[data-theme="light"] .composer-box .msg-tool-btn,
[data-theme="light"] .reply-compose .msg-tool-btn {
  background: transparent !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
}
[data-theme="light"] .msg-tool-btn:hover {
  background: color-mix(in srgb, var(--green) 10%, #fff) !important;
  color: var(--green) !important;
}

/* Tools row never paints a different slab */
.msg-tools-bar,
.reply-fmt-row,
.composer-box .msg-tools-bar {
  background: transparent !important;
  box-shadow: none !important;
}

/* Logo sizing */
.sidebar .brand-logo-img {
  width: 168px !important;
  max-width: 100% !important;
  height: auto !important;
  object-fit: contain !important;
  background: transparent !important;
}






/* ============================================================
   DEFINITIVE: separate tool buttons + brand + no strip
   ============================================================ */

/* Group containers: zero chrome — never a continuous bar */
.fmt-toolbar,
.msg-tools-bar,
.reply-fmt-row,
.composer-box .msg-tools-bar,
.composer-box .fmt-toolbar,
#tab-mailbox .fmt-toolbar,
#tab-send .fmt-toolbar,
#tab-campaigns .fmt-toolbar {
  display: inline-flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 8px !important;
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  border-top: none !important;
  box-shadow: none !important;
  padding: 6px 0 0 0 !important;
  margin: 0 !important;
  width: auto !important;
  max-width: 100% !important;
  border-radius: 0 !important;
}

/* Each button = separate chip, same tone as surface (no lighter slab) */
button.msg-tool-btn,
label.msg-tool-btn,
.msg-tool-btn,
.fmt-btn,
.msg-tools-bar .msg-tool-btn,
.msg-tools-bar label.msg-tool-btn,
.composer-box .msg-tool-btn,
.reply-compose .msg-tool-btn,
#btnReplyEmoji,
#btnSendEmoji,
#btnCampEmoji {
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  min-height: 34px !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 10px !important;
  /* match surrounding surface — no panel2 slab */
  background: transparent !important;
  background-color: transparent !important;
  border: 1px solid var(--line) !important;
  box-shadow: none !important;
  color: var(--muted) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 34px !important;
  isolation: isolate !important;
}
button.msg-tool-btn:hover,
label.msg-tool-btn:hover,
.msg-tool-btn:hover,
.fmt-btn:hover {
  background: color-mix(in srgb, var(--green) 12%, transparent) !important;
  border-color: color-mix(in srgb, var(--green) 40%, var(--line)) !important;
  color: var(--green) !important;
}
.fmt-btn.is-active {
  background: color-mix(in srgb, var(--green) 16%, transparent) !important;
  border-color: color-mix(in srgb, var(--green) 45%, var(--line)) !important;
  color: var(--green) !important;
}
[data-theme="light"] .msg-tool-btn,
[data-theme="light"] .fmt-btn {
  background: transparent !important;
  border-color: #e2e8f0 !important;
  color: #64748b !important;
}

/* composer-box tools: thin separator only, same fill as box */
.composer-box {
  background: var(--bg2, var(--panel2)) !important;
}
.composer-box .msg-tools-bar {
  border-top: 1px solid var(--line) !important;
  padding: 8px 10px !important;
  background: transparent !important;
}
.composer-box .rich-editor {
  background: transparent !important;
}


/* ============================================================
   FINAL: dual logo + tools alignment (single source)
   ============================================================ */

/* --- Dual logo: ONLY one visible at a time --- */
aside.sidebar .brand-logo-img.brand-logo-dark {
  display: block !important;
  width: 220px !important;
  max-width: 100% !important;
  height: auto !important;
  margin: 0 auto !important;
  object-fit: contain !important;
}
aside.sidebar .brand-logo-img.brand-logo-light {
  display: none !important;
  width: 220px !important;
  max-width: 100% !important;
  height: auto !important;
  margin: 0 auto !important;
  object-fit: contain !important;
}
html[data-theme="light"] aside.sidebar .brand-logo-img.brand-logo-dark,
[data-theme="light"] aside.sidebar .brand-logo-img.brand-logo-dark {
  display: none !important;
}
html[data-theme="light"] aside.sidebar .brand-logo-img.brand-logo-light,
[data-theme="light"] aside.sidebar .brand-logo-img.brand-logo-light {
  display: block !important;
}

/* Login hero dual logo */
.hero .hero-logo.brand-logo-dark { display: block !important; }
.hero .hero-logo.brand-logo-light { display: none !important; }
html[data-theme="light"] .hero .hero-logo.brand-logo-dark,
[data-theme="light"] .hero .hero-logo.brand-logo-dark { display: none !important; }
html[data-theme="light"] .hero .hero-logo.brand-logo-light,
[data-theme="light"] .hero .hero-logo.brand-logo-light { display: block !important; }
.hero .hero-logo {
  width: 340px !important;
  max-width: min(340px, 100%) !important;
  height: auto !important;
  margin: 0 0 32px 0 !important;
  object-fit: contain !important;
}

/* Brand stack centered */
aside.sidebar > .brand {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  width: 100% !important;
  padding: 12px 0 16px !important;
  margin: 0 !important;
  border-bottom: 1px solid var(--line) !important;
  text-align: center !important;
}
aside.sidebar > .brand > .brand-inner {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  width: 220px !important;
  max-width: 100% !important;
  margin: 0 auto !important;
  gap: 8px !important;
  text-align: center !important;
}
aside.sidebar .brand-sub {
  display: block !important;
  width: 100% !important;
  max-width: 220px !important;
  margin: 0 auto !important;
  text-align: center !important;
  font-size: 0.6rem !important;
  opacity: 0.75 !important;
  color: var(--muted) !important;
}
aside.sidebar .brand-name { display: none !important; }

/* --- Uniform tool buttons (mailbox / send / campaigns) --- */
.msg-tools-bar,
.fmt-toolbar,
.reply-fmt-row {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 6px !important;
}

.msg-tools-bar .msg-tool-btn,
.msg-tools-bar label.msg-tool-btn,
.msg-tools-bar button.msg-tool-btn,
.fmt-toolbar .msg-tool-btn,
.fmt-toolbar .fmt-btn,
.reply-compose .msg-tool-btn,
.composer-box .msg-tool-btn,
#tab-send .msg-tool-btn,
#tab-campaigns .msg-tool-btn,
#tab-mailbox .msg-tool-btn {
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  min-height: 34px !important;
  max-width: 34px !important;
  max-height: 34px !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 10px !important;
  border: 1px solid var(--line) !important;
  background: transparent !important;
  color: var(--text) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  flex: 0 0 34px !important;
  line-height: 0 !important;
}

.msg-tools-bar .msg-tool-btn svg,
.fmt-toolbar .fmt-btn svg,
.reply-compose .msg-tool-btn svg,
.composer-box .msg-tool-btn svg,
#tab-send .msg-tool-btn svg,
#tab-campaigns .msg-tool-btn svg,
#tab-mailbox .msg-tool-btn svg {
  width: 16px !important;
  height: 16px !important;
  display: block !important;
  flex-shrink: 0 !important;
}

.msg-tools-sep {
  width: 1px !important;
  height: 18px !important;
  margin: 0 2px !important;
  align-self: center !important;
  background: var(--line) !important;
  flex: 0 0 1px !important;
}

/* Mailbox: tools on the OTHER side (physical right) */
#tab-mailbox .reply-compose .msg-tools-bar.reply-fmt-row,
#tab-mailbox .msg-tools-bar.reply-fmt-row {
  direction: ltr !important;
  justify-content: flex-end !important;
  width: 100% !important;
}

/* Send + campaigns: uniform row alignment */
#tab-send .msg-tools-bar,
#tab-campaigns .msg-tools-bar,
.composer-box .msg-tools-bar {
  align-items: center !important;
  justify-content: flex-start !important;
}

[data-theme="light"] .msg-tool-btn,
[data-theme="light"] .fmt-btn {
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
  background: transparent !important;
}

/* Scrollbar: keep hidden on main; mailbox list wheel-only (no visible bar) */
.main,
#mailboxChats,
#mailboxChats.mailbox-list,
#tab-mailbox aside.mailbox-list,
#mailboxMessages {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}
.main::-webkit-scrollbar,
#mailboxChats::-webkit-scrollbar,
#mailboxMessages::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
}


/* ========== SINGLE SCROLLBAR FIX ========== */
html, body {
  overflow-x: hidden !important;
  height: 100%;
}
.app-shell {
  height: 100vh !important;
  max-height: 100vh !important;
  overflow: hidden !important;
}
.sidebar {
  height: 100vh !important;
  max-height: 100vh !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}
.side-nav {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  scrollbar-width: thin;
  scrollbar-gutter: stable;
}
.main {
  height: 100vh !important;
  max-height: 100vh !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  scrollbar-width: thin;
}
/* avoid double bars from nested page wrappers */
.main > .page,
.main > [id^="tab-"],
.main .tab-panel {
  overflow: visible !important;
}


/* Contacts import panel */
.contacts-import-help {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel2);
  font-size: 0.8125rem;
  line-height: 1.55;
}
.contacts-import-help code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8em;
  color: var(--green);
}
.contacts-import-opts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.contacts-import-actions .btn {
  min-height: 42px;
}


/* ========== MAILBOX MEDIA ALIGN FIX (final) ========== */
#tab-mailbox .mailbox-toolbar {
  align-items: flex-end !important;
}
#tab-mailbox .mailbox-toolbar .field.compact {
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-end !important;
  gap: 6px !important;
}
#tab-mailbox .mailbox-toolbar .field.compact > span {
  display: block !important;
  font-size: 0.75rem !important;
  line-height: 1.2 !important;
  min-height: 1.2em !important;
  margin: 0 !important;
  padding: 0 !important;
}
#tab-mailbox .mailbox-toolbar select,
#tab-mailbox .mailbox-toolbar #mailboxMediaSeg.seg,
#tab-mailbox .mailbox-toolbar .seg,
#tab-mailbox .mailbox-toolbar .toolbar-actions .btn {
  height: 44px !important;
  min-height: 44px !important;
  max-height: 44px !important;
  box-sizing: border-box !important;
  margin: 0 !important;
}
#tab-mailbox .mailbox-toolbar #mailboxMediaSeg.seg,
#tab-mailbox .mailbox-toolbar .seg {
  display: inline-flex !important;
  align-items: stretch !important;
  padding: 3px !important;
  margin-bottom: 0 !important; /* kill generic .seg margin-bottom:12px */
  border-radius: 12px !important;
  border: 1px solid var(--line) !important;
  background: var(--panel2) !important;
  vertical-align: bottom !important;
}
#tab-mailbox .mailbox-toolbar .seg .seg-btn {
  height: auto !important;
  min-height: 0 !important;
  padding: 0 14px !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 9px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  font-size: 0.8125rem !important;
  font-weight: 700 !important;
}
#tab-mailbox .mailbox-toolbar .toolbar-actions {
  align-items: flex-end !important;
  padding-bottom: 0 !important;
  margin-bottom: 0 !important;
}


/* ===== SEND RECIPIENTS POLISH ===== */
#tab-send .send-recipients-section {
  margin-top: 8px;
  margin-bottom: 18px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
}
#tab-send .send-recipients-section .camp-section-title {
  margin-bottom: 14px;
  font-size: 0.9rem;
  font-weight: 700;
}
#tab-send .send-recipients-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
#tab-send .send-recipients-grid .field {
  margin-bottom: 0 !important;
  gap: 8px !important;
}
#tab-send .send-recipients-grid textarea {
  min-height: 120px;
  line-height: 1.5;
  resize: vertical;
}
#tab-send .send-file-upload-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
#tab-send .send-file-upload-bar .btn {
  min-height: 36px;
  padding: 0 14px;
}
#tab-send .send-file-hint {
  font-size: 0.75rem;
  margin-inline-start: auto;
}
#tab-send .send-compose-split {
  margin-top: 8px;
  gap: 20px;
}
@media (min-width: 960px) {
  #tab-send .send-recipients-grid {
    grid-template-columns: minmax(180px, 280px) 1fr;
    align-items: start;
  }
}


/* ===== LIVE PROGRESS PANEL (send + campaign logs) ===== */
.live-progress-panel {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel2);
  padding: 14px 16px;
}
.live-progress-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.live-progress-title {
  font-weight: 700;
  font-size: 0.9rem;
}
.live-progress-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
}
.live-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--green) 18%, transparent);
  color: var(--green);
  font-weight: 700;
  font-size: 0.75rem;
}
.live-pill.is-run { background: color-mix(in srgb, #38bdf8 20%, transparent); color: #38bdf8; }
.live-pill.is-err { background: color-mix(in srgb, var(--red) 18%, transparent); color: var(--red); }
.live-pill.is-done { background: color-mix(in srgb, var(--green) 22%, transparent); color: var(--green); }
.live-progress-bar-wrap {
  height: 8px;
  border-radius: 999px;
  background: var(--bg2);
  overflow: hidden;
  margin-bottom: 12px;
}
.live-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--green), color-mix(in srgb, var(--green) 60%, #38bdf8));
  border-radius: 999px;
  transition: width .25s ease;
}
.live-progress-log {
  max-height: 220px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
}
.live-log-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.live-log-row .tag {
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
}
.live-log-row .tag.ok { color: var(--green); }
.live-log-row .tag.err { color: var(--red); }
.live-log-row .tag.skip { color: #fbbf24; }
.live-log-row .tag.info { color: #38bdf8; }
.live-log-row .phone { font-family: ui-monospace, monospace; direction: ltr; text-align: start; }
.live-log-row .meta { color: var(--muted); font-size: 0.72rem; }

/* Campaign card log — always inside the card that owns it */
.camp-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.camp-card-log, .c-log {
  margin-top: 4px;
  max-height: 160px;
  overflow: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg2);
  padding: 8px;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  direction: rtl;
}
.camp-card-log:empty, .c-log:empty { display: none; }
.camp-log-line {
  display: flex;
  gap: 8px;
  padding: 4px 2px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.camp-log-line:last-child { border-bottom: 0; }
.camp-log-line .cl-tag { font-weight: 700; min-width: 52px; }
.camp-log-line .cl-tag.ok { color: var(--green); }
.camp-log-line .cl-tag.err { color: var(--red); }
.camp-log-line .cl-tag.skip { color: #fbbf24; }


/* ===== JOB LIVE PANEL (groups-style) ===== */
.job-live {
  margin-top: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  padding: 16px 18px 14px;
  box-shadow: var(--shadow);
}
.job-live-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.job-live-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.job-live-title h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}
.job-live-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 50%, transparent);
  animation: jobPulse 1.6s ease-out infinite;
}
.job-live.is-done .job-live-pulse { background: #64748b; animation: none; }
.job-live.is-err .job-live-pulse { background: var(--red); animation: none; }
@keyframes jobPulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 45%, transparent); }
  70% { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.state-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  background: color-mix(in srgb, var(--green) 16%, transparent);
  color: var(--green);
}
.state-pill.is-run { background: color-mix(in srgb, #38bdf8 18%, transparent); color: #38bdf8; }
.state-pill.is-err { background: color-mix(in srgb, var(--red) 18%, transparent); color: var(--red); }
.state-pill.is-done { background: color-mix(in srgb, #94a3b8 22%, transparent); color: #cbd5e1; }
.job-live-sub { font-size: 0.78rem; }
.job-progress { margin-bottom: 12px; }
.job-progress-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--bg2);
  overflow: hidden;
  border: 1px solid var(--line);
}
.job-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), #34d399);
  transition: width .3s ease;
}
.job-progress-text {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--muted);
}
.job-counters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.job-counter {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel2);
  padding: 10px 8px;
  text-align: center;
}
.job-counter-val {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.1;
}
.job-counter-lbl {
  margin-top: 4px;
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
}
.job-counter.tone-ok .job-counter-val { color: var(--green); }
.job-counter.tone-bad .job-counter-val { color: var(--red); }
.job-counter.tone-info .job-counter-val { color: #38bdf8; }
.job-counter.tone-muted .job-counter-val { color: #94a3b8; }
.job-log-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.job-log {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg2);
  padding: 6px;
}
.job-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 0.8rem;
}
.job-row:hover { background: color-mix(in srgb, var(--panel) 70%, transparent); }
.job-row .job-tag {
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: .02em;
}
.job-row .job-tag.ok { color: var(--green); }
.job-row .job-tag.bad { color: var(--red); }
.job-row .job-tag.skip { color: #fbbf24; }
.job-row .job-tag.info { color: #38bdf8; }
.job-row .job-phone {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  direction: ltr;
  text-align: start;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-row .job-meta {
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
}
.camp-card-log { display: none !important; } /* logs go to campLive panel */


/* ===== JOB LIVE POLISH v13 ===== */
.job-live {
  padding: 18px 20px 16px !important;
  border-radius: 16px !important;
}
.job-live-head {
  align-items: center !important;
  margin-bottom: 14px !important;
}
.job-live-title {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  min-height: 28px;
}
.job-live-title h2 {
  margin: 0 !important;
  font-size: 0.95rem !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
}
.job-live-pulse {
  width: 9px !important;
  height: 9px !important;
  flex: 0 0 9px !important;
  margin-top: 0 !important;
  align-self: center !important;
}
.state-pill {
  height: 24px !important;
  padding: 0 12px !important;
  display: inline-flex !important;
  align-items: center !important;
  font-size: 0.72rem !important;
  font-weight: 800 !important;
  line-height: 1 !important;
}
.job-progress {
  margin-bottom: 14px !important;
}
.job-progress-bar {
  height: 12px !important;
  border-radius: 999px !important;
  border: 1px solid var(--line) !important;
  background: var(--bg2) !important;
}
.job-progress-fill {
  height: 100% !important;
  border-radius: 999px !important;
  background: linear-gradient(90deg, #16a34a, #22c55e 55%, #4ade80) !important;
}
.job-progress-text {
  margin-top: 8px !important;
  font-size: 0.78rem !important;
  font-weight: 600 !important;
  color: var(--muted) !important;
  direction: ltr;
  text-align: end;
}
.job-counters {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  gap: 10px !important;
  margin-bottom: 14px !important;
}
@media (max-width: 720px) {
  .job-counters { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}
.job-counter {
  border-radius: 12px !important;
  padding: 12px 8px !important;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.job-counter-val {
  font-size: 1.25rem !important;
  font-weight: 800 !important;
}
.job-counter-lbl {
  margin-top: 4px !important;
  font-size: 0.72rem !important;
  font-weight: 600 !important;
  line-height: 1.25;
}
.job-log-toolbar {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  margin-bottom: 10px !important;
}
.job-log {
  max-height: 300px !important;
  border-radius: 12px !important;
  padding: 8px !important;
}
.job-row {
  grid-template-columns: 110px minmax(0, 1fr) minmax(80px, auto) !important;
  gap: 12px !important;
  padding: 10px 12px !important;
  border-radius: 10px !important;
  margin-bottom: 4px;
  background: color-mix(in srgb, var(--panel) 55%, transparent);
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent) !important;
}
.job-row .job-tag {
  font-size: 0.75rem !important;
  font-weight: 800 !important;
  text-align: start;
}
.job-row .job-phone {
  font-size: 0.84rem !important;
  font-weight: 600;
}
.job-row .job-meta {
  font-size: 0.74rem !important;
  opacity: 0.9;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* Accept-risk under Send Guard — final decision row */
.intel-guard-card .risk-accept-under-guard {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.09);
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}
.intel-guard-card .risk-accept-under-guard input {
  margin-top: 3px;
  flex: 0 0 auto;
}
.intel-guard-card .risk-accept-under-guard span {
  line-height: 1.45;
  font-size: 0.88rem;
  font-weight: 600;
}
