:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #22263a;
  --border: #2e3347;
  --accent: #4f8ef7;
  --accent2: #7c5cbf;
  --text: #e8eaf0;
  --text-muted: #7a8099;
  --kai-bubble: #1e2438;
  --user-bubble: #2a3a6e;
  --success: #3bb87f;
  --warning: #e06020;
  --radius: 12px;
  --font: 'Segoe UI', system-ui, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

/* ── Name Screen ──────────────────────────────────────────────── */
.name-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  animation: fadeIn .3s ease;
}
.name-screen.hiding {
  animation: fadeOut .35s ease forwards;
}

@keyframes fadeIn  { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; pointer-events: none; } }

.name-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 44px;
  width: 420px;
  max-width: 92vw;
  display: flex; flex-direction: column; align-items: center;
  gap: 12px;
  box-shadow: 0 24px 60px rgba(0,0,0,.4);
}

.name-card-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: #fff;
  margin-bottom: 4px;
}

.name-card-title {
  font-size: 22px; font-weight: 700; text-align: center;
}

.name-card-sub {
  font-size: 13px; color: var(--text-muted); text-align: center;
  margin-bottom: 8px;
}

.name-input-wrap {
  width: 100%; display: flex; flex-direction: column; gap: 10px; margin-top: 8px;
}

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

.name-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  padding: 12px 16px;
  outline: none;
  transition: border-color .2s;
  width: 100%;
}
.name-input:focus { border-color: var(--accent); }
.name-input::placeholder { color: var(--text-muted); }

.name-btn {
  background: var(--accent);
  border: none; border-radius: 10px;
  color: #fff; font-family: var(--font);
  font-size: 14px; font-weight: 600;
  padding: 12px;
  cursor: pointer;
  transition: background .2s, opacity .2s;
  width: 100%;
}
.name-btn:disabled { opacity: .35; cursor: default; }
.name-btn:not(:disabled):hover { background: #3a7ae0; }

.name-privacy {
  font-size: 11px; color: var(--text-muted);
  text-align: center; margin-top: 4px; line-height: 1.5;
}

/* Resume-with-code on the name screen */
.name-resume {
  width: 100%; margin-top: 12px; padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px;
}
.name-resume-toggle {
  font-size: 12px; color: var(--accent); cursor: pointer; text-align: center;
}
.name-resume-toggle:hover { text-decoration: underline; }
.name-resume-row { display: flex; flex-direction: column; gap: 8px; }
.resume-error { font-size: 11px; color: #e05c5c; min-height: 14px; }

/* Dev-mode sign-in code hint (shown only when no email provider is configured) */
.dev-code-note {
  font-size: 12px; color: var(--accent);
  background: rgba(79,142,247,.12); border: 1px dashed rgba(79,142,247,.4);
  border-radius: 8px; padding: 8px 10px; text-align: center; margin-top: 4px;
}

/* Resume code in sidebar */
.client-code {
  display: flex; flex-direction: column; gap: 2px; margin-top: 6px;
  background: var(--surface2); border: 1px dashed var(--border);
  border-radius: 8px; padding: 6px 10px;
}
.client-code-label {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted);
}
.client-code-val {
  font-size: 13px; font-weight: 700; color: var(--accent);
  letter-spacing: .04em; user-select: all;
}

/* Save-your-code banner */
.code-banner {
  background: linear-gradient(90deg, rgba(59,184,127,.14), rgba(79,142,247,.10));
  border-bottom: 1px solid rgba(59,184,127,.3);
  padding: 10px 28px; font-size: 13px; color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.code-banner strong { color: var(--success); letter-spacing: .04em; user-select: all; }
.code-banner-close {
  margin-left: auto; background: transparent; border: none;
  color: var(--text-muted); cursor: pointer; font-size: 14px;
}
.code-banner-close:hover { color: var(--text); }

/* ── App shell ────────────────────────────────────────────────── */
.app {
  display: flex;
  height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────────── */
.sidebar {
  width: 260px; min-width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 24px 20px;
  gap: 28px;
  overflow-y: auto;
}

.sidebar-brand { display: flex; align-items: center; gap: 12px; }
.brand-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.brand-name { font-size: 18px; font-weight: 700; }
.brand-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.sidebar-section { display: flex; flex-direction: column; gap: 10px; }
.section-label {
  font-size: 10px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-muted);
}

.client-name { font-size: 16px; font-weight: 600; }
.client-meta { font-size: 11px; color: var(--text-muted); line-height: 1.6; }

.phase-display { display: flex; align-items: center; gap: 10px; }
.phase-label { font-size: 13px; color: var(--text-muted); }
.phase-badge {
  background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 700;
  padding: 2px 10px; border-radius: 20px;
}
.phase-name { font-size: 13px; color: var(--text-muted); margin-top: -4px; }

.score-row { display: flex; align-items: center; gap: 8px; }
.score-label { font-size: 12px; width: 70px; flex-shrink: 0; color: var(--text-muted); }
.score-bar-wrap {
  flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden;
}
.score-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 3px; transition: width .5s ease;
}
.score-bar.maturity {
  background: linear-gradient(90deg, var(--success), var(--accent));
}
.score-val { font-size: 12px; width: 36px; text-align: right; }

.handoff-badge {
  background: var(--success); color: #fff;
  font-size: 12px; font-weight: 600;
  padding: 6px 12px; border-radius: 8px; text-align: center;
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.7} }

.btn-action {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .2s;
  text-align: left; width: 100%;
}
.btn-action:hover { background: var(--border); }
.btn-action.btn-secondary { color: var(--text-muted); font-size: 12px; padding: 7px 16px; }

.api-status { font-size: 11px; color: var(--text-muted); padding: 4px 0; }
.api-status.ok  { color: var(--success); }
.api-status.err { color: #e05c5c; }

/* ── Gap dimensions panel ─────────────────────────────────────── */
.score-bar.gap-clarity {
  background: linear-gradient(90deg, #e06020, #e87c3e);
}

.gap-type-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gap-type-badge {
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  background: rgba(224,96,32,.18); color: #e06020;
  padding: 3px 9px; border-radius: 6px;
  text-transform: uppercase;
}
.gap-secondary {
  font-size: 10px; color: var(--text-muted);
  background: var(--surface2); padding: 2px 7px; border-radius: 5px;
}

.gap-dims { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.gap-dim-row { display: flex; align-items: center; justify-content: space-between; }
.gap-dim-label { font-size: 11px; color: var(--text-muted); }
.gap-dim-val {
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 5px;
  text-transform: capitalize;
}

/* Severity colours */
.gap-dim-val.severity[data-val="critical"] { background: rgba(220,60,60,.2);  color: #e05c5c; }
.gap-dim-val.severity[data-val="high"]     { background: rgba(224,96,32,.2); color: #e06020; }
.gap-dim-val.severity[data-val="medium"]   { background: rgba(79,142,247,.2); color: #7ab3f7; }
.gap-dim-val.severity[data-val="low"]      { background: rgba(59,184,127,.2); color: #3bb87f; }

/* Urgency colours */
.gap-dim-val.urgency[data-val="immediate"]  { background: rgba(220,60,60,.2);  color: #e05c5c; }
.gap-dim-val.urgency[data-val="near-term"]  { background: rgba(224,96,32,.2); color: #e06020; }
.gap-dim-val.urgency[data-val="long-term"]  { background: rgba(79,142,247,.2); color: #7ab3f7; }

/* Awareness colours */
.gap-dim-val.awareness[data-val="unaware"]       { background: rgba(220,60,60,.2);  color: #e05c5c; }
.gap-dim-val.awareness[data-val="vaguely_aware"] { background: rgba(224,96,32,.2); color: #e06020; }
.gap-dim-val.awareness[data-val="aware"]         { background: rgba(59,184,127,.2); color: #3bb87f; }

/* Readiness colours */
.gap-dim-val.readiness[data-val="resistant"] { background: rgba(220,60,60,.2);  color: #e05c5c; }
.gap-dim-val.readiness[data-val="open"]      { background: rgba(224,96,32,.2); color: #e06020; }
.gap-dim-val.readiness[data-val="motivated"] { background: rgba(59,184,127,.2); color: #3bb87f; }

.gap-description {
  font-size: 11px; color: var(--text-muted); line-height: 1.5;
  margin-top: 6px; padding-top: 6px;
  border-top: 1px solid var(--border);
  font-style: italic;
}

.inference-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.inference-label { font-size: 12px; color: var(--text-muted); }
.inference-val {
  font-size: 12px; font-weight: 600;
  background: rgba(124,92,191,.18);
  color: #b59de8;
  padding: 2px 8px; border-radius: 6px;
  text-transform: capitalize;
}
.inference-confidence { font-size: 10px; color: var(--text-muted); margin-top: -4px; }
.inference-confidence.confirmed { color: var(--success); }
.inference-confidence.inferred  { color: var(--warning); }

.sidebar-footer { margin-top: auto; }
.footer-note {
  font-size: 10px; color: var(--text-muted); line-height: 1.5;
  border-top: 1px solid var(--border); padding-top: 16px;
}

/* ── Chat area ────────────────────────────────────────────────── */
.chat-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.chat-header {
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  background: var(--surface);
}
.chat-avatar {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff;
}
.chat-name { font-size: 15px; font-weight: 600; }
.chat-tagline { font-size: 12px; color: var(--text-muted); }
.msg-count { margin-left: auto; font-size: 12px; color: var(--text-muted); }

/* Returning client banner */
.returning-banner {
  background: linear-gradient(90deg, rgba(79,142,247,.12), rgba(124,92,191,.08));
  border-bottom: 1px solid rgba(79,142,247,.25);
  padding: 10px 28px;
  font-size: 13px;
  color: var(--accent);
  display: flex; align-items: center; gap: 10px;
}
.returning-icon { font-size: 16px; }

/* ── Messages ─────────────────────────────────────────────────── */
.messages {
  flex: 1; overflow-y: auto;
  padding: 28px;
  display: flex; flex-direction: column; gap: 20px;
  scroll-behavior: smooth;
}
.messages::-webkit-scrollbar { width: 6px; }
.messages::-webkit-scrollbar-track { background: transparent; }
.messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.welcome-state {
  margin: auto; text-align: center; color: var(--text-muted);
}
.welcome-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: #fff;
  margin: 0 auto 16px;
}
.welcome-title { font-size: 20px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.welcome-text { font-size: 14px; max-width: 280px; line-height: 1.6; }

.message { display: flex; gap: 12px; max-width: 720px; }
.message.user { flex-direction: row-reverse; margin-left: auto; }

.msg-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0; margin-top: 2px;
}
.message.kai .msg-avatar {
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff;
}
.message.user .msg-avatar {
  background: var(--surface2); color: var(--text-muted);
  border: 1px solid var(--border);
}

.msg-bubble {
  padding: 14px 18px; border-radius: var(--radius);
  font-size: 14px; line-height: 1.65; max-width: 580px;
}
.message.kai .msg-bubble {
  background: var(--kai-bubble); border: 1px solid var(--border);
  border-top-left-radius: 4px;
}
.message.user .msg-bubble {
  background: var(--user-bubble); border: 1px solid #3a4a8a;
  border-top-right-radius: 4px;
}

.msg-time {
  font-size: 10px; color: var(--text-muted);
  margin-top: 4px; padding: 0 2px;
}
.message.user .msg-time { text-align: right; }

/* Typing indicator */
.typing-indicator {
  display: flex; align-items: center; gap: 5px;
  padding: 14px 18px;
  background: var(--kai-bubble); border: 1px solid var(--border);
  border-radius: var(--radius); border-top-left-radius: 4px;
}
.typing-dot {
  width: 7px; height: 7px; background: var(--text-muted);
  border-radius: 50%; animation: typing 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: .2s; }
.typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes typing { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-6px)} }

/* ── Input ────────────────────────────────────────────────────── */
.input-area {
  padding: 16px 28px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.input-wrap {
  display: flex; gap: 10px; align-items: flex-end;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 14px; padding: 10px 12px;
  transition: border-color .2s;
}
.input-wrap:focus-within { border-color: var(--accent); }

textarea {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-family: var(--font);
  font-size: 14px; line-height: 1.5;
  resize: none; max-height: 160px; overflow-y: auto;
}
textarea::placeholder { color: var(--text-muted); }

.send-btn {
  width: 36px; height: 36px; background: var(--accent);
  border: none; border-radius: 9px; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, opacity .2s; flex-shrink: 0;
}
.send-btn svg { width: 16px; height: 16px; }
.send-btn:disabled { opacity: .35; cursor: default; }
.send-btn:not(:disabled):hover { background: #3a7ae0; }

.input-hint { font-size: 11px; color: var(--text-muted); margin-top: 8px; padding-left: 2px; }

/* ── Profile button ───────────────────────────────────────────── */
.btn-action.btn-profile {
  background: linear-gradient(135deg, rgba(79,142,247,.15), rgba(124,92,191,.15));
  border-color: rgba(79,142,247,.3);
  color: var(--accent);
  font-weight: 600;
}
.btn-action.btn-profile:hover:not(:disabled) { background: rgba(79,142,247,.25); }
.btn-action.btn-profile:disabled { opacity: .35; cursor: default; }

/* ── Profile modal ────────────────────────────────────────────── */
.profile-modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
}
.profile-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
}
.profile-panel {
  position: relative; z-index: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: min(900px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px 32px;
  display: flex; flex-direction: column; gap: 24px;
  box-shadow: 0 32px 80px rgba(0,0,0,.5);
  animation: slideUp .25s ease;
}
@keyframes slideUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:none; } }

.profile-panel::-webkit-scrollbar { width: 6px; }
.profile-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.profile-header {
  display: flex; align-items: center; justify-content: space-between;
}
.profile-header-left { display: flex; align-items: center; gap: 14px; }
.profile-avatar {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: #fff;
}
.profile-title { font-size: 20px; font-weight: 700; }
.profile-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.profile-close {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 16px;
  width: 36px; height: 36px; border-radius: 8px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.profile-close:hover { background: var(--border); color: var(--text); }

/* Score doughnuts */
.profile-scores-row {
  display: flex; gap: 20px; justify-content: center;
  background: var(--surface2); border-radius: 14px; padding: 20px;
}
.donut-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.donut-label { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.donut-val { font-size: 18px; font-weight: 700; color: var(--text); }

/* Radar charts */
.profile-radar-row {
  display: flex; gap: 20px;
}
.radar-card {
  flex: 1; background: var(--surface2); border-radius: 14px; padding: 20px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.radar-title { font-size: 13px; font-weight: 600; color: var(--text); align-self: flex-start; }

/* Insight cards */
/* Wellness map legend */
.radar-card-wellness { gap: 8px !important; }
.wellness-legend {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; font-size: 10px; color: var(--text-muted);
  align-self: flex-start;
}
.wl-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.wl-dot-grey { background: #3d4160; border: 1px dashed #6a7090; }

/* Action cards */
.action-cards-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.action-cards-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; margin-top: 4px;
}
.action-card {
  background: var(--surface2); border-radius: 10px;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 8px;
  border-left: 3px solid transparent;
}
.action-card.score-1 { border-color: #f0c020; }
.action-card.score-2 { border-color: #e06020; }
.action-card.score-3 { border-color: #e05c5c; }

.action-card-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.action-card-axis { font-size: 13px; font-weight: 700; color: var(--text); }
.action-card-zone {
  font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 5px;
  text-transform: uppercase; letter-spacing: .05em;
}
.zone-1 { background: rgba(240,192,32,.15); color: #f0c020; }
.zone-2 { background: rgba(224,96,32,.15); color: #e06020; }
.zone-3 { background: rgba(224,92,92,.15);  color: #e05c5c; }

.action-card-evidence {
  font-size: 10px; color: var(--text-muted);
  text-transform: capitalize;
}
.action-card-action {
  font-size: 12px; color: var(--text); line-height: 1.5;
}
.action-card-why {
  font-size: 11px; color: var(--text-muted);
  line-height: 1.4; font-style: italic;
}

/* Insight cards */
.insight-grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}
.insight-card {
  background: var(--surface2); border-radius: 10px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.insight-card-wide { grid-column: span 3; }
.insight-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); }
.insight-val { font-size: 13px; color: var(--text); line-height: 1.4; }

/* ── View Toggle ──────────────────────────────────────────────── */
.view-toggle {
  display: flex; gap: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
}
.toggle-btn {
  flex: 1; padding: 7px 8px;
  background: transparent;
  border: none; border-radius: 7px;
  color: var(--text-muted);
  font-family: var(--font); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: background .15s, color .15s;
  text-align: center;
}
.toggle-btn:hover { background: var(--border); color: var(--text); }
.toggle-btn.active {
  background: var(--accent);
  color: #fff;
}

/* Controls always-visible section */
.controls-always { margin-top: auto; }

/* ── Client view — phase plain English ───────────────────────── */
.phase-name-client {
  font-size: 14px; font-weight: 600; color: var(--text);
  line-height: 1.4;
}

/* ── Mini Wellness Map (client sidebar) ───────────────────────── */
.wellness-mini-wrap {
  display: flex; justify-content: center;
  margin: 4px 0 2px;
}
.wellness-legend-mini {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap; font-size: 9px; color: var(--text-muted);
}

/* ── Client summary button ────────────────────────────────────── */
.btn-action.btn-summary {
  background: linear-gradient(135deg, rgba(59,184,127,.15), rgba(79,142,247,.15));
  border-color: rgba(59,184,127,.3);
  color: var(--success);
  font-weight: 600;
}
.btn-action.btn-summary:hover:not(:disabled) { background: rgba(59,184,127,.25); }
.btn-action.btn-summary:disabled { opacity: .35; cursor: default; }

.btn-action.btn-feedback { margin-top: 8px; }

/* ── Categorized summary card ─────────────────────────────────── */
.summary-card {
  background: var(--kai-bubble);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  max-width: 540px;
}
.summary-title { font-weight: 700; font-size: 15px; margin-bottom: 8px; }
.summary-intro { color: var(--text); font-size: 14px; line-height: 1.5; margin-bottom: 14px; }
.summary-cat { padding: 8px 0; border-top: 1px solid var(--border); }
.summary-cat-head { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.summary-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.summary-cat-label { font-weight: 600; font-size: 13px; flex: 1; }
.summary-cat-status { font-size: 11px; font-weight: 600; }
.summary-cat-text { font-size: 13px; color: var(--text); line-height: 1.45; padding-left: 18px; }
.summary-cat-text.summary-muted { color: var(--text-muted); font-style: italic; }
.summary-cat-opp {
  font-size: 12.5px; color: var(--accent); line-height: 1.45;
  padding-left: 18px; margin-top: 4px;
}
.summary-cat-opp strong { font-weight: 600; }
.btn-action.btn-pdf {
  margin-top: 14px; width: auto; padding: 8px 16px;
  background: rgba(79,142,247,.15); border-color: rgba(79,142,247,.3);
  color: var(--accent); font-weight: 600;
}
.btn-action.btn-pdf:hover { background: rgba(79,142,247,.28); }

/* ── Feedback modal ───────────────────────────────────────────── */
.feedback-modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.feedback-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.feedback-panel {
  position: relative; width: 92%; max-width: 460px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
}
.feedback-title { font-weight: 700; font-size: 17px; margin-bottom: 6px; }
.feedback-sub { color: var(--text-muted); font-size: 13px; margin: 0 0 14px; line-height: 1.5; }
.feedback-panel textarea {
  width: 100%; box-sizing: border-box; resize: vertical;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 11px 12px; font: inherit; font-size: 14px;
}
.feedback-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.feedback-actions .btn-action { width: auto; padding: 8px 18px; }
.feedback-status { font-size: 13px; color: var(--success); margin-top: 10px; min-height: 16px; }

/* ── Advisor Brief ────────────────────────────────────────────── */
.brief-meta-row {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 6px; margin-bottom: 4px;
}
.brief-meta-item {
  background: var(--surface2);
  border-radius: 7px; padding: 6px 8px;
  display: flex; flex-direction: column; gap: 2px;
}
.brief-meta-label {
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted);
}
.brief-meta-val {
  font-size: 11px; font-weight: 600; color: var(--text);
}

.brief-subheader {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted);
  padding: 8px 0 2px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.brief-list { display: flex; flex-direction: column; gap: 4px; }
.brief-list-item {
  font-size: 11px; color: var(--text);
  line-height: 1.4; padding: 3px 0 3px 10px;
  border-left: 2px solid var(--accent);
}

.brief-gaps-list { display: flex; flex-direction: column; gap: 5px; }
.brief-gap-item {
  font-size: 11px; line-height: 1.4;
  padding: 5px 8px; border-radius: 6px;
  background: var(--surface2);
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
}
.brief-gap-item.score-3 { border-left: 3px solid #e05c5c; }
.brief-gap-item.score-2 { border-left: 3px solid #e06020; }
.brief-gap-item.score-1 { border-left: 3px solid #f0c020; }
.brief-gap-zone {
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted);
}
.brief-gap-ev { font-size: 9px; color: var(--text-muted); }
.brief-gap-est {
  font-size: 11px; font-weight: 700; color: var(--warning);
  background: rgba(224,96,32,.12); padding: 1px 6px; border-radius: 5px;
}
.brief-gap-basis {
  width: 100%; font-size: 9px; color: var(--text-muted);
  font-style: italic; margin-top: 2px; line-height: 1.3;
}
.brief-no-gaps { font-size: 11px; color: var(--text-muted); font-style: italic; }

/* Headline bulk number */
.brief-total {
  display: flex; flex-direction: column; gap: 3px;
  background: linear-gradient(135deg, rgba(224,96,32,.14), rgba(124,92,191,.10));
  border: 1px solid rgba(224,96,32,.3);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 4px;
}
.brief-total-main { display: flex; align-items: baseline; justify-content: space-between; }
.brief-total-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted);
}
.brief-total-val { font-size: 20px; font-weight: 800; color: var(--warning); }
.brief-total-basis { font-size: 10px; color: var(--text-muted); line-height: 1.4; }

/* Action card estimate */
.action-card-estimate {
  font-size: 15px; font-weight: 800; color: var(--warning);
}
.action-card-est-basis {
  font-size: 10px; font-weight: 400; color: var(--text-muted);
  font-style: italic; margin-left: 4px;
}

/* ── Opportunities (A+B) ──────────────────────────────────────── */
/* Legend marker */
.wl-opp { font-size: 10px; }

/* Client sidebar opportunities list */
.client-opps-list { display: flex; flex-direction: column; gap: 8px; }
.client-opp-item {
  display: flex; gap: 8px; align-items: flex-start;
  background: rgba(79,142,247,.08);
  border: 1px solid rgba(79,142,247,.2);
  border-radius: 8px; padding: 8px 10px;
}
.client-opp-icon { font-size: 13px; flex-shrink: 0; }
.client-opp-item strong { font-size: 12px; color: var(--text); }
.client-opp-text { font-size: 11px; color: var(--text-muted); line-height: 1.45; margin-top: 2px; }

/* Advisor brief opportunities */
.brief-opps-list { display: flex; flex-direction: column; gap: 6px; }
.brief-opp-item {
  display: flex; gap: 6px; align-items: flex-start;
  background: rgba(79,142,247,.08);
  border-left: 3px solid var(--accent);
  border-radius: 6px; padding: 6px 8px;
}
.brief-opp-icon { font-size: 12px; flex-shrink: 0; }
.brief-opp-item strong { font-size: 11px; color: var(--text); }
.brief-opp-text { font-size: 10px; color: var(--text-muted); line-height: 1.4; margin-top: 2px; }

/* Profile modal opportunity cards */
.opp-cards-title { color: var(--accent) !important; }
.opp-card {
  background: rgba(79,142,247,.07);
  border: 1px solid rgba(79,142,247,.22);
  border-left: 3px solid var(--accent);
  border-radius: 10px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.opp-card-header { display: flex; align-items: center; gap: 8px; }
.opp-card-icon { font-size: 14px; }
.opp-card-axis { font-size: 13px; font-weight: 700; color: var(--text); }
.opp-card-tag {
  font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 5px;
  text-transform: uppercase; letter-spacing: .05em;
  background: rgba(79,142,247,.15); color: var(--accent); margin-left: auto;
}
.opp-card-text { font-size: 12px; color: var(--text); line-height: 1.5; }

.brief-notes {
  font-size: 11px; color: var(--text); line-height: 1.5;
  font-style: italic; padding: 4px 0;
}
.brief-anchor { color: var(--accent); font-style: normal; font-weight: 600; }

.brief-handoff {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px;
  background: var(--surface2); margin-top: 8px;
  font-size: 11px; font-weight: 600; color: var(--text);
}
.brief-handoff-dot {
  font-size: 14px;
  transition: color .3s;
}
.brief-handoff-dot.early  { color: var(--text-muted); }
.brief-handoff-dot.near   { color: #f0c020; }
.brief-handoff-dot.ready  { color: var(--success); animation: pulse 2s infinite; }
