/* Upstream Content Engine — Preview UI styles
   Brand palette sourced from templates/brand.css (Premium White)
   Desktop-only (responsive deferred per Phase 6 decisions)
*/

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Brand Palette (hex values from templates/brand.css) ──── */
:root {
  --bg-primary:     #FFFFFF;
  --bg-secondary:   #F5F7FA;
  --accent:         #2D7DD2;
  --text-primary:   #1A1A2E;
  --text-muted:     #6B7A8D;
  --cta-gold:       #C9A84C;
  --border:         #E2E8F0;
  --danger:         #E05C5C;
  --data-positive:  #4CAF7D;
  --data-negative:  #E05C5C;
  --data-neutral:   #6B7A8D;
  --sidebar-bg:     #1A1A2E;
  --sidebar-text:   #FFFFFF;
  --sidebar-active: #2D7DD2;
  --card-shadow:    0 1px 4px rgba(0, 0, 0, 0.08);
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  --font-sans: system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
}

/* ── Body ─────────────────────────────────────────────────── */
body {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout: sidebar + main ───────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background-color: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
}

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-header h1 {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sidebar-text);
  line-height: 1.3;
}

.sidebar-header .tagline {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 4px;
  font-family: var(--font-mono);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}

.nav-item {
  display: block;
  width: 100%;
  padding: 10px 20px;
  font-size: 13px;
  font-family: var(--font-sans);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.65);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  letter-spacing: 0.01em;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--sidebar-text);
}

.nav-item.active {
  background-color: rgba(45, 125, 210, 0.18);
  color: var(--sidebar-text);
  border-left: 3px solid var(--sidebar-active);
  padding-left: 17px;
}

.nav-section-label {
  padding: 14px 20px 4px;
  font-size: 10px;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.3);
}

/* ── Main content ─────────────────────────────────────────── */
.main {
  margin-left: 220px;
  flex: 1;
  padding: 32px 36px;
  min-height: 100vh;
}

.page-header {
  margin-bottom: 28px;
}

.page-header h2 {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.page-header .subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--card-shadow);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.card-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.card-value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.card-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ── Status badge ─────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.badge-ok      { background: rgba(76, 175, 125, 0.12); color: var(--data-positive); }
.badge-pending { background: rgba(201, 168, 76, 0.12);  color: var(--cta-gold); }
.badge-error   { background: rgba(224, 92, 92, 0.12);   color: var(--danger); }

/* ── Loading placeholder ──────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
}

/* ── Utility ──────────────────────────────────────────────── */
.mono { font-family: var(--font-mono); }
.text-muted { color: var(--text-muted); }
.text-positive { color: var(--data-positive); }
.text-negative { color: var(--data-negative); }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* ── Error / Empty states ─────────────────────────────────── */
.error-state {
  padding: 24px;
  color: var(--danger);
  font-family: var(--font-mono);
  font-size: 13px;
  background: rgba(224, 92, 92, 0.06);
  border-radius: 6px;
  border: 1px solid rgba(224, 92, 92, 0.2);
}

.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  background: var(--bg-primary);
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.empty-state code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 3px;
}

/* ── Section blocks ───────────────────────────────────────── */
.section-block {
  margin-bottom: 28px;
}

.section-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ── Dashboard: Track cards ───────────────────────────────── */
.track-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.track-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--card-shadow);
  border-left: 4px solid var(--accent);
}

.track-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.track-name {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.track-metrics {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.metric-label {
  font-size: 12px;
  color: var(--text-muted);
}

.metric-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.track-last-run {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 4px;
}

/* ── Dashboard: Data table ────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.data-table th {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: var(--bg-secondary);
}

.sortable-col {
  cursor: pointer;
  user-select: none;
}

.sortable-col:hover {
  color: var(--accent);
}

/* ── Dashboard: Analytics row ─────────────────────────────── */
.analytics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.analytics-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--card-shadow);
}

/* ── Pillar badge ─────────────────────────────────────────── */
.pillar-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.04em;
  background: rgba(45, 125, 210, 0.1);
  color: var(--accent);
  text-transform: capitalize;
}

/* ── Intelligence: Brief card ─────────────────────────────── */
.brief-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--card-shadow);
}

.brief-week {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

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

.brief-section {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.brief-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.brief-section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

.brief-section-body {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
}

/* ── Intelligence: Signal table ───────────────────────────── */
.signals-table {
  table-layout: fixed;
}

.signals-table td:nth-child(1) { width: 120px; }
.signals-table td:nth-child(3) { width: 140px; }
.signals-table td:nth-child(4) { width: 80px; text-align: center; }

/* ── Intelligence: Topic cards ────────────────────────────── */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.topic-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.topic-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.topic-seo {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

.topic-meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Batch: Action bar ────────────────────────────────────── */
.batch-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 20px;
}

.approve-count {
  font-size: 14px;
  color: var(--text-muted);
}

.approve-count .mono {
  font-size: 20px;
  font-weight: 700;
  color: var(--data-positive);
}

.publish-btn {
  padding: 10px 24px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.publish-btn:hover:not(:disabled) {
  background: #2464a8;
}

.publish-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Batch: Master-detail layout ──────────────────────────── */
.master-detail {
  display: flex;
  gap: 0;
  height: calc(100vh - 220px);
  min-height: 600px;
}

.article-list {
  width: 300px;
  flex-shrink: 0;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px 0 0 8px;
  background: var(--bg-primary);
}

.detail-pane {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 8px 8px 0;
  background: var(--bg-primary);
}

/* ── Batch: Article list items ────────────────────────────── */
.article-list-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}

.article-list-item:last-child {
  border-bottom: none;
}

.article-list-item:hover {
  background: var(--bg-secondary);
}

.article-list-item.selected {
  background: rgba(45, 125, 210, 0.08);
  border-left: 3px solid var(--accent);
  padding-left: 13px;
}

.article-list-item.approved {
  border-left: 3px solid var(--data-positive);
  padding-left: 13px;
}

.article-list-item.selected.approved {
  border-left: 3px solid var(--accent);
}

.article-list-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.35;
}

.article-list-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.article-list-actions {
  display: flex;
  gap: 6px;
}

/* ── Approve button ───────────────────────────────────────── */
.approve-btn {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-muted);
  transition: all 0.15s;
}

.approve-btn:hover {
  border-color: var(--data-positive);
  color: var(--data-positive);
}

.approve-btn.is-approved {
  background: rgba(76, 175, 125, 0.12);
  color: var(--data-positive);
  border-color: var(--data-positive);
}

/* ── Article detail header ────────────────────────────────── */
.article-detail {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.article-detail-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.article-title-area {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.edit-title-input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 6px;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.edit-title-input:hover,
.edit-title-input:focus {
  border-color: var(--border);
  background: var(--bg-secondary);
}

.article-edit-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.edit-summary-input {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-primary);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  padding: 8px 10px;
  border-radius: 4px;
  outline: none;
  resize: vertical;
  transition: border-color 0.15s;
}

.edit-summary-input:focus {
  border-color: var(--accent);
}

.edit-cta-input {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-primary);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  padding: 8px 10px;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.15s;
}

.edit-cta-input:focus {
  border-color: var(--accent);
}

/* ── Tab bar ──────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  border-bottom: 2px solid var(--border);
  padding: 0 24px;
  background: var(--bg-primary);
  overflow-x: auto;
  flex-shrink: 0;
}

.tab-btn {
  padding: 10px 14px;
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  margin-bottom: -2px;
  transition: color 0.12s, border-color 0.12s;
  letter-spacing: 0.02em;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Tab content ──────────────────────────────────────────── */
.tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

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

.tab-empty code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 3px;
}

/* ── Blog preview ─────────────────────────────────────────── */
.blog-preview-wrapper {
  overflow-y: auto;
}

.blog-preview.prose {
  max-width: 680px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary);
}

.blog-preview.prose h1,
.blog-preview.prose h2,
.blog-preview.prose h3 {
  font-family: var(--font-mono);
  font-weight: 700;
  margin: 20px 0 10px;
  color: var(--text-primary);
}

.blog-preview.prose h2 { font-size: 16px; }
.blog-preview.prose h3 { font-size: 14px; }

.blog-preview.prose p {
  margin-bottom: 14px;
}

.blog-preview.prose ul,
.blog-preview.prose ol {
  margin: 12px 0 12px 24px;
}

.blog-preview.prose li {
  margin-bottom: 6px;
}

.blog-preview.prose a {
  color: var(--accent);
  text-decoration: none;
}

.blog-preview.prose a:hover {
  text-decoration: underline;
}

/* ── Text content (non-blog tabs) ─────────────────────────── */
.text-content {
  max-width: 720px;
}

.text-pre {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

.text-content-with-copy {
  position: relative;
}

.text-content-with-copy .copy-btn {
  position: absolute;
  top: 0;
  right: 0;
}

.thread-item {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.thread-item:last-child {
  border-bottom: none;
}

.thread-index {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  padding-top: 2px;
}

/* ── Copy button ──────────────────────────────────────────── */
.copy-btn {
  padding: 4px 10px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.12s;
  position: relative;
}

.copy-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.copy-feedback {
  color: var(--data-positive);
}

/* ── Ads tab ──────────────────────────────────────────────── */
.ads-tab-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.boost-badge {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(201, 168, 76, 0.15);
  color: var(--cta-gold);
  border-radius: 4px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.ad-image-row {
  font-size: 12px;
  color: var(--text-muted);
}

.ad-targeting {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 16px;
}

.targeting-row {
  display: flex;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 6px;
}

.targeting-row:last-child { margin-bottom: 0; }

.ad-variants {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ad-variant-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.ad-variant-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.ad-variant-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.ad-field {
  margin-bottom: 10px;
}

.ad-field:last-child { margin-bottom: 0; }

.ad-field-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.ad-field-value {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
}

/* ── Ads standalone page ──────────────────────────────────── */
.ads-brief-list {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.ads-article-block {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--card-shadow);
}

.ads-article-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.ads-article-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

/* ── Newsletter preview grid (Plan 03) ───────────────────── */
.newsletter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.iframe-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.email-iframe {
  width: 100%;
  height: 600px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-primary);
  overflow: auto;
}

/* ── Publish log panel (Plan 03) ─────────────────────────── */
.publish-log-panel {
  margin-bottom: 24px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.publish-progress-bar {
  height: 3px;
  background: var(--border);
}

.publish-progress-fill {
  height: 100%;
  background: var(--accent);
}

.publish-log-header {
  background: #1A1A2E;
  color: rgba(255,255,255,0.55);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 16px;
}

.publish-log-body {
  background: #111827;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  padding: 12px 16px;
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-line {
  display: flex;
  gap: 10px;
  align-items: baseline;
}

.log-icon {
  width: 14px;
  flex-shrink: 0;
  font-size: 13px;
}

.log-step { color: rgba(255,255,255,0.55); min-width: 160px; }
.log-article { color: rgba(255,255,255,0.80); font-weight: 600; }
.log-detail { color: rgba(255,255,255,0.45); }
.log-url { color: #60a5fa; word-break: break-all; }
.log-url:hover { text-decoration: underline; }

.log-success .log-icon { color: #4CAF7D; }
.log-error .log-icon { color: #E05C5C; }
.log-in_progress .log-icon { color: #C9A84C; }

/* ── Post-publish summary card (Plan 03) ─────────────────── */
.post-publish-summary {
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--data-positive);
  border-radius: 8px;
  padding: 20px 24px;
  background: var(--bg-primary);
}

.post-publish-banner {
  font-size: 15px;
  font-weight: 700;
  color: var(--data-positive);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.summary-section {
  margin-bottom: 20px;
}

.summary-section-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.link-card {
  display: block;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--accent);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-card:hover { text-decoration: underline; background: var(--border); }

.summary-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.summary-cost {
  font-size: 13px;
  color: var(--text-primary);
}

.secondary-btn {
  padding: 6px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-primary);
}

.secondary-btn:hover { background: var(--bg-secondary); }

/* ── Pipeline visualization ────────────────────────────── */

.pipeline-flow {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  overflow-x: auto;
  padding: 16px 0;
}

.pipeline-node {
  flex: 0 0 auto;
  width: 120px;
  padding: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  cursor: pointer;
  transition: box-shadow .15s ease;
}
.pipeline-node:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }

.pipeline-node-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.pipeline-node-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.pipeline-status-dot { width: 8px; height: 8px; border-radius: 50%; }
.pipeline-node-count { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.pipeline-node-detail { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.pipeline-node-time { font-size: 10px; color: var(--text-muted); margin-top: 6px; opacity: .7; }

.pipeline-arrow {
  display: flex;
  align-items: center;
  font-size: 18px;
  color: var(--text-muted);
  padding: 0 2px;
  margin-top: 24px;
}

.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.channel-card {
  padding: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: center;
}
.channel-label { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.channel-type { font-size: 11px; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .04em; }

/* ── Login page ────────────────────────────────────────── */

.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: var(--bg-secondary);
}

.login-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  max-width: 400px;
  width: 100%;
  text-align: center;
}
.login-card h1 { font-size: 22px; color: var(--text-primary); margin-bottom: 8px; }
.login-card .subtitle { color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }

.login-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  background: var(--bg-secondary);
}
.login-input:focus { outline: none; border-color: var(--accent); }

/* ── Overview: Metric cards ────────────────────────────────── */
.metric-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-primary);
  border-radius: 8px;
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
}

.overview-metric-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
  line-height: 1;
}

.overview-metric-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
  font-family: var(--font-mono);
}

/* ── Analytics: Funnel bars ──────────────────────────────────── */
.funnel-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
}

.funnel-label {
  width: 100px;
  font-size: 13px;
  color: var(--text-muted);
  text-transform: capitalize;
}

.funnel-bar-container {
  flex: 1;
  background: var(--bg-secondary);
  border-radius: 4px;
  height: 28px;
}

.funnel-bar {
  height: 100%;
  border-radius: 4px;
  background: var(--sidebar-active);
  transition: width 0.3s;
}

.funnel-count {
  width: 50px;
  text-align: right;
  font-weight: 600;
  font-family: var(--font-mono);
}

.funnel-conversion {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin: 2px 0;
  font-family: var(--font-mono);
}

/* ── Activity log ────────────────────────────────────────────── */
.activity-entry {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.activity-entry:hover {
  background: var(--bg-secondary);
}

.activity-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.activity-time {
  font-size: 12px;
  color: var(--text-muted);
  width: 60px;
  flex-shrink: 0;
  font-family: var(--font-mono);
}

.activity-detail {
  flex: 1;
}

.activity-expand {
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: 4px;
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Budget bar ──────────────────────────────────────────────── */
.budget-bar-container {
  background: var(--bg-secondary);
  border-radius: 4px;
  height: 20px;
  margin: 8px 0;
}

.budget-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}

/* ── Filter tabs ─────────────────────────────────────────────── */
.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.filter-tab {
  padding: 6px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--font-sans);
  transition: all 0.12s;
}

.filter-tab:hover {
  border-color: var(--sidebar-active);
  color: var(--sidebar-active);
}

.filter-tab.active {
  background: var(--sidebar-active);
  color: white;
  border-color: var(--sidebar-active);
}

/* ── Prospect Feed ───────────────────────────────────────────── */
.prospect-card { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s; }
.prospect-card:hover { background: var(--bg-secondary); }
.prospect-name { font-weight: 600; width: 160px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prospect-role { color: var(--text-muted); font-size: 13px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prospect-pain { color: var(--text-muted); font-size: 13px; flex: 2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prospect-score { font-size: 12px; font-weight: 600; color: var(--text-muted); font-family: var(--font-mono); flex-shrink: 0; }
.tier-badge { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 4px; font-weight: 700; font-size: 12px; color: white; flex-shrink: 0; }
.tier-S { background: #D4A017; }
.tier-A { background: #27AE60; }
.tier-B { background: #2D7DD2; }
.tier-C { background: #95A5A6; }
.layer-badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; flex-shrink: 0; }
.layer-relationship { background: #E0F2F1; color: #00695C; }
.layer-operator { background: #E8EAF6; color: #283593; }
.layer-bdr { background: #FFF3E0; color: #E65100; }
.layer-newsletter { background: #F5F5F5; color: #616161; }
.prospect-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-approve { background: #27AE60; color: white; border: none; padding: 4px 12px; border-radius: 4px; cursor: pointer; font-size: 12px; transition: opacity 0.15s; }
.btn-approve:hover { opacity: 0.85; }
.btn-approve:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-skip { background: #95A5A6; color: white; border: none; padding: 4px 12px; border-radius: 4px; cursor: pointer; font-size: 12px; transition: opacity 0.15s; }
.btn-skip:hover { opacity: 0.85; }
.btn-skip:disabled { opacity: 0.5; cursor: not-allowed; }
.prospect-expand { background: var(--bg-secondary); padding: 16px 20px; margin: 0; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 16px 0; }
.pagination-info { font-size: 13px; color: var(--text-muted); font-family: var(--font-mono); }

/* ── Kanban Board ────────────────────────────────────────────── */
.kanban-board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 16px; min-height: 400px; }
.kanban-column { min-width: 220px; max-width: 280px; flex-shrink: 0; background: var(--bg-secondary); border-radius: 8px; padding: 12px; }
.kanban-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 10px; border-bottom: 2px solid var(--border); margin-bottom: 10px; }
.kanban-header h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin: 0; font-family: var(--font-mono); }
.kanban-count { background: var(--sidebar-active); color: white; border-radius: 10px; padding: 2px 8px; font-size: 11px; font-weight: 600; }
.deal-card { background: var(--bg-primary); border-radius: 6px; padding: 10px 12px; margin-bottom: 8px; border: 1px solid var(--border); cursor: pointer; transition: box-shadow 0.15s; }
.deal-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.deal-name { font-weight: 600; font-size: 14px; }
.deal-company { font-size: 12px; color: var(--text-muted); }
.deal-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 11px; }
.days-badge { color: var(--text-muted); font-family: var(--font-mono); }
.deal-expand { background: var(--bg-secondary); padding: 12px; border-radius: 0 0 6px 6px; margin-top: -1px; margin-bottom: 8px; border: 1px solid var(--border); border-top: none; }
.deal-notes textarea { width: 100%; min-height: 60px; border: 1px solid var(--border); border-radius: 4px; padding: 8px; font-size: 13px; resize: vertical; font-family: inherit; background: var(--bg-primary); }
.deal-notes textarea:focus { outline: none; border-color: var(--accent); }
.stage-dropdown { display: inline-block; position: relative; }
.stage-dropdown select { padding: 4px 8px; border-radius: 4px; border: 1px solid var(--border); font-size: 12px; cursor: pointer; background: var(--bg-primary); }
.column-collapsed .deal-card { display: none; }
.collapse-toggle { cursor: pointer; user-select: none; }

/* ── Sequences ───────────────────────────────────────────────── */
.sequence-section { margin-bottom: 24px; }
.sequence-card { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.sequence-card:last-child { border-bottom: none; }
.sequence-touch { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); flex-shrink: 0; }
.sequence-next { font-size: 12px; font-family: var(--font-mono); flex-shrink: 0; min-width: 80px; }
.sequence-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-on-track { background: #27AE60; }
.status-overdue { background: #F39C12; }
.status-paused { background: #95A5A6; }

/* ── Card: no-bg variant for kanban text ─────────────────────── */
.card-bg { background: var(--card-bg, var(--bg-primary)); }

/* ── Reply Inbox ─────────────────────────────────────────────── */
.reply-card { padding: 14px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.reply-card:hover { background: var(--bg-secondary); }
.reply-header { display: flex; align-items: center; gap: 10px; }
.sentiment-badge { padding: 2px 10px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.sentiment-positive { background: #E8F5E9; color: #2E7D32; }
.sentiment-neutral { background: #F5F5F5; color: #616161; }
.sentiment-negative { background: #FFEBEE; color: #C62828; }
.reply-sender { font-weight: 600; }
.reply-company { color: var(--text-muted); font-size: 13px; }
.reply-summary { color: var(--text-secondary, var(--text-muted)); font-size: 13px; margin-top: 4px; }
.reply-time { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.reply-expand { padding: 12px 16px; background: var(--bg-secondary); margin: 0 16px 8px; border-radius: 0 0 6px 6px; }
.reply-actions { display: flex; gap: 8px; margin-top: 10px; }
.reply-actions button { padding: 4px 12px; border-radius: 4px; border: 1px solid var(--border); background: white; cursor: pointer; font-size: 12px; }
.reply-actions button:hover { background: var(--bg-secondary); }
.note-inline-textarea { width: 100%; min-height: 60px; border: 1px solid var(--border); border-radius: 4px; padding: 8px; font-size: 13px; resize: vertical; font-family: inherit; }

/* ── Contact Detail ──────────────────────────────────────────── */
.contact-header { padding: 20px 0; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.contact-name { font-size: 24px; font-weight: 700; }
.contact-role { font-size: 14px; color: var(--text-muted); margin-top: 4px; }
.contact-badges { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.quick-actions { display: flex; gap: 8px; margin: 16px 0; }
.quick-actions button { padding: 6px 14px; border-radius: 4px; border: 1px solid var(--border); background: white; cursor: pointer; font-size: 13px; }
.quick-actions button:hover { background: var(--bg-secondary); }

/* ── Timeline ────────────────────────────────────────────────── */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 11px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline-event { position: relative; padding: 10px 0; }
.timeline-dot { position: absolute; left: -22px; top: 14px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid white; }
.dot-email { background: #2D7DD2; }
.dot-reply { background: #27AE60; }
.dot-discovery { background: #9B59B6; }
.dot-stage { background: #F39C12; }
.dot-note { background: #95A5A6; }
.dot-meeting { background: #D4A017; }
.dot-subscribed { background: #00897B; }
.timeline-date { font-size: 12px; color: var(--text-muted); }
.timeline-detail { font-size: 14px; margin-top: 2px; }
.source-badge { font-size: 10px; padding: 1px 6px; border-radius: 8px; margin-left: 8px; }
.source-content { border: 1px solid #2D7DD2; color: #2D7DD2; }
.source-sales { border: 1px solid #27AE60; color: #27AE60; }

/* ── Editable Fields ─────────────────────────────────────────── */
.contact-notes textarea { width: 100%; min-height: 80px; border: 1px solid var(--border); border-radius: 4px; padding: 10px; font-size: 13px; resize: vertical; font-family: inherit; }
.contact-notes textarea:focus { outline: none; border-color: var(--accent); }
.contact-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.tag-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 12px; background: var(--bg-secondary); font-size: 12px; }
.tag-remove { cursor: pointer; color: var(--text-muted); font-size: 14px; }
.tag-remove:hover { color: var(--danger); }
.tag-input { border: 1px solid var(--border); border-radius: 12px; padding: 3px 10px; font-size: 12px; width: 100px; }
.tag-input:focus { outline: none; border-color: var(--accent); }

/* ── Contacts Page ────────────────────────────────────────────── */
.contacts-filters { display: flex; gap: 12px; margin-bottom: 16px; align-items: center; }
.contacts-filters select, .contacts-filters input { padding: 6px 12px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; }
.contacts-filters input { flex: 1; max-width: 250px; }
.contact-link { color: var(--sidebar-active); text-decoration: none; cursor: pointer; font-weight: 500; }
.contact-link:hover { text-decoration: underline; }
.contacts-count { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }

/* ── Segments ────────────────────────────────────────────────── */
.segments-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 24px; }
.segment-card { background: var(--card-bg, var(--bg-primary)); border-radius: 8px; padding: 16px; border: 1px solid var(--border); cursor: pointer; transition: border-color 0.15s; }
.segment-card:hover { border-color: var(--sidebar-active); }
.segment-card.active { border-color: var(--sidebar-active); box-shadow: 0 0 0 1px var(--sidebar-active); }
.segment-name { font-weight: 600; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.segment-count { background: var(--sidebar-active); color: white; border-radius: 10px; padding: 2px 8px; font-size: 11px; }
.segment-desc { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Toast Notification ──────────────────────────────────────── */
.toast { position: fixed; bottom: 24px; right: 24px; background: #1A1A2E; color: white; padding: 10px 20px; border-radius: 6px; font-size: 13px; animation: fadeInOut 2s ease; z-index: 1000; }
@keyframes fadeInOut { 0% { opacity: 0; transform: translateY(10px); } 10% { opacity: 1; transform: translateY(0); } 80% { opacity: 1; } 100% { opacity: 0; } }
