/* ── Legacy Book — CAC ─────────────────────────────────────────────────────── */

.clb-wrap {
  font-family: Georgia, 'Times New Roman', serif;
  max-width: 820px;
  margin: 0 auto;
  padding: 0 0 4rem;
  color: #2C1A0E;
}

/* ── Chapter tabs ─────────────────────────────────────────────────────────── */

.clb-chapters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 2rem;
}

.clb-chapter-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: #FAF7F2;
  border: 1px solid #D4C4B0;
  border-radius: 4px;
  padding: 0.875rem 1rem;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}

.clb-chapter-tab:hover {
  border-color: #9B7A60;
  background: #F5EFE6;
}

.clb-chapter-tab.active {
  border-color: #5C3D2E;
  background: #fff;
  box-shadow: 0 1px 4px rgba(92,61,46,0.1);
}

.clb-chapter-num {
  font-family: Georgia, serif;
  font-size: 1.1rem;
  color: #C4923A;
  font-style: italic;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.clb-chapter-title {
  font-size: 0.72rem;
  color: #6B4C35;
  line-height: 1.35;
  font-family: -apple-system, sans-serif;
}

.clb-chapter-status {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.65rem;
  font-family: -apple-system, sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 2px;
}

.clb-chapter-status.status-interviewing { background: #EAF3DE; color: #3B6D11; }
.clb-chapter-status.status-generated    { background: #E6F1FB; color: #185FA5; }
.clb-chapter-status.status-reviewing    { background: #FAEEDA; color: #854F0B; }
.clb-chapter-status.status-approved     { background: #E1F5EE; color: #0F6E56; }

/* ── Panel ────────────────────────────────────────────────────────────────── */

.clb-panel {
  background: #fff;
  border: 1px solid #D4C4B0;
  border-radius: 4px;
  padding: 2rem 2.25rem;
  position: relative;
  min-height: 420px;
}

.clb-panel-header {
  border-bottom: 1px solid #EDE3D8;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.clb-panel-header h2 {
  font-family: Georgia, serif;
  font-size: 1.4rem;
  color: #3A2218;
  margin: 0 0 0.25rem;
  font-weight: normal;
}

.clb-subtitle {
  font-size: 0.875rem;
  color: #9B7A60;
  font-style: italic;
  margin: 0;
  font-family: -apple-system, sans-serif;
}

/* ── Messages ─────────────────────────────────────────────────────────────── */

.clb-messages {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}

.clb-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
}

.clb-msg-assistant { align-self: flex-start; }
.clb-msg-user      { align-self: flex-end; }

.clb-msg-bubble {
  padding: 0.75rem 1rem;
  border-radius: 4px;
  font-size: 0.95rem;
  line-height: 1.65;
}

.clb-msg-assistant .clb-msg-bubble {
  background: #FAF7F2;
  border: 1px solid #E8DDD0;
  color: #2C1A0E;
  border-left: 3px solid #C4923A;
  border-radius: 0 4px 4px 0;
}

.clb-msg-user .clb-msg-bubble {
  background: #5C3D2E;
  color: #FAF7F2;
  border-radius: 4px 0 0 4px;
}

/* ── Generate prompt ──────────────────────────────────────────────────────── */

.clb-generate-prompt {
  background: #EAF3DE;
  border: 1px solid #C0DD97;
  border-radius: 4px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.clb-generate-prompt p {
  margin: 0;
  font-size: 0.9rem;
  color: #3B6D11;
  font-family: -apple-system, sans-serif;
}

/* ── Input area ───────────────────────────────────────────────────────────── */

.clb-input-area {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.clb-input {
  flex: 1;
  border: 1px solid #D4C4B0;
  border-radius: 4px;
  padding: 0.75rem 1rem;
  font-family: Georgia, serif;
  font-size: 0.95rem;
  color: #2C1A0E;
  resize: none;
  line-height: 1.6;
  background: #FDFAF7;
  transition: border-color 0.2s;
}

.clb-input:focus {
  outline: none;
  border-color: #9B7A60;
  background: #fff;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.clb-btn {
  font-family: -apple-system, sans-serif;
  font-size: 0.875rem;
  padding: 0.6rem 1.25rem;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  border: none;
  white-space: nowrap;
}

.clb-btn-primary {
  background: #5C3D2E;
  color: #FAF7F2;
}

.clb-btn-primary:hover { background: #3A2218; }

.clb-btn-secondary {
  background: transparent;
  color: #5C3D2E;
  border: 1px solid #9B7A60;
}

.clb-btn-secondary:hover {
  background: #FAF7F2;
}

/* ── Draft view ───────────────────────────────────────────────────────────── */

.clb-draft-content {
  background: #FDFAF7;
  border: 1px solid #E8DDD0;
  border-radius: 4px;
  padding: 1.75rem 2rem;
  margin-bottom: 1.5rem;
  font-size: 1rem;
  line-height: 1.85;
  color: #2C1A0E;
  max-height: 400px;
  overflow-y: auto;
  user-select: none;
  -webkit-user-select: none;
}

.clb-draft-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

/* ── Approved view ────────────────────────────────────────────────────────── */

.clb-approved-msg {
  text-align: center;
  padding: 3rem 1rem;
}

.clb-approved-icon {
  width: 56px;
  height: 56px;
  background: #E1F5EE;
  color: #0F6E56;
  border-radius: 50%;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.clb-approved-msg h2 {
  font-family: Georgia, serif;
  font-size: 1.3rem;
  color: #3A2218;
  margin: 0 0 0.5rem;
  font-weight: normal;
}

.clb-approved-msg p {
  color: #9B7A60;
  font-style: italic;
  margin: 0 0 1.5rem;
}

/* ── Loading ──────────────────────────────────────────────────────────────── */

.clb-loading {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  gap: 1rem;
}

.clb-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid #EDE3D8;
  border-top-color: #C4923A;
  border-radius: 50%;
  animation: clb-spin 0.8s linear infinite;
}

@keyframes clb-spin { to { transform: rotate(360deg); } }

.clb-loading p {
  font-size: 0.875rem;
  color: #9B7A60;
  font-style: italic;
  margin: 0;
  font-family: -apple-system, sans-serif;
}

/* ── Completion banner ────────────────────────────────────────────────────── */

.clb-complete-banner {
  margin-top: 2rem;
  background: #3A2218;
  border-radius: 4px;
  padding: 2.5rem;
  text-align: center;
  color: #FAF7F2;
}

.clb-complete-banner h2 {
  font-family: Georgia, serif;
  font-size: 1.6rem;
  font-weight: normal;
  margin: 0 0 0.5rem;
}

.clb-complete-banner p {
  color: rgba(250,247,242,0.7);
  font-style: italic;
  margin: 0 0 1.75rem;
}

.clb-complete-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.clb-complete-note {
  font-size: 0.8rem;
  color: rgba(250,247,242,0.45);
  margin: 0 !important;
  font-family: -apple-system, sans-serif;
}

.clb-complete-banner .clb-btn-primary {
  background: #C4923A;
  color: #FAF7F2;
}

.clb-complete-banner .clb-btn-primary:hover { background: #A87830; }

.clb-complete-banner .clb-btn-secondary {
  border-color: rgba(250,247,242,0.4);
  color: rgba(250,247,242,0.8);
}

.clb-complete-banner .clb-btn-secondary:hover {
  background: rgba(250,247,242,0.1);
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .clb-chapters {
    grid-template-columns: repeat(2, 1fr);
  }
  .clb-panel {
    padding: 1.25rem;
  }
  .clb-input-area {
    flex-direction: column;
  }
  .clb-btn { width: 100%; }
}

/* ── Section labels ───────────────────────────────────────────────────────── */

.clb-section-label {
  font-family: -apple-system, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9B7A60;
  margin-bottom: 0.6rem;
  margin-top: 1rem;
}

/* ── Bonus chapters ───────────────────────────────────────────────────────── */

#clb-bonus-section {
  margin-top: 0.5rem;
}

.clb-bonus-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.clb-bonus-badge {
  background: #C4923A;
  color: #FAF7F2;
  font-size: 0.6rem;
  padding: 2px 7px;
  border-radius: 2px;
  letter-spacing: 0.08em;
  font-family: -apple-system, sans-serif;
}

.clb-chapters-bonus .clb-chapter-tab {
  border-style: dashed;
  border-color: #C4923A;
  background: #FDFAF7;
}

.clb-chapters-bonus .clb-chapter-tab:hover {
  background: #FAF0E0;
  border-color: #A87830;
}

.clb-chapters-bonus .clb-chapter-tab.active {
  border-style: solid;
  border-color: #C4923A;
  background: #fff;
}

/* ── Onboarding ───────────────────────────────────────────────────────────── */

.clb-onboard-panel {
  background: #fff;
  border: 1px solid #D4C4B0;
  border-radius: 4px;
  padding: 2.5rem 2.25rem;
  max-width: 640px;
  margin: 2rem auto;
}

.clb-onboard-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.clb-onboard-icon {
  font-size: 2rem;
  color: #C4923A;
  margin-bottom: 0.75rem;
}

.clb-onboard-header h2 {
  font-family: Georgia, serif;
  font-size: 1.4rem;
  color: #3A2218;
  font-weight: normal;
  margin: 0;
}

.clb-onboard-ready {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #EDE3D8;
}

/* ── Onboarding ───────────────────────────────────────────────────────────── */

.clb-onboarding {
  background: #fff;
  border: 1px solid #D4C4B0;
  border-radius: 4px;
  padding: 3rem 2.5rem;
  text-align: center;
  max-width: 620px;
  margin: 0 auto;
}

.clb-onboarding-icon {
  font-size: 2.5rem;
  color: #C4923A;
  margin-bottom: 1rem;
  display: block;
}

.clb-onboarding h2 {
  font-family: Georgia, serif;
  font-size: 1.6rem;
  color: #3A2218;
  margin: 0 0 0.75rem;
  font-weight: normal;
}

.clb-onboarding-intro {
  font-size: 1rem;
  color: #6B4C35;
  line-height: 1.75;
  font-style: italic;
  margin: 0 0 2rem;
}

.clb-onboarding-tips {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
  text-align: left;
}

.clb-tip {
  display: flex;
  gap: 0.875rem;
  align-items: flex-start;
  background: #FAF7F2;
  border: 1px solid #EDE3D8;
  border-radius: 4px;
  padding: 0.875rem 1rem;
}

.clb-tip-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.clb-tip div {
  font-size: 0.9rem;
  color: #4A3020;
  line-height: 1.6;
  font-family: -apple-system, sans-serif;
}

.clb-tip strong {
  color: #3A2218;
}

.clb-btn-large {
  padding: 0.875rem 2.5rem;
  font-size: 1rem;
}

.clb-onboarding-note {
  font-size: 0.8rem;
  color: #9B7A60;
  font-style: italic;
  margin: 0.75rem 0 0;
  font-family: -apple-system, sans-serif;
}

/* ── Section labels ───────────────────────────────────────────────────────── */

.clb-section-label {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9B7A60;
  font-family: -apple-system, sans-serif;
  margin-bottom: 0.5rem;
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.clb-section-label:first-child { margin-top: 0; }

.clb-bonus-label { color: #C4923A; }

.clb-bonus-badge {
  background: #C4923A;
  color: #fff;
  font-size: 0.6rem;
  padding: 2px 6px;
  border-radius: 2px;
  letter-spacing: 0.08em;
}

/* ── Bonus tabs ───────────────────────────────────────────────────────────── */

.clb-bonus-tab {
  border-color: #E8C07A !important;
  background: #FDFAF5 !important;
}

.clb-bonus-tab.active {
  border-color: #C4923A !important;
  background: #fff !important;
}

.clb-bonus-tab .clb-chapter-num { color: #C4923A; }

/* ── Approved chapter actions ─────────────────────────────────────────────── */

.clb-approved-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.clb-approved-note {
  font-size: 0.8rem;
  color: #9B7A60;
  font-style: italic;
  font-family: -apple-system, sans-serif;
  margin: 0;
}

/* ── I'm Done button ──────────────────────────────────────────────────────── */

.clb-im-done-wrap {
  margin-top: 1.5rem;
  padding: 1.25rem 1.5rem;
  background: #FAF7F2;
  border: 1px solid #D4C4B0;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.clb-im-done-wrap p {
  margin: 0;
  font-size: 0.9rem;
  color: #6B4C35;
  font-style: italic;
  font-family: -apple-system, sans-serif;
}

/* ── Pricing strip ────────────────────────────────────────────────────────── */

.clb-pricing-strip {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: #F5EFE6;
  border: 1px solid #E8DDD0;
  border-radius: 4px;
  padding: 1rem 1.5rem;
  margin-bottom: 1.75rem;
}

.clb-pricing-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.clb-pricing-amount {
  font-family: Georgia, serif;
  font-size: 1.3rem;
  color: #3A2218;
  font-weight: normal;
}

.clb-pricing-label {
  font-size: 0.72rem;
  color: #9B7A60;
  font-family: -apple-system, sans-serif;
  text-align: center;
}

.clb-pricing-divider {
  color: #D4C4B0;
  font-size: 1.5rem;
  line-height: 1;
}

/* ── Book Report ──────────────────────────────────────────────────────────── */

.clb-report-label { color: #5C3D2E; }

.clb-report-badge {
  background: #5C3D2E;
  color: #FAF7F2;
  font-size: 0.6rem;
  padding: 2px 6px;
  border-radius: 2px;
  letter-spacing: 0.08em;
}

.clb-report-tab {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  background: #FAF7F2;
  border: 1px solid #5C3D2E;
  border-radius: 4px;
  padding: 0.875rem 1.25rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s;
  margin-bottom: 0.5rem;
}

.clb-report-tab:hover { background: #F5EFE6; }

.clb-report-tab .clb-chapter-num {
  color: #5C3D2E;
  font-size: 1.1rem;
}

.clb-report-tab .clb-chapter-title {
  font-size: 0.85rem;
  color: #5C3D2E;
  font-family: -apple-system, sans-serif;
}

.clb-report-content {
  max-height: 500px;
  overflow-y: auto;
  padding-right: 4px;
}

.clb-report-section {
  margin-bottom: 1.75rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid #EDE3D8;
}

.clb-report-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.clb-report-heading {
  font-family: -apple-system, sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #C4923A;
  margin: 0 0 0.75rem;
  font-weight: 600;
}

.clb-report-body {
  font-size: 0.975rem;
  line-height: 1.8;
  color: #2C1A0E;
  margin: 0;
}

.clb-report-loading {
  font-style: italic;
  color: #9B7A60;
  font-size: 0.9rem;
  text-align: center;
  padding: 2rem 0;
  font-family: -apple-system, sans-serif;
}

/* ── Finishing Touches ────────────────────────────────────────────────────── */

.clb-finishing-panel {
  margin-top: 2rem;
  background: #fff;
  border: 2px solid #C4923A;
  border-radius: 4px;
  padding: 2rem 2.25rem;
  position: relative;
}

.clb-finishing-header {
  border-bottom: 1px solid #EDE3D8;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.clb-finishing-header h2 {
  font-family: Georgia, serif;
  font-size: 1.4rem;
  color: #3A2218;
  margin: 0 0 0.25rem;
  font-weight: normal;
}

.clb-finishing-summary {
  background: #FAF7F2;
  border: 1px solid #E8DDD0;
  border-radius: 4px;
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.clb-finishing-summary h3 {
  font-family: Georgia, serif;
  font-size: 1.1rem;
  color: #3A2218;
  margin: 0 0 1rem;
  font-weight: normal;
}

.clb-finishing-detail {
  margin-bottom: 0.875rem;
  padding-bottom: 0.875rem;
  border-bottom: 1px solid #EDE3D8;
}

.clb-finishing-detail:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.clb-finishing-detail-label {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #C4923A;
  font-family: -apple-system, sans-serif;
  margin-bottom: 0.25rem;
}

.clb-finishing-detail-value {
  font-size: 0.9rem;
  color: #2C1A0E;
  line-height: 1.6;
}

/* ── Print Guide ──────────────────────────────────────────────────────────── */

.clb-print-guide {
  margin-top: 2rem;
  background: #FAF7F2;
  border: 1px solid #D4C4B0;
  border-radius: 4px;
  padding: 2rem 2.25rem;
}

.clb-print-guide h2 {
  font-family: Georgia, serif;
  font-size: 1.4rem;
  color: #3A2218;
  margin: 0 0 0.25rem;
  font-weight: normal;
}

.clb-print-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.clb-print-option {
  background: #fff;
  border: 1px solid #E8DDD0;
  border-radius: 4px;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.clb-print-option-name {
  font-family: Georgia, serif;
  font-size: 1rem;
  color: #3A2218;
}

.clb-print-option-desc {
  font-size: 0.875rem;
  color: #6B4C35;
  line-height: 1.65;
  font-family: -apple-system, sans-serif;
}

.clb-print-btn {
  align-self: flex-start;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  padding: 0.4rem 1rem;
  text-decoration: none;
}

/* ── Writing Style Picker ────────────────────────────────────────────────── */

.clb-style-picker {
  padding: 1.5rem 0 1rem;
}

.clb-style-intro {
  font-size: 1rem;
  color: #555;
  margin-bottom: 1.25rem;
  text-align: center;
}

.clb-style-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.clb-style-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 1rem 1.1rem;
  border: 2px solid #e0d9cf;
  border-radius: 10px;
  background: #faf8f5;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s, background 0.2s;
}

.clb-style-btn:hover {
  border-color: #a0896b;
  background: #f5f0e8;
}

.clb-style-btn.selected {
  border-color: #7a5c3a;
  background: #f0e8d8;
}

.clb-style-icon {
  font-size: 1.4rem;
  margin-bottom: 0.4rem;
}

.clb-style-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: #2c1f0e;
  margin-bottom: 0.2rem;
}

.clb-style-desc {
  font-size: 0.8rem;
  color: #7a6a58;
}

@media (max-width: 480px) {
  .clb-style-options {
    grid-template-columns: 1fr;
  }
}

/* ── Voice Input ─────────────────────────────────────────────────────────── */

.clb-input-buttons {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
}

.clb-btn-mic {
  background: #f5f0e8;
  border: 2px solid #e0d9cf;
  border-radius: 8px;
  font-size: 1.3rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  line-height: 1;
}

.clb-btn-mic:hover {
  background: #ede5d8;
  border-color: #a0896b;
}

.clb-btn-mic.listening {
  background: #fee2e2;
  border-color: #ef4444;
  animation: mic-pulse 1s infinite;
}

@keyframes mic-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
