/* ============================================
   Living Brief — one quiet studio
   ============================================ */

.hero-section .planning-container.planning-container--living {
  max-width: 840px;
  padding: 0 16px 56px;
}

.planning-container--living .planning-header,
.planning-container--living #export-area,
.planning-container--living #workspace-container,
.planning-container--living .lb-tools,
.planning-container--living .lb-capture-strip {
  display: none;
}

.living-brief-bridge {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.living-brief {
  --lb-ink: #171717;
  --lb-mute: #6b6b6b;
  --lb-line: #e8e8e8;
  --lb-bg: #ffffff;
  --lb-soft: #f7f7f7;
  --lb-accent: #ff6b35;
  --lb-size-meta: 0.75rem;
  --lb-size-body: 0.95rem;
  --lb-size-title: 0.95rem;
  --lb-size-input: 1.125rem;
  font-family: "Montserrat", "Segoe UI", sans-serif;
  color: var(--lb-ink);
  animation: lb-in 0.45s ease both;
}

@keyframes lb-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* One surface — fixed chat viewport; composer stays pinned */
.living-brief-shell {
  position: relative;
  background: var(--lb-bg);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
  height: min(72vh, 680px);
  display: flex;
  flex-direction: column;
}

.lb-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
}

.lb-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

/* Header — one thin row; progress centered in the container */
.lb-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--lb-line);
  flex-shrink: 0;
}

.lb-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  justify-self: start;
}

.lb-brand-title {
  margin: 0;
  font-size: var(--lb-size-title);
  font-weight: 650;
  letter-spacing: -0.02em;
}

.lb-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  justify-self: center;
  min-width: 0;
}

.lb-progress-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.lb-score {
  font-size: var(--lb-size-meta);
  font-weight: 500;
  color: var(--lb-mute);
  font-variant-numeric: tabular-nums;
}

.lb-ready-msg {
  margin: 0;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--lb-accent);
  text-align: center;
  white-space: nowrap;
  animation: lb-ready-in 0.35s ease both;
}

.lb-ready-msg[hidden] {
  display: none;
}

@keyframes lb-ready-in {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.lb-confetti {
  pointer-events: none;
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 8;
}

.lb-confetti-piece {
  position: absolute;
  top: -8px;
  width: 7px;
  height: 10px;
  border-radius: 1px;
  opacity: 0.95;
  animation-name: lb-confetti-fall;
  animation-timing-function: cubic-bezier(0.22, 0.61, 0.36, 1);
  animation-fill-mode: forwards;
}

@keyframes lb-confetti-fall {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--lb-cx, 0), 110%, 0) rotate(var(--lb-cr, 360deg));
    opacity: 0;
  }
}

.lb-score strong {
  font-weight: 650;
  color: #e07a3a;
  transition: color 0.35s ease;
}

.lb-dots {
  display: flex;
  align-items: center;
  gap: 5px;
}

.lb-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d9d9d9;
  font-size: 0;
  color: transparent;
  overflow: hidden;
  transition: background 0.35s ease;
}

.lb-dot.is-on {
  background: #e07a3a;
}

/* Progress tone: orange → amber → green (ready to generate) */
.lb-progress[data-tone='low'] .lb-score strong {
  color: #e07a3a;
}

.lb-progress[data-tone='low'] .lb-dot.is-on {
  background: #e07a3a;
}

.lb-progress[data-tone='warm'] .lb-score strong {
  color: #d97706;
}

.lb-progress[data-tone='warm'] .lb-dot.is-on {
  background: #d97706;
}

.lb-progress[data-tone='ready'] .lb-score strong {
  color: #1f9d55;
}

.lb-progress[data-tone='ready'] .lb-dot.is-on {
  background: #1f9d55;
}

.lb-top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  justify-self: end;
}

.lb-generate {
  border: 0;
  background: var(--lb-accent);
  color: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: var(--lb-size-meta);
  font-weight: 650;
  cursor: pointer;
  transition: background 0.35s ease, filter 0.15s ease;
}

.lb-generate:hover {
  filter: brightness(1.05);
}

/* Chat — only this region scrolls; messages rise above the fixed composer */
.lb-chat-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 20px 18px 12px;
  background: var(--lb-bg);
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.lb-msg {
  max-width: 100%;
  margin-bottom: 14px;
  animation: lb-msg-in 0.28s ease both;
}

@keyframes lb-msg-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.lb-msg--user {
  margin-left: auto;
}

.lb-avatar {
  display: none;
}

.lb-bubble {
  font-size: var(--lb-size-body);
  font-weight: 450;
  line-height: 1.55;
  letter-spacing: -0.01em;
  white-space: pre-wrap;
  word-break: break-word;
}

.lb-msg--assistant .lb-bubble {
  color: var(--lb-ink);
  padding: 0;
  background: transparent;
  border: 0;
}

.lb-inline-generate-wrap {
  margin-top: 12px;
}

.lb-inline-generate {
  border: 0;
  background: var(--lb-accent);
  color: #fff;
  border-radius: 999px;
  padding: 9px 18px;
  font: inherit;
  font-size: var(--lb-size-meta);
  font-weight: 650;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.lb-inline-generate:hover {
  filter: brightness(1.05);
}

.lb-inline-generate:active {
  transform: scale(0.98);
}

.lb-msg--user .lb-bubble {
  display: inline-block;
  background: var(--lb-soft);
  color: var(--lb-ink);
  border-radius: 14px;
  padding: 10px 14px;
}

.lb-bubble strong {
  font-weight: 650;
}

.lb-tag-token {
  font-weight: 550;
  color: inherit;
}

.lb-caret {
  display: inline-block;
  width: 0.4em;
  color: var(--lb-mute);
  animation: lb-caret 0.9s steps(1) infinite;
}

@keyframes lb-caret {
  50% {
    opacity: 0;
  }
}

.lb-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  min-height: 1.2em;
}

.lb-typing span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #bdbdbd;
  animation: lb-dot 1.1s ease-in-out infinite;
}

.lb-typing span:nth-child(2) {
  animation-delay: 0.12s;
}
.lb-typing span:nth-child(3) {
  animation-delay: 0.24s;
}

@keyframes lb-dot {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

/* Feature added — compact success row (auto-hides) */
.lb-msg--feature {
  max-width: 100%;
  transition: opacity 0.28s ease, transform 0.28s ease, margin 0.28s ease, max-height 0.28s ease;
  max-height: 120px;
  overflow: hidden;
}

.lb-msg--feature.is-leaving {
  opacity: 0;
  transform: translateY(-4px);
  margin-bottom: 0;
  max-height: 0;
}

.lb-feature-added {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-radius: 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #e6f0ea;
  position: relative;
}

.lb-feature-check {
  flex-shrink: 0;
  display: inline-flex;
  margin-top: 1px;
}

.lb-feature-text {
  flex: 1;
  min-width: 0;
  font-size: var(--lb-size-meta);
  font-weight: 450;
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: #3d5c45;
  word-break: break-word;
  padding-right: 4px;
}

.lb-feature-remove {
  flex-shrink: 0;
  align-self: center;
  border: 0;
  background: transparent;
  color: #8a8a8a;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, background 0.12s ease, color 0.12s ease;
}

.lb-feature-added:hover .lb-feature-remove,
.lb-feature-added:focus-within .lb-feature-remove {
  opacity: 1;
  pointer-events: auto;
}

.lb-feature-remove:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #444;
}

/* Legacy proposal card bits (unused in chat; keep minimal) */
.lb-msg--card {
  max-width: 100%;
}

.lb-card {
  padding: 10px 0;
  border-top: 1px solid var(--lb-line);
}

.lb-card-title {
  margin: 0;
  font-size: var(--lb-size-body);
  font-weight: 550;
}

.lb-card-meta {
  display: none;
}

.lb-card-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.lb-btn {
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  font-size: var(--lb-size-meta);
  font-weight: 550;
  color: var(--lb-mute);
  cursor: pointer;
}

.lb-btn--accept {
  color: var(--lb-ink);
}

/* Composer — pinned to bottom of the shell */
.lb-composer {
  flex-shrink: 0;
  margin-top: 0;
  padding: 8px 18px 18px;
  background: var(--lb-bg);
  border-top: 1px solid var(--lb-line);
}

.lb-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}

.lb-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px solid #e0e0e0;
  background: #fafafa;
  border-radius: 999px;
  padding: 5px 10px 5px 8px;
  margin: 0;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 550;
  letter-spacing: -0.01em;
  color: #555;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.lb-tag-plus {
  font-weight: 700;
  color: #888;
  line-height: 1;
}

.lb-tag:hover {
  background: #f0f0f0;
  border-color: #cfcfcf;
  color: var(--lb-ink);
}

.lb-tag:hover .lb-tag-plus {
  color: var(--lb-ink);
}

.lb-tag.is-active {
  background: var(--lb-ink);
  border-color: var(--lb-ink);
  color: #fff;
}

.lb-tag.is-active .lb-tag-plus {
  color: #fff;
}

.lb-composer-form {
  margin: 0;
}

.lb-field {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 12px 0 10px;
  border-bottom: 1px solid #d4d4d4;
}

.lb-field:focus-within {
  border-bottom-color: var(--lb-ink);
}

.lb-attach-wrap {
  position: relative;
  flex-shrink: 0;
}

.lb-attach {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: 0 0 1px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #8a8a8a;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.lb-attach:hover,
.lb-attach[aria-expanded='true'] {
  background: var(--lb-soft);
  color: var(--lb-ink);
}

.lb-attach-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  min-width: 120px;
  padding: 4px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--lb-line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  z-index: 5;
}

.lb-attach-option {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  margin: 0;
  border-radius: 7px;
  font: inherit;
  font-size: var(--lb-size-meta);
  font-weight: 550;
  color: var(--lb-ink);
  cursor: pointer;
}

.lb-attach-option:hover {
  background: var(--lb-soft);
}

.lb-ref-file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.lb-refs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}

.lb-refs[hidden] {
  display: none;
}

.lb-ref-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 5px 8px 5px 6px;
  border-radius: 10px;
  background: #f3faf5;
  border: 1px dashed #b7dfc4;
}

.lb-ref-chip-thumb {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
  background: #e8e8e8;
  flex-shrink: 0;
}

.lb-ref-chip-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #e8f5ec;
  color: #1f9d55;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.lb-ref-chip-text {
  min-width: 0;
  font-size: var(--lb-size-meta);
  font-weight: 450;
  color: #3d5c45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.lb-ref-chip-remove {
  border: 0;
  background: transparent;
  color: #8a8a8a;
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
}

.lb-ref-chip-remove:hover {
  color: var(--lb-ink);
}

.lb-ref-panel {
  margin: 0 0 12px;
  padding: 12px;
  border-radius: 12px;
  background: #faf7f0;
  border: 1px dashed #e2d6b8;
}

.lb-ref-panel[hidden] {
  display: none;
}

.lb-ref-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.lb-ref-panel-title {
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9a8450;
}

.lb-ref-panel-close {
  border: 0;
  background: transparent;
  color: #888;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
}

.lb-ref-panel-preview {
  margin: 0 0 10px;
}

.lb-ref-panel-preview[hidden] {
  display: none;
}

.lb-ref-panel-img {
  display: block;
  max-width: 140px;
  max-height: 90px;
  border-radius: 8px;
  object-fit: cover;
  background: #eee;
}

.lb-ref-panel-label {
  display: block;
  margin: 0 0 4px;
  font-size: var(--lb-size-meta);
  font-weight: 550;
  color: #6b5c3c;
}

.lb-ref-panel-label[hidden] {
  display: none;
}

.lb-ref-panel-input {
  display: block;
  width: 100%;
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid #e2d6b8;
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: var(--lb-size-meta);
  line-height: 1.45;
  color: var(--lb-ink);
  resize: vertical;
}

.lb-ref-panel-input[hidden] {
  display: none;
}

.lb-ref-panel-hint {
  margin: 0 0 10px;
  font-size: var(--lb-size-meta);
  color: #9a8450;
}

.lb-ref-panel-hint[hidden] {
  display: none;
}

.lb-ref-panel-add {
  border: 0;
  background: var(--lb-ink);
  color: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: var(--lb-size-meta);
  font-weight: 650;
  cursor: pointer;
}

.lb-ref-panel-add:disabled {
  opacity: 0.55;
  cursor: default;
}

.lb-msg--ref .lb-feature-added {
  background: #faf7f0;
  border-color: #e2d6b8;
}

.lb-msg--ref .lb-feature-text {
  color: #5c5340;
}

/* Kill global orange focus ring from main.css */
.living-brief input.lb-input:focus,
.living-brief input.lb-input:focus-visible,
.living-brief textarea.lb-input:focus,
.living-brief textarea.lb-input:focus-visible,
.living-brief .lb-send:focus,
.living-brief .lb-send:focus-visible,
.living-brief .lb-attach:focus,
.living-brief .lb-attach:focus-visible,
.living-brief .lb-attach-option:focus,
.living-brief .lb-attach-option:focus-visible,
.living-brief .lb-ref-panel-add:focus,
.living-brief .lb-ref-panel-add:focus-visible,
.living-brief .lb-ref-panel-input:focus,
.living-brief .lb-ref-panel-input:focus-visible,
.living-brief .lb-tag:focus,
.living-brief .lb-tag:focus-visible,
.living-brief .lb-ideas-off:focus,
.living-brief .lb-ideas-off:focus-visible,
.living-brief .lb-generate:focus,
.living-brief .lb-generate:focus-visible,
.living-brief .lb-suggest-item:focus,
.living-brief .lb-suggest-item:focus-visible,
.living-brief .lb-btn:focus,
.living-brief .lb-btn:focus-visible {
  outline: none;
  box-shadow: none;
}

.lb-input {
  flex: 1;
  border: 0;
  outline: none;
  box-shadow: none;
  resize: none;
  overflow-y: auto;
  min-height: 1.4em;
  max-height: min(40vh, 220px);
  width: 100%;
  font: inherit;
  font-size: var(--lb-size-input);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.4;
  color: var(--lb-ink);
  background: transparent;
  padding: 0;
  border-radius: 0;
  height: 1.4em;
  transition: height 0.18s ease;
}

.lb-input::placeholder {
  color: #b0b0b0;
  font-weight: 450;
}

.lb-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: #e8e8e8;
  color: #9a9a9a;
  padding: 0;
  margin: 0 0 1px;
  cursor: default;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.lb-send-icon {
  display: block;
}

.lb-send.is-ready {
  background: var(--lb-ink);
  color: #fff;
  cursor: pointer;
}

.lb-send.is-ready:hover {
  transform: scale(1.04);
}

.lb-listening {
  display: none;
}

/* Ideas — minimal inline suggestions (max 3 per round) */
.lb-ideas-inline {
  margin: 10px 0 4px;
  max-width: 100%;
  padding: 6px 0 2px;
  border-radius: 0;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--lb-line);
}

.lb-ideas-inline[hidden] {
  display: none;
}

.lb-ideas-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 4px;
}

.lb-ideas-label {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--lb-mute);
}

.lb-ideas-off {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  margin: 0;
  padding: 2px 0;
  font: inherit;
  font-size: 0.62rem;
  font-weight: 550;
  letter-spacing: 0.02em;
  color: #a0a0a0;
  cursor: pointer;
}

.lb-ideas-off:hover {
  color: var(--lb-ink);
}

.lb-ideas-label-icon {
  display: inline-flex;
  color: #b0b0b0;
}

.lb-ideas-inline-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.lb-idea-line {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  border: 0;
  background: transparent;
  border-radius: 0;
  text-align: left;
  width: 100%;
  padding: 5px 0;
  margin: 0;
  font: inherit;
  font-size: var(--lb-size-meta);
  font-weight: 450;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: #666;
  cursor: pointer;
  transition: color 0.12s ease;
}

.lb-idea-bulb {
  flex-shrink: 0;
  display: inline-flex;
  margin-top: 2px;
  color: #b8b8b8;
}

.lb-idea-text {
  min-width: 0;
}

.lb-idea-line:hover {
  background: transparent;
  color: var(--lb-ink);
}

.lb-idea-line:hover .lb-idea-bulb {
  color: #888;
}

@media (max-width: 780px) {
  .living-brief-shell {
    height: min(78vh, 640px);
  }
}
