/* ============================================================
   AI Advisory Panel — Coastal Professional Design System
   ============================================================ */

:root {
  --bg: #F5F3EF;
  --card-bg: #FFFFFF;
  --accent: #2563EB;
  --accent-hover: #1D4ED8;
  --accent-light: #EFF6FF;
  --accent-border: #BFDBFE;
  --text-primary: #1A1A1A;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --border: #E5E7EB;
  --border-light: #F3F4F6;
  --success: #059669;
  --error: #DC2626;
  --error-bg: #FEF2F2;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.06), 0 4px 6px rgba(0,0,0,0.04);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-full: 9999px;
  --transition: 200ms ease;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* --- Layout --- */
.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* --- Header --- */
.site-header {
  padding: 1.5rem 0 0;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.header-logo {
  height: 40px;
  width: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
}

.header-brand {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* --- Executive Badge --- */
.exec-badge {
  display: none;
  align-items: center;
  gap: 0.3125rem;
  margin-left: auto;
  padding: 0.3125rem 0.625rem 0.3125rem 0.5rem;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
}

.exec-badge svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.exec-badge.visible {
  display: inline-flex;
}

/* --- Hero --- */
.hero {
  text-align: center;
  padding: 2.5rem 0 2rem;
}

.hero-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.025em;
  line-height: 1.25;
  margin-bottom: 0.625rem;
}

.hero-subtitle {
  font-size: 1.0625rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.5;
}

/* --- Welcome Section (member tool mode) --- */
.welcome-section {
  text-align: center;
  max-width: 640px;
  margin: 0 auto;
  padding: 0.5rem 1rem 2rem;
}

.welcome-heading {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 0.875rem;
}

.welcome-body {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.65;
  white-space: pre-line;
}

/* --- Advisor Mode Grid --- */
.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.875rem;
  margin-bottom: 2rem;
}

.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.5rem 1rem;
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.mode-btn:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.mode-btn.active {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: var(--shadow);
}

.mode-btn-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--border-light);
  color: var(--text-secondary);
  transition: all var(--transition);
}

.mode-btn.active .mode-btn-icon {
  background: var(--accent);
  color: #fff;
}

.mode-btn-icon svg {
  width: 20px;
  height: 20px;
}

.mode-btn-label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.mode-btn-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Collapsed state — after selection, non-active buttons shrink */
.mode-grid.collapsed {
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.mode-grid.collapsed .mode-btn {
  padding: 0.75rem 0.5rem;
}

.mode-grid.collapsed .mode-btn-desc {
  display: none;
}

.mode-grid.collapsed .mode-btn-icon {
  width: 28px;
  height: 28px;
}

.mode-grid.collapsed .mode-btn-icon svg {
  width: 16px;
  height: 16px;
}

.mode-grid.collapsed .mode-btn-label {
  font-size: 0.8125rem;
}

/* --- Input Section --- */
.input-section {
  display: none;
  margin-bottom: 2rem;
}

.input-section.visible {
  display: block;
  animation: fadeSlideIn 300ms ease;
}

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

/* --- Guided Prompts --- */
.guided-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.prompt-chip {
  display: inline-block;
  padding: 0.4375rem 0.875rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  line-height: 1.4;
}

.prompt-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

/* --- Textarea & Submit --- */
.input-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.input-textarea {
  width: 100%;
  min-height: 110px;
  padding: 1rem 1.125rem;
  border: none;
  outline: none;
  resize: vertical;
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--text-primary);
  line-height: 1.6;
  background: transparent;
}

.input-textarea::placeholder {
  color: var(--text-muted);
}

.input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 1.125rem;
  border-top: 1px solid var(--border-light);
}

.char-count {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5625rem 1.25rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.submit-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

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

.submit-btn svg {
  width: 16px;
  height: 16px;
}

/* --- Output Section --- */
.output-section {
  display: none;
  margin-bottom: 2rem;
}

.output-section.visible {
  display: block;
  animation: fadeSlideIn 300ms ease;
}

.output-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.125rem;
  border-bottom: 1px solid var(--border-light);
}

.output-mode-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.output-actions {
  display: flex;
  gap: 0.375rem;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.action-btn.copied {
  border-color: var(--success);
  color: var(--success);
}

.action-btn svg {
  width: 14px;
  height: 14px;
}

.output-body {
  padding: 1.25rem 1.125rem;
}

/* Output content formatting */
.output-body h2 {
  display: none; /* Hidden — we use strong labels */
}

.output-body strong {
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 1.25rem;
  margin-bottom: 0.375rem;
  letter-spacing: -0.01em;
}

.output-body strong:first-child,
.output-body p:first-child strong {
  margin-top: 0;
}

.output-body p {
  font-size: 0.9375rem;
  color: var(--text-primary);
  line-height: 1.65;
  margin-bottom: 0.625rem;
}

.output-body ol,
.output-body ul {
  margin: 0.375rem 0 0.75rem 1.25rem;
  font-size: 0.9375rem;
  line-height: 1.65;
}

.output-body li {
  margin-bottom: 0.375rem;
}

.output-body li strong {
  display: inline;
  margin: 0;
  font-size: inherit;
}

/* --- Generated Image (executive mode) --- */
.image-output {
  border-top: 1px solid var(--border-light);
  padding: 1.25rem 1.125rem;
}

.image-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 0;
  gap: 0.75rem;
}

.image-loading .loading-dots {
  display: inline-flex;
  gap: 0.375rem;
}

.image-loading .loading-dots span {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: dotPulse 1.4s ease-in-out infinite;
}

.image-loading .loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.image-loading .loading-dots span:nth-child(3) { animation-delay: 0.4s; }

.image-loading .loading-text {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.image-result img {
  display: block;
  max-width: 100%;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  margin-bottom: 0.875rem;
}

.image-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.image-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.4375rem 0.875rem;
  background: transparent;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.image-download-btn:hover {
  background: var(--accent);
  color: #fff;
}

.image-download-btn svg {
  width: 14px;
  height: 14px;
}

.image-error {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-style: italic;
}

.image-brief {
  padding: 1rem 1.25rem;
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
  border-radius: 0.5rem;
}
.image-brief-title {
  margin-bottom: 0.375rem;
  font-size: 0.875rem;
}
.image-brief-intro {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}
.image-brief-desc {
  font-size: 0.8125rem;
  color: var(--text-primary);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  line-height: 1.6;
  font-style: italic;
}
.image-brief-tip {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0;
}

/* --- Hide "Ask another question" buttons — replaced by always-visible input --- */
#chat-another-btn,
#another-question-btn {
  display: none !important;
}

/* --- Follow-Up Mode (input card after first response) --- */
.input-card.follow-up-mode {
  border-left: 3px solid var(--accent);
  position: relative;
}

.new-convo-link {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.375rem 0;
  margin-bottom: 0.5rem;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.new-convo-link:hover {
  color: var(--accent);
}

/* --- Loading State --- */
.loading-indicator {
  display: none;
  padding: 2.5rem 1.125rem;
  text-align: center;
}

.loading-indicator.visible {
  display: block;
}

.loading-dots {
  display: inline-flex;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: dotPulse 1.4s ease-in-out infinite;
}

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

@keyframes dotPulse {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1); }
}

.loading-text {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* --- Error State --- */
.error-banner {
  display: none;
  padding: 0.875rem 1.125rem;
  background: var(--error-bg);
  border: 1px solid #FECACA;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--error);
}

.error-banner.visible {
  display: block;
  animation: fadeSlideIn 300ms ease;
}

/* --- CTA Section --- */
.cta-section {
  display: none;
  margin-bottom: 2rem;
}

.cta-section.visible {
  display: block;
}

.cta-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
}

.cta-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.cta-body {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 1rem;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.cta-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6875rem 1.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition);
}

.cta-button:hover {
  background: var(--accent-hover);
}

.cta-button svg {
  width: 16px;
  height: 16px;
}

/* --- Member CTA — toned down, no card --- */
.cta-section.cta-member .cta-card {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 1rem 0;
}

.cta-section.cta-member .cta-title {
  font-size: 0.9375rem;
  font-weight: 600;
}

.cta-section.cta-member .cta-body {
  font-size: 0.8125rem;
  margin-bottom: 0.875rem;
}

.cta-section.cta-member .cta-button {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  font-size: 0.8125rem;
  padding: 0.5rem 1.125rem;
}

.cta-section.cta-member .cta-button:hover {
  background: var(--accent);
  color: #fff;
}

.cta-section.cta-member .cta-button svg {
  width: 14px;
  height: 14px;
}

/* --- Executive CTA — subtle footer line --- */
.exec-cta {
  display: none;
  text-align: center;
  padding: 0.5rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.exec-cta.visible {
  display: block;
}

.exec-cta a {
  color: var(--accent);
  text-decoration: none;
}

.exec-cta a:hover {
  text-decoration: underline;
}

/* --- Advisor Tool Selector Cards (member mode) --- */
.advisor-tools {
  display: none;
  margin-bottom: 2rem;
}

.advisor-tools.visible {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  animation: fadeSlideIn 300ms ease;
}

.advisor-tool-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.25rem;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
  text-align: left;
  font-family: inherit;
}

.advisor-tool-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.advisor-tool-card.selected {
  border-color: var(--accent);
  border-left-width: 3px;
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-md);
}

.advisor-tool-card.dimmed {
  opacity: 0.5;
  transform: scale(0.98);
}

.advisor-tool-card.dimmed:hover {
  opacity: 0.7;
  transform: scale(0.99);
}

.advisor-tool-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  color: var(--accent);
  margin-bottom: 0.75rem;
  transition: all var(--transition);
}

.advisor-tool-card.selected .advisor-tool-icon {
  background: var(--accent);
  color: #fff;
}

.advisor-tool-icon svg {
  width: 18px;
  height: 18px;
}

.advisor-tool-name {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.375rem;
  letter-spacing: -0.01em;
}

.advisor-tool-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0.875rem;
  flex: 1;
}

.advisor-tool-action {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  pointer-events: none;
}

.advisor-tool-action svg {
  width: 14px;
  height: 14px;
  transition: transform var(--transition);
}

.advisor-tool-card:hover .advisor-tool-action svg {
  transform: translateX(2px);
}

/* --- Member Reset (tool mode) --- */
.member-reset {
  display: none;
  text-align: center;
  margin-bottom: 1rem;
  gap: 0.75rem;
}

.member-reset.visible {
  display: flex;
  justify-content: center;
  animation: fadeSlideIn 300ms ease;
}

.member-reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5625rem 1.125rem;
  background: transparent;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  transition: all var(--transition);
}

.member-reset-btn:hover {
  background: var(--accent);
  color: #fff;
}

.member-reset-btn svg {
  width: 14px;
  height: 14px;
}

.member-reset-btn.outline {
  border-color: var(--border);
  color: var(--text-secondary);
}

.member-reset-btn.outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: transparent;
}

/* --- Chat Mode (executive single-advisor UX) --- */
.chat-section {
  display: none;
  margin-bottom: 2rem;
}

.chat-section.visible {
  display: block;
  animation: fadeSlideIn 300ms ease;
}

.chat-greeting {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.advisor-avatar {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  flex-shrink: 0;
}

.advisor-avatar svg {
  width: 22px;
  height: 22px;
}

.advisor-intro {
  flex: 1;
  min-width: 0;
}

.advisor-name {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
  margin-bottom: 0.25rem;
}

.advisor-greeting-text {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
}

.chat-prompts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

/* Chat reset buttons */
.chat-reset {
  display: none;
  text-align: center;
  margin-bottom: 1rem;
  gap: 0.75rem;
}

.chat-reset.visible {
  display: flex;
  justify-content: center;
  animation: fadeSlideIn 300ms ease;
}

.chat-reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5625rem 1.125rem;
  background: transparent;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  transition: all var(--transition);
}

.chat-reset-btn:hover {
  background: var(--accent);
  color: #fff;
}

.chat-reset-btn svg {
  width: 14px;
  height: 14px;
}

.chat-reset-btn.outline {
  border-color: var(--border);
  color: var(--text-secondary);
}

.chat-reset-btn.outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: transparent;
}

/* --- Tools Section --- */
.tools-section {
  display: none;
  margin-bottom: 2.5rem;
}

.tools-section.visible {
  display: block;
  animation: fadeSlideIn 300ms ease;
}

.section-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 1rem;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.875rem;
}

.tool-card {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.125rem 1rem;
  transition: all var(--transition);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.tool-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent-border);
  transform: translateY(-2px);
}

.tool-card:hover .tool-icon {
  background: var(--accent);
  color: #fff;
}

.tool-card:hover .tool-launch {
  color: var(--accent);
}

.tool-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  color: var(--accent);
  margin-bottom: 0.875rem;
  flex-shrink: 0;
  transition: all var(--transition);
}

.tool-icon svg {
  width: 20px;
  height: 20px;
}

.tool-body {
  flex: 1;
  min-height: 0;
}

.tool-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.tool-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 0.875rem;
}

.tool-launch {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  transition: color var(--transition);
  margin-top: auto;
}

.tool-launch svg {
  width: 13px;
  height: 13px;
  transition: transform var(--transition);
}

.tool-card:hover .tool-launch svg {
  transform: translateX(2px);
}

/* --- Privacy Notice --- */
.privacy-notice {
  text-align: center;
  padding: 1.5rem 0 2.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* --- Beacon AI Footer --- */
.beacon-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0 0 2.5rem;
  font-size: 0.6875rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.beacon-footer-icon {
  width: 12px;
  height: 12px;
  opacity: 0.5;
}

.beacon-footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.beacon-footer a:hover {
  color: var(--accent);
}

/* --- Conversation Thread --- */
.conversation-thread {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.conversation-thread:not(:empty) {
  border-left: 2px solid var(--border);
  padding-left: 1rem;
  margin-left: 0.5rem;
}

.conversation-thread:empty {
  display: none;
  margin: 0;
}

.thread-user-turn {
  display: flex;
  justify-content: flex-end;
}

.thread-user-bubble {
  max-width: 80%;
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius) var(--radius) 4px var(--radius);
  font-size: 0.9375rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.thread-ai-turn {
  display: flex;
  justify-content: flex-start;
}

.thread-ai-turn .output-card {
  width: 100%;
}

/* Thread AI card loading indicator */
.thread-ai-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1.125rem;
  text-align: center;
}

.thread-ai-loading .loading-dots {
  display: inline-flex;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
}

.thread-ai-loading .loading-dots span {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: dotPulse 1.4s ease-in-out infinite;
}

.thread-ai-loading .loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.thread-ai-loading .loading-dots span:nth-child(3) { animation-delay: 0.4s; }

.thread-ai-loading .loading-text {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* --- Stream cursor --- */
.stream-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--accent);
  margin-left: 1px;
  vertical-align: text-bottom;
  animation: cursorBlink 0.8s ease infinite;
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* --- Responsive --- */

/* Tablet: 3-col tools → 2-col */
@media (max-width: 780px) {
  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tablet: advisor tools → 1 column */
@media (max-width: 780px) {
  .advisor-tools.visible {
    grid-template-columns: 1fr;
  }
}

/* Mobile */
@media (max-width: 640px) {
  .hero { padding: 1.75rem 0 1.5rem; }
  .hero-title { font-size: 1.375rem; }
  .hero-subtitle { font-size: 0.9375rem; }
  .welcome-section { padding: 0.25rem 0.5rem 1.5rem; }
  .welcome-heading { font-size: 1.1rem; }
  .welcome-body { font-size: 0.875rem; }

  .mode-grid {
    grid-template-columns: 1fr;
    gap: 0.625rem;
  }
  .mode-grid.collapsed {
    grid-template-columns: 1fr 1fr;
  }
  .mode-btn { padding: 1.125rem 1rem; }

  .tools-grid { grid-template-columns: 1fr; }

  .tool-card {
    flex-direction: row;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 1rem;
  }

  .tool-icon {
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .tool-body {
    flex: 1;
  }

  .tool-desc {
    margin-bottom: 0.5rem;
  }

  .output-actions { gap: 0.25rem; }
  .action-btn { padding: 0.3125rem 0.5rem; font-size: 0.6875rem; }
}

/* --- Loading skeleton for initial config load --- */
.config-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4rem 0;
  gap: 1rem;
}

.config-loading .loading-dots {
  display: inline-flex;
}
