/* ─── Charlie Dashboard — Brand CSS ─── */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=DM+Serif+Display&display=swap');

:root {
  --cream: #FFFDF7;
  --cream-dark: #F7F3EB;
  --green: #2D6A4F;
  --green-light: #40916C;
  --green-dark: #1B4332;
  --text: #1a1a1a;
  --text-secondary: #666;
  --text-muted: #999;
  --border: #e5e0d8;
  --white: #ffffff;
  --red: #d44;
  --yellow: #e8a817;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--cream);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

h1, h2, h3 { font-family: 'DM Serif Display', Georgia, serif; font-weight: 400; }

/* ─── Layout ─── */

.page-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.page-wrap.wide {
  max-width: 880px;
}

/* ─── Logo ─── */

.logo {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 28px;
  color: var(--text);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 32px;
}

.logo span { color: var(--green); }

/* ─── Cards ─── */

.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.card h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

.card p.subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}

/* ─── Forms ─── */

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.2s;
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--green);
}

textarea { resize: vertical; min-height: 100px; }

.input-group {
  margin-bottom: 16px;
}

.input-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.input-row input { flex: 1; }

.input-suffix {
  display: flex;
  align-items: center;
}

.input-suffix input {
  border-radius: var(--radius) 0 0 var(--radius);
  border-right: none;
}

.input-suffix span {
  padding: 12px 14px;
  background: var(--cream-dark);
  border: 1.5px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ─── Buttons ─── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--green);
  color: var(--white);
}

.btn-primary:hover { background: var(--green-dark); }

.btn-secondary {
  background: var(--cream-dark);
  color: var(--text);
}

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

.btn-outline {
  background: transparent;
  color: var(--green);
  border: 1.5px solid var(--green);
}

.btn-outline:hover {
  background: var(--green);
  color: var(--white);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.btn-block { width: 100%; justify-content: center; }

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

/* ─── Steps / Stepper ─── */

.stepper {
  display: flex;
  gap: 8px;
  margin-bottom: 32px;
}

.stepper .step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  transition: all 0.3s;
}

.stepper .step-dot.active {
  background: var(--green);
  transform: scale(1.2);
}

.stepper .step-dot.done {
  background: var(--green-light);
}

.step-section {
  display: none;
  animation: fadeIn 0.3s ease;
}

.step-section.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Charlie email display ─── */

.charlie-email-display {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--cream-dark);
  border-radius: var(--radius);
  margin: 16px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--green-dark);
  word-break: break-all;
}

.charlie-email-display .icon {
  font-size: 24px;
  flex-shrink: 0;
}

/* ─── WhatsApp button ─── */

.btn-whatsapp {
  background: #25D366;
  color: white;
  font-size: 16px;
  padding: 14px 28px;
}

.btn-whatsapp:hover { background: #1fbe59; }

/* ─── Status badges ─── */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-pending { background: #FEF3C7; color: #92400E; }
.badge-generating { background: #DBEAFE; color: #1E40AF; }
.badge-preview { background: #D1FAE5; color: #065F46; }
.badge-approved { background: var(--green); color: white; }
.badge-active { background: var(--green); color: white; }
.badge-onboarding { background: #FEF3C7; color: #92400E; }
.badge-connected { background: #D1FAE5; color: #065F46; }
.badge-disconnected { background: #FEE2E2; color: #991B1B; }

/* ─── Dashboard layout ─── */

.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.dash-header h1 { font-size: 28px; }

.dash-header .meta {
  text-align: right;
  font-size: 13px;
  color: var(--text-secondary);
}

.dash-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1.5px solid var(--border);
  margin-bottom: 24px;
}

.dash-tab {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
}

.dash-tab:hover { color: var(--text); }
.dash-tab.active {
  color: var(--green);
  border-bottom-color: var(--green);
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

/* ─── Campaign history table ─── */

.briefs-table {
  width: 100%;
  border-collapse: collapse;
}

.briefs-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1.5px solid var(--border);
}

.briefs-table td {
  padding: 12px;
  font-size: 14px;
  border-bottom: 1px solid var(--cream-dark);
}

.briefs-table tr:hover td { background: var(--cream-dark); }

/* ─── Connection status ─── */

.connection-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--cream-dark);
}

.connection-row:last-child { border-bottom: none; }

.connection-info h3 {
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
}

.connection-info p {
  font-size: 13px;
  color: var(--text-muted);
}

/* ─── Alerts ─── */

.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 16px;
}

.alert-success { background: #D1FAE5; color: #065F46; }
.alert-error { background: #FEE2E2; color: #991B1B; }
.alert-info { background: #DBEAFE; color: #1E40AF; }

/* ─── Misc ─── */

.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

/* ─── Brief cards (Campaigns tab) ─── */

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

.brief-card {
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  overflow: hidden;
  transition: box-shadow 0.2s;
  border-left: 4px solid transparent;
}

.brief-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

/* Status color bars */
.brief-card[data-status="pending"],
.brief-card[data-status="generating"],
.brief-card[data-status="revision"] {
  border-left-color: var(--yellow);
}

.brief-card[data-status="preview"] {
  border-left-color: var(--green);
}

.brief-card[data-status="approved"] {
  border-left-color: var(--green-dark);
}

.brief-card[data-status="error"] {
  border-left-color: var(--red);
}

/* Card header */
.brief-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px 0;
}

/* Status pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.status-pill::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-pill-pending {
  background: #FEF3C7;
  color: #92400E;
}
.status-pill-pending::before { background: var(--yellow); }

.status-pill-preview {
  background: #D1FAE5;
  color: #065F46;
}
.status-pill-preview::before { background: var(--green); }

.status-pill-approved {
  background: var(--green);
  color: white;
}
.status-pill-approved::before { background: rgba(255,255,255,0.5); }

.status-pill-error {
  background: #FEE2E2;
  color: #991B1B;
}
.status-pill-error::before { background: var(--red); }

/* Timestamp */
.brief-card-time {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Card body */
.brief-card-body {
  padding: 12px 20px 14px;
  cursor: pointer;
}

.brief-card-text {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Campaign card — subject_line as title, brief_text as muted snippet */
.brief-card-title {
  margin: 0 0 4px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brief-card-snippet {
  margin: 0 0 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brief-card-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.brief-source-badge,
.brief-type-badge,
.brief-attach-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  background: var(--cream-dark);
  color: var(--text-secondary);
  letter-spacing: 0.1px;
}

/* Actions */
.brief-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 20px 18px;
  flex-wrap: wrap;
}

.brief-card-actions .btn-sm {
  padding: 8px 18px;
  font-size: 13px;
}

.brief-processing-label {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

.brief-pushed-label {
  font-size: 13px;
  color: var(--green);
  font-weight: 600;
}

/* Expandable edit */
.brief-card-expand {
  padding: 0 20px 20px;
  animation: fadeIn 0.2s ease;
}

.brief-card-expand .divider {
  margin: 0 0 16px;
}

/* ─── Version history accordion ─── */

.brief-card-history {
  padding: 0 20px 14px;
  border-top: 1px solid var(--cream-dark);
  margin: 0 20px;
  padding: 12px 0 14px;
}

.history-toggle {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
}

.history-toggle:hover {
  color: var(--green);
}

.history-entries {
  margin-top: 10px;
  border-left: 2px solid var(--border);
  padding-left: 14px;
  animation: fadeIn 0.2s ease;
}

.history-entry {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 5px 0;
  font-size: 13px;
  line-height: 1.5;
  flex-wrap: wrap;
}

.history-version {
  font-weight: 700;
  color: var(--green);
  flex-shrink: 0;
  min-width: 24px;
}

.history-note {
  color: var(--text);
  flex: 1;
  min-width: 0;
}

.history-time {
  color: var(--text-muted);
  font-size: 11px;
  flex-shrink: 0;
}

.history-link {
  color: var(--green);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.history-link:hover {
  text-decoration: underline;
}

/* ─── Brand Kit ─── */

.brand-logo-grid {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.brand-logo-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 120px;
}

.brand-logo-preview {
  display: flex;
  gap: 4px;
}

.brand-logo-thumb {
  width: 80px;
  height: 52px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--border);
}

.brand-logo-thumb img {
  max-width: 72px;
  max-height: 44px;
  object-fit: contain;
}

.brand-logo-thumb-light {
  background: var(--cream-dark);
}

.brand-logo-thumb-dark {
  background: #1a1a1a;
}

.brand-logo-upload-btn {
  width: 100%;
  justify-content: center;
}

.brand-logo-label {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* Brand colors */
.brand-color-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.brand-color-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 72px;
}

.brand-color-picker {
  width: 48px;
  height: 48px;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  cursor: pointer;
  background: none;
}

.brand-color-picker::-webkit-color-swatch-wrapper { padding: 0; }
.brand-color-picker::-webkit-color-swatch { border: none; border-radius: 5px; }
.brand-color-picker::-moz-color-swatch { border: none; border-radius: 5px; }

.brand-color-hex {
  width: 72px !important;
  padding: 4px 6px !important;
  font-size: 12px !important;
  text-align: center;
  font-family: monospace;
}

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

.brand-color-add {
  width: 48px;
  height: 48px;
  border: 2px dashed var(--border);
  border-radius: 8px;
  background: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
  font-family: inherit;
}

.brand-color-add:hover {
  border-color: var(--green);
  color: var(--green);
}

/* ─── Chat widget ─── */

.cc-container {
  display: flex;
  flex-direction: column;
  height: 520px;
  background: var(--white);
  border-radius: var(--radius-lg);
}

/* Brief label (shown when continuing a campaign) */
.cc-brief-label {
  padding: 8px 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
  background: rgba(45,106,79,0.06);
  border-bottom: 1px solid var(--cream-dark);
  letter-spacing: 0.3px;
}

.cc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cc-msg {
  display: flex;
  flex-direction: column;
}

.cc-msg-bubble {
  max-width: 82%;
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}

.cc-msg-assistant {
  background: #f5f3ee;
  color: #1a1a1a;
  align-self: flex-start;
  border-radius: 16px 16px 16px 4px;
}

.cc-msg-user {
  background: #d4e5d9;
  color: #1a1a1a;
  align-self: flex-end;
  border-radius: 16px 16px 4px 16px;
}

/* Typing indicator */
.cc-typing {
  display: flex;
  gap: 5px;
  padding: 16px 20px;
}

.cc-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green-light);
  animation: ccBounce 1.2s infinite;
}

.cc-typing span:nth-child(2) { animation-delay: 0.2s; }
.cc-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes ccBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Input row: [textarea] [mic] [send] */
.cc-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--cream-dark);
}

.cc-input {
  flex: 1;
  border: 1.5px solid var(--green-light);
  border-radius: 24px;
  padding: 11px 18px;
  font-family: inherit;
  font-size: 14px;
  resize: none;
  outline: none;
  max-height: 120px;
  line-height: 1.4;
  background: var(--white);
  color: var(--text);
}

.cc-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(45,106,79,0.08); }

/* Voice button — circular, right side, matching send */
.cc-voice-btn {
  width: 42px;
  height: 42px;
  border: 1.5px solid var(--green-light);
  border-radius: 50%;
  background: var(--white);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
  position: relative;
  overflow: hidden;
}

.cc-voice-btn:hover { border-color: var(--green); background: rgba(45,106,79,0.04); }

/* Voice icon (SVG mic injected by JS, fallback emoji hidden) */
.cc-voice-btn svg { width: 20px; height: 20px; }
.cc-voice-btn svg path { fill: var(--green); }

/* Recording state — animated sound waves */
.cc-recording {
  background: var(--green) !important;
  border-color: var(--green) !important;
  transform: scale(1.05);
}

.cc-recording svg path { fill: #fff !important; }

.cc-recording::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--green);
  animation: ccWaveRing 1.2s ease-out infinite;
}

.cc-recording::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1.5px solid var(--green);
  animation: ccWaveRing 1.2s ease-out 0.3s infinite;
}

@keyframes ccWaveRing {
  0% { transform: scale(0.8); opacity: 0.6; }
  100% { transform: scale(1.4); opacity: 0; }
}

/* Send button — circular, green filled */
.cc-send-btn {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
}

.cc-send-btn svg { width: 18px; height: 18px; }
.cc-send-btn svg path { fill: #fff; }

.cc-send-btn:hover { background: var(--green-dark); transform: scale(1.05); }
.cc-send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* Attach button (paperclip) — sits left of send */
.cc-attach-btn {
  width: 40px;
  height: 40px;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
}
.cc-attach-btn:hover { border-color: var(--green); background: rgba(45,106,79,0.04); }

/* Attachment thumbnail preview row.
   MUST stay a thin strip: small square thumb + filename + remove-x.
   Constraints marked !important so any late-cascading img { width: 100% }
   rule from other dashboard contexts can't blow up the preview. */
.cc-attach-preview {
  display: flex !important;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--cream-dark, #F7F3EB);
  border: 1px solid var(--border);
  margin: 0 12px 8px;
  font-size: 13px;
  max-height: 60px;
  overflow: hidden;
  box-sizing: border-box;
}
.cc-attach-preview img {
  width: 48px !important;
  height: 48px !important;
  max-width: 48px !important;
  max-height: 48px !important;
  object-fit: cover !important;
  border-radius: 6px !important;
  flex-shrink: 0 !important;
  display: block !important;
}
.cc-attach-preview .cc-attach-spinner {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  border: 2px solid var(--border);
  border-top-color: var(--green);
  animation: cc-spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes cc-spin { to { transform: rotate(360deg); } }
.cc-attach-preview .cc-attach-meta {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}
.cc-attach-preview .cc-attach-name {
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cc-attach-preview .cc-attach-status {
  font-size: 12px;
  color: var(--text-muted);
}
.cc-attach-preview .cc-attach-x {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  flex-shrink: 0;
}
.cc-attach-preview .cc-attach-x:hover { color: #B91C1C; }
.cc-attach-preview .cc-attach-err {
  color: #B91C1C;
  font-weight: 500;
  flex: 1 1 auto;
}

/* Brief card in chat */
.cc-brief-card {
  background: var(--cream-dark);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-top: 8px;
  max-width: 85%;
}

.cc-brief-header {
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--green);
  margin-bottom: 10px;
}

.cc-brief-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
}

.cc-brief-row span { color: var(--text-muted); }
.cc-brief-row strong { color: var(--text); text-align: right; max-width: 60%; }

.cc-generate-btn {
  margin-top: 12px;
}

/* Designing state */
.cc-designing {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #666;
  font-style: italic;
}

.cc-designing-dot {
  width: 10px;
  height: 10px;
  background: var(--green-light);
  border-radius: 50%;
  flex-shrink: 0;
  animation: ccDesignPulse 1.5s ease-in-out infinite;
}

@keyframes ccDesignPulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

.cc-preview-link {
  display: inline-block;
  margin-top: 8px;
  padding: 12px 24px;
  background: var(--green);
  color: #fff !important;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  transition: background 0.15s;
}

.cc-preview-link:hover {
  background: var(--green-dark);
}

/* ─── Brand preview card ─── */

.brand-preview-card {
  border: 1.5px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.brand-preview-hero {
  padding: 28px 24px;
  background: var(--cream-dark);
  text-align: center;
  transition: all 0.3s;
}

.brand-preview-logo {
  max-height: 36px;
  max-width: 160px;
  margin-bottom: 16px;
}

.brand-preview-logo-placeholder {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 24px;
  margin-bottom: 16px;
  color: var(--text);
}

.brand-preview-headline {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 22px;
  margin-bottom: 8px;
  transition: all 0.3s;
}

.brand-preview-body {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  transition: all 0.3s;
}

.brand-preview-cta {
  display: inline-block;
  padding: 10px 24px;
  background: var(--green);
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s;
}

.brand-preview-swatches {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.brand-preview-swatch {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

/* ─── Badge additions ─── */

.badge-error { background: #FEE2E2; color: #991B1B; }
.badge-revision { background: #FEF3C7; color: #92400E; }

/* ─── Responsive ─── */

@media (max-width: 768px) {
  .page-wrap { padding: 24px 16px 60px; }
  .card { padding: 24px 16px; }

  /* Header: single row, logo left, account right */
  .dash-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0;
    margin-bottom: 20px;
  }
  .dash-header .meta {
    text-align: right;
    font-size: 13px;
  }
  .dash-header .meta-email {
    display: none;
  }

  /* Tabs: horizontal scroll, no truncation */
  .dash-tabs {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .dash-tabs::-webkit-scrollbar { display: none; }
  .dash-tab {
    flex-shrink: 0;
    font-size: 13px;
    padding: 10px 10px;
    white-space: nowrap;
  }

  /* Forms */
  .input-row { flex-direction: column; }

  /* Campaign cards */
  .brief-cards { gap: 12px; }
  .brief-card-head { padding: 14px 16px 0; }
  .brief-card-body { padding: 10px 16px 12px; }

  /* Action buttons: stack vertically, full width */
  .brief-card-actions {
    padding: 2px 16px 16px;
    gap: 8px;
    flex-direction: column;
  }
  .brief-card-actions .btn-sm {
    width: 100%;
    justify-content: center;
    padding: 10px 14px;
    font-size: 14px;
  }
  .brief-card-actions .brief-processing-label,
  .brief-card-actions .brief-pushed-label {
    text-align: center;
    width: 100%;
  }

  /* Version history */
  .brief-card-history { margin: 0 16px; }
  .history-entry { font-size: 12px; }
  .brief-card-expand { padding: 0 16px 16px; }

  /* Setup banner: stack vertically */
  #setup-banner { flex-direction: column; align-items: flex-start !important; }
  #setup-banner span:last-child { margin-left: 0 !important; margin-top: 8px; }

  /* Chat widget */
  .cc-container { height: 460px; }
  .cc-msg-bubble { max-width: 92%; }

  /* Connection rows */
  .connection-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .brand-logo-grid { gap: 10px; }
  .brand-logo-slot { min-width: 100px; }
  .brand-color-grid { gap: 8px; }
  .brand-color-slot { min-width: 60px; }
  .brand-color-picker { width: 40px; height: 40px; }
  .brand-color-hex { width: 64px !important; }
}
