/* ─────────────────────────────────────────────────────────────────────────
   MARKETING SUITE — Marketing tab (newsletters + social library), the
   social generator modal, and the floating AI assistant. Built on the
   token layer in main.css so dark.css's variable flip mostly Just Works;
   hardcoded-light spots get explicit [data-theme="dark"] overrides below.
   ───────────────────────────────────────────────────────────────────────── */

/* ── Marketing view shell ── */
.marketing-view { padding: 16px 32px 48px; max-width: 1100px; margin: 0 auto; }
.mkt-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; padding: 8px 0 20px;
}
.mkt-pills { display: flex; gap: 8px; }
.mkt-pill {
  border: 1px solid rgba(0,0,0,0.12); background: var(--bg-surface);
  color: var(--text-secondary); font-size: 13px; font-weight: 500;
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
  transition: all var(--dur-fast) ease;
}
.mkt-pill:hover { color: var(--text-primary); border-color: var(--brand-primary); }
.mkt-pill.active {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  color: white; border-color: transparent;
}
.mkt-pill-sm { padding: 4px 11px; font-size: 12px; }

/* ── Newsletter list ── */
.mkt-list { display: flex; flex-direction: column; gap: 10px; }
.mkt-card {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--bg-surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); padding: 16px 20px; cursor: pointer;
  transition: box-shadow var(--dur-fast) ease, transform var(--dur-fast) ease;
}
.mkt-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.mkt-card-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mkt-card-title { font-weight: 600; font-size: 14px; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mkt-card-sub { font-size: 12px; color: var(--text-tertiary); }
.mkt-status {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 3px 9px; border-radius: 999px; flex-shrink: 0;
}
.mkt-status-draft    { background: rgba(37,138,203,0.12);  color: var(--brand-primary); }
.mkt-status-sending  { background: rgba(245,158,11,0.14);  color: #b45309; }
.mkt-status-sent     { background: rgba(22,163,74,0.14);   color: #15803d; }
.mkt-status-failed   { background: rgba(239,68,68,0.12);   color: var(--status-danger); }
.mkt-status-used     { background: rgba(22,163,74,0.14);   color: #15803d; }
.mkt-status-archived { background: rgba(0,0,0,0.07);       color: var(--text-tertiary); }

.mkt-empty { text-align: center; padding: 64px 16px; }
.mkt-empty-icon { font-size: 40px; margin-bottom: 12px; }
.mkt-empty-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.mkt-empty-sub { font-size: 13px; color: var(--text-secondary); max-width: 420px; margin: 0 auto 18px; line-height: 1.5; }

/* ── Newsletter editor drawer ── */
.nl-drawer { width: min(720px, 96vw); }
.nl-label {
  display: block; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-tertiary); margin-bottom: 6px;
}
.nl-hint { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--text-tertiary); font-size: 11px; }
.nl-field { margin-bottom: 16px; }
.nl-ai-box {
  background: linear-gradient(135deg, rgba(37,138,203,0.07), rgba(247,150,108,0.07));
  border: 1px solid rgba(37,138,203,0.18); border-radius: var(--radius-lg);
  padding: 14px; margin-bottom: 20px; display: flex; flex-direction: column; gap: 10px;
}
.nl-ai-box .btn { align-self: flex-start; }
.nl-preview { width: 100%; height: 320px; border: 1px solid rgba(0,0,0,0.10); border-radius: var(--radius-lg); background: #f0f4f8; }
.nl-aud-group { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.nl-aud-label { font-size: 12px; color: var(--text-secondary); min-width: 100px; }
.nl-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.nl-chip {
  border: 1px solid rgba(0,0,0,0.14); background: var(--bg-surface);
  color: var(--text-secondary); font-size: 12px; padding: 4px 11px;
  border-radius: 999px; cursor: pointer; transition: all var(--dur-fast) ease;
}
.nl-chip:hover { border-color: var(--brand-primary); color: var(--brand-primary); }
.nl-chip.on { background: var(--brand-primary); border-color: var(--brand-primary); color: white; }
.nl-aud-count { margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--brand-primary); }

/* Send confirmation modal */
.nl-confirm-modal {
  display: none; position: fixed; inset: 0; z-index: calc(var(--z-modal) + 20);
  align-items: center; justify-content: center; background: rgba(13,20,33,0.55);
  backdrop-filter: blur(4px);
}
.nl-confirm-modal.visible { display: flex; }
.nl-confirm-box {
  background: var(--bg-surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
  width: min(420px, 92vw); overflow: hidden; animation: modalIn 320ms var(--spring) both;
}
.nl-confirm-head {
  background: var(--header-bg); color: white; font-family: var(--font-display);
  font-size: 16px; font-weight: 600; padding: 16px 22px;
}
.nl-confirm-body { padding: 20px 22px; font-size: 14px; color: var(--text-primary); line-height: 1.55; }
.nl-confirm-body p { margin: 0 0 14px; }
.nl-confirm-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; background: var(--bg-elevated); }

/* ── Social generator modal ── */
.soc-modal {
  display: none; position: fixed; inset: 0; z-index: var(--z-modal);
  align-items: center; justify-content: center; padding: 16px;
}
.soc-modal.visible { display: flex; }
.soc-box {
  background: var(--bg-surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
  width: min(640px, 96vw); max-height: 90vh; display: flex; flex-direction: column;
  overflow: hidden; animation: modalIn 320ms var(--spring) both;
}
.soc-head {
  background: var(--header-bg); display: flex; align-items: center;
  justify-content: space-between; padding: 16px 22px;
}
.soc-title { font-family: var(--font-display); font-size: 16px; font-weight: 600; color: white; }
.soc-body { padding: 20px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.soc-field { margin-bottom: 14px; }
.soc-products { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.soc-prod-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(37,138,203,0.10); color: var(--brand-primary);
  font-family: var(--font-mono); font-size: 12px; font-weight: 500;
  padding: 4px 10px; border-radius: 999px;
}
.soc-prod-chip button { background: none; border: none; cursor: pointer; color: inherit; font-size: 14px; padding: 0; line-height: 1; }
.soc-prod-search-wrap { position: relative; }
.soc-prod-dd {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5;
  background: var(--bg-surface); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.soc-prod-dd-item {
  display: block; width: 100%; text-align: left; background: none; border: none;
  cursor: pointer; padding: 9px 12px; font-size: 13px; color: var(--text-primary);
}
.soc-prod-dd-item:hover { background: rgba(37,138,203,0.08); }
.soc-prod-dd-item strong { font-family: var(--font-mono); color: var(--brand-primary); margin-right: 6px; }
.soc-platforms { display: flex; flex-wrap: wrap; gap: 12px; }
.soc-plat { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-primary); cursor: pointer; }
.soc-results { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.soc-result-card {
  border: 1px solid rgba(0,0,0,0.10); border-radius: var(--radius-lg);
  padding: 14px 16px; background: var(--bg-elevated);
}
.soc-result-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.soc-result-content { font-size: 13px; color: var(--text-primary); line-height: 1.55; white-space: pre-wrap; }
.soc-result-tags { margin-top: 8px; font-size: 12px; color: var(--brand-primary); display: flex; flex-wrap: wrap; gap: 6px; }

.soc-badge {
  font-size: 11px; font-weight: 700; letter-spacing: 0.03em;
  padding: 3px 9px; border-radius: 999px; color: white;
}
.soc-badge-linkedin  { background: #0a66c2; }
.soc-badge-instagram { background: linear-gradient(45deg, #f09433, #dc2743, #bc1888); }
.soc-badge-facebook  { background: #1877f2; }
.soc-badge-x         { background: #111; }

/* ── Social library grid ── */
.soc-lib-filters { display: flex; gap: 8px; margin-bottom: 16px; }
.soc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.soc-card {
  background: var(--bg-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
  transition: box-shadow var(--dur-fast) ease;
}
.soc-card:hover { box-shadow: var(--shadow-md); }
.soc-card-used { opacity: 0.75; }
.soc-card-head { display: flex; align-items: center; justify-content: space-between; }
.soc-card-content {
  font-size: 13px; color: var(--text-primary); line-height: 1.5; white-space: pre-wrap;
  max-height: 150px; overflow-y: auto;
}
.soc-card-skus { font-family: var(--font-mono); font-size: 11px; color: var(--text-tertiary); }
.soc-card-actions { display: flex; gap: 8px; margin-top: auto; }

/* ── AI assistant: FAB + panel ── */
.ai-fab {
  position: fixed; bottom: 24px; right: 24px; z-index: calc(var(--z-header) + 50);
  width: 52px; height: 52px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  color: white; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(37,138,203,0.40);
  transition: transform var(--dur-base) var(--spring), box-shadow var(--dur-fast) ease;
}
.ai-fab:hover { transform: scale(1.07) translateY(-2px); box-shadow: 0 8px 24px rgba(37,138,203,0.50); }
.ai-fab:active { transform: scale(0.94); }
.ai-fab.open { transform: rotate(90deg); }

.ai-panel {
  position: fixed; bottom: 88px; right: 24px; z-index: calc(var(--z-header) + 51);
  width: min(400px, calc(100vw - 32px)); height: min(600px, calc(100vh - 120px));
  background: var(--bg-surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
  display: none; flex-direction: column; overflow: hidden;
  transition: top 200ms var(--spring), left 200ms var(--spring), right 200ms var(--spring),
    bottom 200ms var(--spring), width 200ms var(--spring), height 200ms var(--spring),
    border-radius 200ms var(--spring);
}
.ai-panel.visible { display: flex; animation: popupIn 200ms var(--spring) both; }
.ai-panel.maximized {
  top: 0; left: 0; right: 0; bottom: 0; width: 100vw; height: 100vh; height: 100dvh; border-radius: 0;
}
.ai-panel.maximized .ai-msg { max-width: min(70%, 640px); }
.ai-head {
  background: var(--header-bg); display: flex; align-items: center;
  justify-content: space-between; padding: 13px 16px; flex-shrink: 0;
}
.ai-head-title { font-family: var(--font-display); font-size: 14px; font-weight: 600; color: white; }
.ai-head-actions { display: flex; gap: 4px; }
.ai-head-btn {
  background: none; border: none; cursor: pointer; color: rgba(255,255,255,0.55);
  padding: 5px 7px; border-radius: 6px; font-size: 13px; line-height: 1;
  display: flex; align-items: center;
}
.ai-head-btn:hover { color: white; background: rgba(255,255,255,0.10); }

.ai-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.ai-msg { max-width: 88%; border-radius: 14px; padding: 9px 13px; font-size: 13px; line-height: 1.5; }
.ai-msg p { margin: 0 0 8px; }
.ai-msg p:last-child { margin-bottom: 0; }
.ai-msg ul { margin: 0 0 8px; padding-left: 18px; }
.ai-msg code {
  font-family: var(--font-mono); font-size: 12px; background: rgba(0,0,0,0.07);
  padding: 1px 5px; border-radius: 4px;
}
.ai-msg-user {
  align-self: flex-end; color: white;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
}
.ai-msg-assistant { align-self: flex-start; background: var(--bg-elevated); color: var(--text-primary); }
.ai-error { color: var(--status-danger); }

.ai-tool-chip {
  display: inline-block; margin-top: 6px; font-size: 11px; color: var(--brand-primary);
  background: rgba(37,138,203,0.10); padding: 3px 10px; border-radius: 999px;
  animation: shimmerPulse 1.2s ease infinite;
}
@keyframes shimmerPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }

.ai-typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.ai-typing span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-tertiary);
  animation: aiBounce 1.1s ease infinite;
}
.ai-typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes aiBounce { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-4px); } }

.ai-hist-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-tertiary); padding: 4px 2px 8px;
}
.ai-hist-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left; background: var(--bg-elevated); border: none;
  cursor: pointer; padding: 10px 13px; border-radius: 10px; margin-bottom: 6px;
}
.ai-hist-item:hover { background: rgba(37,138,203,0.10); }
.ai-hist-name { font-size: 13px; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-hist-date { font-size: 11px; color: var(--text-tertiary); flex-shrink: 0; }

.ai-inputbar {
  display: flex; align-items: flex-end; gap: 8px; padding: 12px;
  border-top: 1px solid rgba(0,0,0,0.07); flex-shrink: 0; background: var(--bg-surface);
}
.ai-inputbar textarea {
  flex: 1; resize: vertical; border: 1px solid rgba(0,0,0,0.12); border-radius: 12px;
  padding: 9px 13px; font-size: 13px; font-family: var(--font-body);
  color: var(--text-primary); background: var(--bg-surface);
  min-height: 38px; max-height: 45vh; overflow-y: auto;
}
.ai-inputbar textarea:focus {
  outline: none; border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(37,138,203,0.12);
}
.ai-send {
  width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  color: white; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ai-send:disabled { opacity: 0.5; cursor: default; }

/* ════════════════════════════════════════════════════════════════════
   Newsletter builder (full-screen)
   ════════════════════════════════════════════════════════════════════ */
.nl-builder {
  /* Above the app header (300) but below the AI chat FAB/panel (+50/+51)
     so the assistant stays reachable while designing; modals (500+) top all. */
  position: fixed; inset: 0; z-index: calc(var(--z-header) + 40);
  background: var(--bg-body, #f0f4f8); display: none; flex-direction: column;
}
.nl-builder.visible { display: flex; animation: popupIn 180ms var(--spring) both; }
.nlb-head {
  display: flex; align-items: center; gap: 14px; padding: 12px 20px;
  background: var(--header-bg); flex-shrink: 0;
}
.nlb-head-title { font-family: var(--font-display); font-size: 16px; font-weight: 600; color: white; flex: 1; }
.nlb-head-actions { display: flex; gap: 8px; }
/* The builder header is always dark — keep secondary buttons legible in both themes */
.nlb-head .btn-secondary {
  background: rgba(255,255,255,0.12); color: white; border: 1px solid rgba(255,255,255,0.20);
}
.nlb-head .btn-secondary:hover { background: rgba(255,255,255,0.22); }
.nlb-body { flex: 1; display: flex; min-height: 0; }
.nlb-editor {
  width: min(560px, 52%); min-width: 380px; overflow-y: auto; padding: 18px 20px 60px;
  border-right: 1px solid rgba(0,0,0,0.08); background: var(--bg-surface);
}
.nlb-preview-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.nlb-preview-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-tertiary); padding: 10px 16px 6px;
}
.nlb-preview { flex: 1; border: none; width: 100%; background: #f0f4f8; }

.nlb-sec {
  border: 1px solid rgba(0,0,0,0.08); border-radius: 12px; background: var(--bg-surface);
  padding: 14px 16px; margin-bottom: 14px;
}
.nlb-sec-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-secondary); margin-bottom: 10px;
}
.nlb-sec .form-textarea { width: 100%; margin-bottom: 8px; }

/* Palette */
.nlb-palette { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.nlb-pal-btn {
  border: 1px dashed rgba(37,138,203,0.45); background: rgba(37,138,203,0.05);
  color: var(--brand-primary); font-size: 12px; font-weight: 600;
  padding: 6px 11px; border-radius: 8px; cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
}
.nlb-pal-btn:hover { background: rgba(37,138,203,0.13); transform: translateY(-1px); }

/* Canvas + block cards */
.nlb-canvas { display: flex; flex-direction: column; gap: 10px; }
.nlb-canvas-empty {
  border: 2px dashed rgba(0,0,0,0.10); border-radius: 12px; padding: 26px;
  text-align: center; font-size: 13px; color: var(--text-tertiary);
}
.nlb-block {
  border: 1px solid rgba(0,0,0,0.10); border-radius: 12px; background: var(--bg-elevated);
  overflow: visible; transition: box-shadow 140ms ease, border-color 140ms ease;
}
.nlb-block:hover { border-color: rgba(37,138,203,0.45); box-shadow: 0 2px 10px rgba(15,23,42,0.06); }
.nlb-ghost { opacity: 0.4; border-style: dashed; }
.nlb-block-head {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.nlb-drag { cursor: grab; color: var(--text-tertiary); font-size: 13px; padding: 2px 4px; user-select: none; }
.nlb-drag:active { cursor: grabbing; }
.nlb-block-type { font-size: 12px; font-weight: 700; color: var(--text-secondary); flex: 1; }
.nlb-block-actions { display: flex; gap: 2px; }
.nlb-ib {
  background: none; border: none; cursor: pointer; color: var(--text-tertiary);
  font-size: 13px; padding: 3px 6px; border-radius: 6px;
}
.nlb-ib:hover { background: rgba(0,0,0,0.06); color: var(--text-primary); }
.nlb-ib-del:hover { background: rgba(220,38,38,0.10); color: #dc2626; }
.nlb-block-fields { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.nlb-row { display: flex; gap: 8px; align-items: center; position: relative; }
.nlb-row .form-input { flex: 1; min-width: 0; }
.nlb-narrow { flex: 0 0 96px !important; }
.nlb-check { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.nlb-divider-hint { font-size: 12px; color: var(--text-tertiary); }

/* Image block */
.nlb-img-top { display: flex; gap: 10px; align-items: flex-start; }
.nlb-img-thumb {
  width: 84px; height: 62px; object-fit: cover; border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.10); flex-shrink: 0; background: var(--bg-surface);
}
.nlb-img-none {
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--text-tertiary);
}
.nlb-img-controls { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.nlb-upload-btn { position: relative; text-align: center; }
.nlb-upload-btn.uploading { opacity: 0.6; pointer-events: none; }
.nlb-upload-btn.uploading::after { content: '…'; }

/* Typeahead dropdowns (contacts + products) */
.nl-pick-wrap { position: relative; flex: 1; }
.nl-pick-dd {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 40;
  background: var(--bg-surface); border-radius: 10px; box-shadow: var(--shadow-lg);
  overflow: hidden; display: flex; flex-direction: column;
}
.nl-pick-item {
  text-align: left; background: none; border: none; cursor: pointer;
  padding: 9px 12px; font-size: 12.5px; color: var(--text-primary);
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.nl-pick-item:hover { background: rgba(37,138,203,0.08); }
.nl-pick-item strong { color: var(--brand-primary); }
.nl-pick-unsub { color: #dc2626; font-size: 10px; text-transform: uppercase; font-weight: 700; }
.nl-pick-row { display: flex; gap: 8px; align-items: flex-start; }

/* Picked recipient chips */
.nl-picked { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.nl-picked-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(37,138,203,0.10); color: var(--brand-primary);
  font-size: 12px; font-weight: 600; padding: 4px 6px 4px 10px; border-radius: 999px;
}
.nl-picked-chip button {
  background: none; border: none; cursor: pointer; color: inherit;
  font-size: 10px; padding: 2px 4px; border-radius: 50%;
}
.nl-picked-chip button:hover { background: rgba(37,138,203,0.18); }

/* Topic chip on list cards */
.nl-topic-chip {
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
  background: rgba(0,0,0,0.05); padding: 3px 10px; border-radius: 999px;
  white-space: nowrap; flex-shrink: 0;
}

/* Template chooser + grid */
.nl-tpl-box { width: min(560px, 92vw); }
.nl-tpl-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.nl-tpl-item {
  text-align: left; border: 1px solid rgba(0,0,0,0.10); border-radius: 12px;
  background: var(--bg-surface); cursor: pointer; padding: 14px;
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}
.nl-tpl-item:hover { border-color: var(--brand-primary); box-shadow: 0 3px 12px rgba(15,23,42,0.08); transform: translateY(-1px); }
.nl-tpl-blank { border-style: dashed; }
.nl-tpl-item-name { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.nl-tpl-item-desc { font-size: 12px; color: var(--text-tertiary); line-height: 1.4; }

.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tpl-card {
  border: 1px solid rgba(0,0,0,0.09); border-radius: 14px; background: var(--bg-surface);
  overflow: hidden; display: flex; flex-direction: column;
  transition: box-shadow 140ms ease, transform 140ms ease;
}
.tpl-card:hover { box-shadow: 0 4px 16px rgba(15,23,42,0.08); transform: translateY(-2px); }
.tpl-card-body { padding: 16px; cursor: pointer; flex: 1; }
.tpl-card-name { font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.tpl-card-desc { font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 8px; }
.tpl-card-meta { font-size: 11px; color: var(--text-tertiary); }
.tpl-card-actions { display: flex; gap: 8px; padding: 10px 16px; border-top: 1px solid rgba(0,0,0,0.06); }
.tpl-del:hover { color: #dc2626; border-color: rgba(220,38,38,0.4); }

/* Suppression pane */
.sup-head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.sup-intro { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.sup-add { display: flex; gap: 8px; flex-wrap: wrap; }
.sup-add .form-input { flex: 1; min-width: 150px; }
.sup-add select.form-input { flex: 0 0 140px; }
.sup-search { max-width: 320px; }
.sup-table { width: 100%; border-collapse: collapse; background: var(--bg-surface); border-radius: 12px; overflow: hidden; }
.sup-table th {
  text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-tertiary); padding: 10px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.08); background: var(--bg-elevated);
}
.sup-table td { padding: 10px 14px; border-bottom: 1px solid rgba(0,0,0,0.05); font-size: 13px; color: var(--text-primary); }
.sup-email { font-weight: 600; }
.sup-note { font-size: 11px; color: var(--text-tertiary); font-weight: 400; margin-top: 2px; }
.sup-src { color: var(--text-tertiary); font-size: 12px; }
.sup-badge {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  padding: 3px 9px; border-radius: 999px;
}
.sup-badge-unsubscribed { background: rgba(100,116,139,0.14); color: #64748b; }
.sup-badge-bounced      { background: rgba(217,119,6,0.14); color: #b45309; }
.sup-badge-complained   { background: rgba(220,38,38,0.12); color: #dc2626; }
.sup-badge-manual       { background: rgba(37,138,203,0.12); color: var(--brand-primary); }

/* ── Mobile ── */
@media (max-width: 768px) {
  .marketing-view { padding: 12px 16px 40px; }
  .nl-drawer { width: 100vw; }
  .ai-panel {
    bottom: 0; right: 0; width: 100vw; height: 100vh; height: 100dvh; border-radius: 0;
  }
  .ai-fab { bottom: calc(18px + env(safe-area-inset-bottom, 0px)); right: 18px; }
  .ai-maximize-btn { display: none; }

  .ai-head { padding: 16px 18px; }
  .ai-head-title { font-size: 15px; }
  .ai-head-btn { padding: 8px 10px; }

  .ai-messages { padding: 18px 16px; gap: 14px; }
  .ai-msg { max-width: 92%; font-size: 14.5px; padding: 11px 15px; border-radius: 16px; }

  .ai-inputbar {
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px)); gap: 10px;
  }
  .ai-inputbar textarea {
    /* 16px prevents iOS Safari from auto-zooming the page on focus, which is
       what makes the input appear to jump off-screen when typing starts. */
    font-size: 16px; min-height: 44px; max-height: 40vh;
    padding: 11px 15px; border-radius: 14px; resize: none;
  }
  .ai-send { width: 44px; height: 44px; }

  /* Newsletter builder on small screens */
  .nlb-body { flex-direction: column; overflow-y: auto; }
  .nlb-editor { width: 100%; min-width: 0; border-right: none; border-bottom: 1px solid rgba(0,0,0,0.08); }
  .nlb-preview-pane { min-height: 480px; }
  .nl-tpl-list { grid-template-columns: 1fr; }
}

/* ── Dark theme overrides (hardcoded-light spots) ── */
[data-theme="dark"] .mkt-pill,
[data-theme="dark"] .nl-chip { border-color: var(--border-default, rgba(255,255,255,0.12)); }
[data-theme="dark"] .soc-result-card { border-color: rgba(255,255,255,0.10); }
[data-theme="dark"] .ai-inputbar { border-top-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .ai-inputbar textarea { border-color: rgba(255,255,255,0.14); background: var(--bg-elevated); }
[data-theme="dark"] .ai-msg code { background: rgba(255,255,255,0.10); }
[data-theme="dark"] .mkt-status-archived { background: rgba(255,255,255,0.10); }
[data-theme="dark"] .soc-badge-x { background: #000; border: 1px solid rgba(255,255,255,0.25); }
[data-theme="dark"] .nlb-editor { border-right-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .nlb-sec,
[data-theme="dark"] .nlb-block,
[data-theme="dark"] .nl-tpl-item,
[data-theme="dark"] .tpl-card { border-color: rgba(255,255,255,0.10); }
[data-theme="dark"] .nlb-block-head,
[data-theme="dark"] .tpl-card-actions { border-color: rgba(255,255,255,0.07); }
[data-theme="dark"] .nlb-ib:hover { background: rgba(255,255,255,0.10); }
[data-theme="dark"] .nlb-canvas-empty { border-color: rgba(255,255,255,0.14); }
[data-theme="dark"] .nl-topic-chip { background: rgba(255,255,255,0.10); }
[data-theme="dark"] .sup-table th { border-bottom-color: rgba(255,255,255,0.10); }
[data-theme="dark"] .sup-table td { border-bottom-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .nl-pick-item { border-bottom-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .nlb-img-thumb { border-color: rgba(255,255,255,0.12); }
[data-theme="dark"] .nl-preview { border-color: rgba(255,255,255,0.14); }
