@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,wght@0,400;0,600;1,400&family=Inter:wght@400;500&family=IBM+Plex+Mono:wght@400&display=swap');

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

:root {
  --bg: #F5F2EC;
  --surface: #FFFFFF;
  --text-primary: #1A1A1A;
  --text-secondary: #6B6B6B;
  --text-muted: #9A9A9A;
  --accent: #2F5D4F;
  --accent-hover: #264D42;
  --success: #4A7C59;
  --error: #A64545;
  --border: rgba(0,0,0,0.08);
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   STORIES — ambient social proof in the margins during intake
   ═══════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════════
   STORIES — ambient social proof bubbles in the margins during intake
   ═══════════════════════════════════════════════════════════════════════════ */

.stories {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.8s ease;
  overflow: hidden;
}

.story {
  position: absolute;
  max-width: 230px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  opacity: 0;
  animation: storyFadeIn 1.2s ease forwards;
  transition: scale 0.25s ease, box-shadow 0.25s ease;
  pointer-events: auto;
  cursor: default;
}
.story:hover {
  scale: 1.06;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.story:nth-child(1) { animation-delay: 2.0s; }
.story:nth-child(2) { animation-delay: 3.0s; }
.story:nth-child(3) { animation-delay: 4.0s; }
.story:nth-child(4) { animation-delay: 5.0s; }
.story:nth-child(5) { animation-delay: 6.0s; }

@keyframes storyFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 0.7; transform: translateY(0); }
}

.story-quote {
  font-family: 'Source Serif 4', Georgia, serif;
  font-style: italic;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.story-quote::before { content: '\201E'; }
.story-quote::after { content: '\201C'; }
html[lang="en"] .story-quote::before { content: '\201C'; }
html[lang="en"] .story-quote::after { content: '\201D'; }

.story-who {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  opacity: 0.7;
}

.story-tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--accent);
  opacity: 0.6;
  margin-top: 4px;
}

/* Position each bubble — left margin, staggered offsets */
#story-1 { top: 12vh; left: 36px; }
#story-2 { top: 27vh; left: 64px; }
#story-3 { top: 43vh; left: 36px; }
#story-4 { top: 58vh; left: 64px; }
#story-5 { top: 74vh; left: 36px; }

/* Fade out when sidebar or product mode appear */
body.has-sidebar .stories { opacity: 0; }
body.product-mode .stories { display: none; }

/* Hide on narrow screens — no room for margins */
@media (max-width: 1200px) {
  .stories { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT — Three modes:
   1. Initial (single column centered)
   2. with-sidebar (conversation + notes sidebar)
   3. product-mode (nav + ticket detail + compact chat)
   ═══════════════════════════════════════════════════════════════════════════ */

.layout {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 24px;
  transition: max-width 0.5s ease;
}

/* Mode 2: sidebar appears */
.layout.with-sidebar {
  max-width: 1060px;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 48px;
}

/* Mode 3: full product layout */
.layout.product-mode {
  max-width: 1200px;
  display: grid;
  grid-template-columns: 200px 1fr 360px;
  gap: 0;
  padding: 0;
}

.main-col {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.layout.product-mode .main-col {
  padding: 0 32px;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.side-col {
  display: none;
  padding-top: clamp(48px, 10vh, 96px);
  position: relative;
}

.layout.with-sidebar .side-col { display: block; }
.layout.product-mode .side-col {
  display: block;
  padding: 24px 24px 0;
  max-height: 100vh;
  overflow-y: auto;
}

.side-sticky {
  position: sticky;
  top: 32px;
}

.layout.product-mode .side-sticky { position: static; }

/* ═══════════════════════════════════════════════════════════════════════════
   NAV COLUMN (product mode only)
   ═══════════════════════════════════════════════════════════════════════════ */

.nav-col {
  display: none;
  padding: 24px 16px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  min-height: 100vh;
}

.layout.product-mode .nav-col { display: block; }

.nav-inner { position: sticky; top: 24px; }

.nav-wordmark {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.nav-brand { margin-bottom: 24px; }
.nav-brand-name {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.nav-brand-tier {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 2px;
}

.nav-section-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 20px;
  margin-bottom: 8px;
}
.nav-section-label:first-of-type { margin-top: 0; }

.nav-ticket {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 2px;
  transition: background 0.15s;
}
.nav-ticket:hover { background: var(--bg); }
.nav-ticket.active { background: var(--bg); font-weight: 500; }

.nav-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.nav-dot.requested { background: var(--accent); }
.nav-dot.draft {
  background: transparent;
  border: 1.5px solid var(--text-muted);
}

.nav-ticket-label {
  font-size: 13px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-chat-link {
  margin-top: 24px;
  padding: 7px 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s;
}
.nav-chat-link:hover { background: var(--bg); color: var(--text-primary); }

/* ═══════════════════════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════════════════════ */

.top {
  padding-top: clamp(48px, 10vh, 96px);
  padding-bottom: 48px;
}

.layout.product-mode .top {
  padding-top: 32px;
  padding-bottom: 24px;
}

.wordmark {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 32px;
  letter-spacing: -0.01em;
}

.layout.product-mode .wordmark { display: none; }

.hook {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.subhook {
  font-size: clamp(15px, 2vw, 17px);
  color: var(--text-secondary);
  margin-top: 16px;
  line-height: 1.55;
}

/* Product mode welcome */
.product-welcome {
  margin-top: 12px;
  margin-bottom: 8px;
}
.product-welcome-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.product-welcome-sub {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CONVERSATION
   ═══════════════════════════════════════════════════════════════════════════ */

.conversation { display: flex; flex-direction: column; }

.turn { padding: 28px 0; animation: turnIn 0.25s ease; }
@keyframes turnIn { from { opacity: 0; } to { opacity: 1; } }

.turn-who {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; font-weight: 400;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 8px;
}

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

.turn.user .turn-text { color: var(--text-secondary); }

/* Compact chat (product mode) */
.layout.product-mode .turn { padding: 16px 0; }
.layout.product-mode .turn-text { font-size: 14px; line-height: 1.6; }

.chat-compact-header {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.chat-compact-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Typing indicator */
.typing-indicator { display: inline-flex; gap: 4px; vertical-align: middle; padding: 2px 0; }
.typing-indicator span {
  width: 5px; height: 5px; background: var(--text-muted);
  border-radius: 50%; animation: bounce 1.2s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-4px); } }

/* ═══════════════════════════════════════════════════════════════════════════
   INPUT
   ═══════════════════════════════════════════════════════════════════════════ */

.input-area { padding: 24px 0 0; margin-top: 4px; border-top: 1px solid var(--border); }
.input-row { display: flex; gap: 8px; align-items: flex-end; }

#input {
  flex: 1; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 14px; color: var(--text-primary);
  font-size: 16px; font-family: inherit; resize: none;
  min-height: 46px; max-height: 160px; line-height: 1.5; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,93,79,0.1); }
#input::placeholder { color: var(--text-muted); }

.layout.product-mode #input { font-size: 14px; min-height: 40px; padding: 9px 12px; }

#send-btn {
  background: var(--accent); border: none; border-radius: 10px;
  width: 46px; height: 46px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}
#send-btn:hover { background: var(--accent-hover); }
#send-btn:active { transform: scale(0.95); }
#send-btn:disabled { background: #C5C0B8; cursor: not-allowed; }
#send-btn svg { width: 18px; height: 18px; fill: #fff; }

.layout.product-mode #send-btn { width: 40px; height: 40px; }

.input-hint { font-size: 12px; color: var(--text-muted); margin-top: 10px; display: flex; align-items: center; gap: 5px; }
.input-hint svg { width: 11px; height: 11px; fill: var(--text-muted); flex-shrink: 0; opacity: 0.7; }

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR CARDS (conversation mode)
   ═══════════════════════════════════════════════════════════════════════════ */

.proposals-header {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 16px; font-weight: 600;
  color: var(--text-primary); margin-bottom: 2px; letter-spacing: -0.01em;
}

.proposals-sub { font-size: 12px; color: var(--text-muted); margin-bottom: 14px; }

.ticket-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px; margin-bottom: 8px;
  transition: border-color 0.3s, box-shadow 0.3s, background 0.3s, opacity 0.3s;
  animation: turnIn 0.4s ease;
}
.ticket-card:hover { border-color: rgba(0,0,0,0.15); box-shadow: 0 2px 8px rgba(0,0,0,0.04); }

.ticket-card.partial { border-left: 3px solid var(--text-muted); opacity: 0.8; }
.ticket-card.complete { border-left: 3px solid var(--accent); opacity: 1; }
.ticket-card.requested { border-left: 3px solid var(--accent); border-color: var(--accent); background: rgba(47,93,79,0.03); }

.ticket-title {
  font-weight: 500; font-size: 14px; color: var(--text-primary);
  margin-bottom: 4px; display: flex; align-items: center; gap: 7px;
}
.ticket-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); flex-shrink: 0; }
.ticket-card.complete .ticket-dot, .ticket-card.requested .ticket-dot { background: var(--accent); }

.ticket-detail { font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 3px; margin-left: 13px; }
.ticket-detail strong { color: var(--text-primary); font-weight: 500; }
.ticket-meta { font-size: 11px; color: var(--text-muted); margin-top: 6px; margin-left: 13px; }

.ticket-action { margin-top: 10px; margin-left: 13px; }
.ticket-btn {
  background: none; border: 1px solid var(--accent); border-radius: 7px;
  color: var(--accent); font-size: 12px; font-family: inherit;
  padding: 5px 12px; cursor: pointer; transition: background 0.15s, color 0.15s;
}
.ticket-btn:hover { background: var(--accent); color: #fff; }
.ticket-btn.requested { background: var(--accent); color: #fff; border-color: var(--accent); cursor: default; }

/* ═══════════════════════════════════════════════════════════════════════════
   TICKET DETAIL (product mode center column)
   ═══════════════════════════════════════════════════════════════════════════ */

.ticket-detail-panel {
  padding: 0 0 40px;
}

.detail-empty {
  color: var(--text-muted);
  font-size: 14px;
  padding: 40px 0;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.detail-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.detail-status {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 4px;
  white-space: nowrap;
}
.status-noted, .status-draft { background: rgba(0,0,0,0.05); color: var(--text-muted); }
.status-identified { background: rgba(47,93,79,0.08); color: var(--accent); }
.status-requested { background: var(--accent); color: #fff; }
.status-submitted { background: var(--success); color: #fff; }

/* Timeline */
.detail-timeline {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 28px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.timeline-step {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 24px;
  position: relative;
}
.timeline-step:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 8px;
  top: 50%;
  width: 10px;
  height: 1px;
  background: var(--border);
}

.timeline-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}
.timeline-step.done .timeline-dot { background: var(--accent); }

.timeline-label {
  font-size: 11px;
  color: var(--text-muted);
}
.timeline-step.done .timeline-label { color: var(--text-primary); }

/* Fields */
.detail-fields { display: flex; flex-direction: column; gap: 18px; }

.detail-field-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

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

.detail-field.empty .detail-field-value.muted {
  color: var(--text-muted);
  font-style: italic;
  font-size: 13px;
}

.detail-action {
  margin-top: 24px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════════════════ */

.page-footer {
  margin-top: auto; padding: 20px 0 24px;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted); line-height: 1.6;
}
.page-footer span { white-space: nowrap; }
.page-footer .sep { margin: 0 5px; opacity: 0.4; }

.layout.product-mode .page-footer { display: none; }
