/* Campaign Analytics — AI Marketing Operating System */

.mkt-page-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.mkt-module-body {
  flex: 1;
}

/* Toast */
.mkt-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.8125rem;
  color: #fff;
  background: #0f172a;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  max-width: 360px;
}
.mkt-toast.show {
  opacity: 1;
  transform: translateY(0);
}
.mkt-toast-success { background: #166534; }
.mkt-toast-error { background: #991b1b; }

/* OS Workspace — token-driven card layout (was flat full-bleed bands separated by
   hairlines, which read a design generation behind the token-driven Prospect /
   Executive modules). Each section is now an elevated rounded card on a surface. */
.mkt-os-workspace {
  display: flex;
  flex-direction: column;
  gap: var(--space-5, 20px);
  background: var(--color-surface, #f8fafc);
  padding: var(--space-6, 24px);
  max-width: var(--content-max-width, 1440px);
  margin: 0 auto;
}

.mkt-os-section {
  background: var(--color-white, #fff);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: var(--radius-xl, 16px);
  box-shadow: var(--shadow-xs, 0 1px 2px rgba(0, 0, 0, 0.04));
  padding: var(--space-5, 20px) var(--space-6, 24px);
}

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

.mkt-os-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
}

.mkt-os-section-head .mkt-os-title {
  margin-bottom: 0;
}

.mkt-os-label {
  display: block;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
  margin-bottom: 2px;
}

.mkt-os-project-select {
  min-width: 240px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.875rem;
  background: #fff;
}

/* Section 1 — Project Context */
.mkt-os-context-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px 20px;
}

.mkt-os-context-item strong {
  display: block;
  font-size: 0.875rem;
  color: #0f172a;
  font-weight: 600;
}

/* Enterprise Search */
.mkt-os-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  margin-bottom: 12px;
}

.mkt-os-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.8125rem;
  outline: none;
}

/* Section 2 — Campaign Explorer */
.mkt-os-explorer-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.mkt-os-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 120px;
}

.mkt-os-field span {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
}

.mkt-os-field input,
.mkt-os-field select {
  height: 34px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.8125rem;
  background: #fff;
}

.mkt-os-campaign-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 420px;
  overflow-y: auto;
}

.mkt-os-campaign-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.mkt-os-campaign-row:hover {
  border-color: #93c5fd;
  background: #f8fafc;
}

.mkt-os-campaign-row.active {
  border-color: #2563eb;
  background: #eff6ff;
}

.mkt-os-camp-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #0f172a;
}

.mkt-os-camp-meta {
  font-size: 0.6875rem;
  color: #475569;
}

/* Main grid: explorer + executive */
.mkt-os-main-grid {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  gap: 0;
  border-bottom: 1px solid #e2e8f0;
}

.mkt-os-col--left {
  border-right: 1px solid #e2e8f0;
}

.mkt-os-col--left .mkt-os-section {
  border-bottom: none;
  height: 100%;
}

.mkt-os-col--right {
  display: flex;
  flex-direction: column;
}

.mkt-os-col--right .mkt-os-section {
  flex: 1;
}

/* Section 3 — Executive Summary */
.mkt-os-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.mkt-os-kpi-card {
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.mkt-os-kpi-value {
  display: block;
  font-size: 1.125rem;
  font-weight: 700;
  color: #0f172a;
  margin-top: 4px;
}

/* Section 4 — Campaign Intelligence */
.mkt-os-insight-grid-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.mkt-os-insight-card {
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
}

.mkt-os-insight-card--high {
  border-left: 3px solid #dc2626;
}

.mkt-os-insight-card--medium {
  border-left: 3px solid #d97706;
}

.mkt-os-insight-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.mkt-os-insight-type {
  font-size: 0.875rem;
  font-weight: 600;
  color: #0f172a;
}

.mkt-os-insight-priority {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #475569;
}

.mkt-os-insight-campaign {
  font-size: 0.75rem;
  color: #475569;
  margin: 0 0 10px;
}

.mkt-os-insight-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.mkt-os-insight-why,
.mkt-os-insight-roi {
  font-size: 0.75rem;
  color: #334155;
  margin: 6px 0;
  line-height: 1.45;
}

.mkt-os-insight-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

/* Section 5 — Comparison */
.mkt-os-compare-pickers {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 16px;
}

.mkt-os-vs {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #475569;
  padding-bottom: 8px;
}

.mkt-os-compare-table-wrap {
  overflow-x: auto;
}

.mkt-os-compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.mkt-os-compare-table th,
.mkt-os-compare-table td {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  text-align: left;
}

.mkt-os-compare-table th {
  background: #f8fafc;
  font-weight: 600;
}

.mkt-os-winner {
  font-weight: 600;
  color: #166534;
}

.mkt-os-compare-winner,
.mkt-os-compare-ai {
  font-size: 0.8125rem;
  margin: 10px 0 0;
  color: #334155;
}

/* Section 6 — Timeline */
.mkt-os-timeline-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mkt-os-timeline-item {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.8125rem;
  align-items: center;
}

.mkt-os-timeline-item[data-type="ai_applied"] {
  border-left: 3px solid #7c3aed;
  background: #faf5ff;
}

.mkt-os-timeline-label {
  font-weight: 600;
  color: #0f172a;
}

.mkt-os-timeline-summary {
  color: #475569;
}

.mkt-os-timeline-time {
  font-size: 0.6875rem;
  color: #475569;
  white-space: nowrap;
}

/* Advanced Filters */
.mkt-os-advanced {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}

.mkt-os-advanced-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  list-style: none;
}

.mkt-os-advanced-summary::-webkit-details-marker {
  display: none;
}

.mkt-os-advanced-body {
  padding: 0 24px 16px;
}

.mkt-os-advanced-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.mkt-os-channels {
  margin-bottom: 12px;
}

.mkt-os-channel-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.mkt-os-channel-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  background: #f8fafc;
}

.mkt-os-channel-chip:has(input:checked) {
  border-color: #2563eb;
  background: #eff6ff;
}

/* Export bar */
.mkt-os-export-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}

.mkt-export-soon-note {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: #475569;
  cursor: default;
}

.mkt-os-empty {
  font-size: 0.8125rem;
  color: #475569;
  margin: 0;
}

/* Legacy filter panel (reports, settings) */
.mkt-filter-panel {
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  border-bottom: 1px solid #e2e8f0;
  padding: 16px 24px;
}

.mkt-filter-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.mkt-filter-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #0f172a;
}

.mkt-filter-hint {
  font-size: 0.75rem;
  color: #475569;
}

.mkt-filter-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mkt-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.mkt-filter-row--secondary {
  align-items: center;
}

.mkt-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 120px;
}

.mkt-field--grow {
  flex: 1 1 200px;
}

.mkt-field span {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
}

.mkt-field input,
.mkt-field select {
  height: 34px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.8125rem;
  background: #fff;
}

.mkt-field--check {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding-bottom: 4px;
}

.mkt-field--check input {
  width: auto;
  height: auto;
}

.mkt-field--check span {
  text-transform: none;
  font-size: 0.8125rem;
  letter-spacing: 0;
}

.mkt-apply-btn {
  align-self: flex-end;
}

.mkt-filter-active {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.mkt-filter-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.6875rem;
  font-weight: 500;
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

.mkt-filter-chip--muted {
  background: #f1f5f9;
  color: #475569;
  border-color: #e2e8f0;
}

@media (max-width: 1024px) {
  .mkt-os-main-grid {
    grid-template-columns: 1fr;
  }
  .mkt-os-col--left {
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
  }
}

@media (max-width: 768px) {
  .mkt-os-section { padding: 16px; }
  .mkt-os-advanced-summary,
  .mkt-os-export-bar { padding-left: 16px; padding-right: 16px; }
  .mkt-os-timeline-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .mkt-filter-panel { padding: 12px 16px; }
}
/* Sprint 8 — demo-data quarantine banner (constitution: never mix demo data with production) */
.mkt-demo-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 16px 0;
  padding: 10px 14px;
  border: 1px solid #FCD34D;
  background: #FFFBEB;
  border-radius: 10px;
  font-size: 13px;
  color: #92400E;
}
.mkt-demo-banner i { flex-shrink: 0; margin-top: 1px; }

/* Real (non-seed) project banner — same shape as the demo banner, distinct
   green/honest tone so the two states are never visually confusable. */
.mkt-demo-banner--real {
  border-color: var(--color-success-300, #86EFAC);
  background: var(--color-success-50, #ECFDF5);
  color: var(--color-success-800, #065F46);
}

/* New Project / Add Campaign inline forms */
.mkt-os-project-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mkt-os-form {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
}

.mkt-os-form-title {
  margin: 0 0 12px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #0f172a;
}

.mkt-os-form-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.mkt-os-form-grid .mkt-os-field { min-width: 160px; flex: 1; }

.mkt-os-form-error {
  margin: 0 0 10px;
  font-size: 0.75rem;
  color: var(--color-danger-700, #B91C1C);
}

.mkt-os-form-actions {
  display: flex;
  gap: 8px;
}

.mkt-os-campaign-row-wrap {
  display: flex;
  align-items: stretch;
  gap: 4px;
}

.mkt-os-campaign-row-wrap .mkt-os-campaign-row { flex: 1; }

.mkt-os-campaign-delete {
  flex: none;
  width: 32px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mkt-os-campaign-delete:hover {
  border-color: var(--color-danger-300, #FCA5A5);
  color: var(--color-danger-600, #DC2626);
  background: var(--color-danger-50, #FEF2F2);
}

/* ── Free-first ingestion: source-tier provenance badges (Sprint 1) ──
   Public = live/green, User Connected = verified/blue, Enterprise = pending/amber.
   Small, non-clutter chips that declare where each marketing datapoint came from. */
.mkt-source-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
  border: 1px solid transparent; white-space: nowrap;
}
.mkt-source-badge--public {
  color: var(--color-success-700, #047857);
  background: var(--color-success-50, #ecfdf5);
  border-color: var(--color-success-200, #a7f3d0);
}
.mkt-source-badge--user-connected {
  color: var(--color-primary-700, #1d4ed8);
  background: var(--color-primary-50, #eff6ff);
  border-color: var(--color-primary-200, #bfdbfe);
}
.mkt-source-badge--enterprise-connector {
  color: var(--color-warning-700, #b45309);
  background: var(--color-warning-50, #fffbeb);
  border-color: var(--color-warning-200, #fde68a);
}
