.analysis-history{width:min(1280px,94vw);height:min(850px,88vh);max-height:88vh;padding:20px;border:1px solid var(--line);border-radius:14px;color:var(--ink);background:#fff;box-shadow:0 20px 60px rgba(14,29,64,.2)}
.analysis-history[open]{display:flex;flex-direction:column;gap:12px}
.analysis-history::backdrop{background:rgba(10,24,52,.4)}
.history-header{display:flex;align-items:flex-start;justify-content:space-between;gap:20px}
.history-header h2{margin:0 0 6px}.history-header .hint,.analysis-history>p{margin:0}
.history-filters{display:grid;grid-template-columns:minmax(0,2fr) minmax(140px,1fr);gap:14px}
.history-workspace{display:grid;grid-template-columns:minmax(240px,32%) minmax(0,1fr);gap:18px;flex:1;min-height:0;overflow:hidden}
.history-list,.history-detail{min-height:0;overflow:auto;overscroll-behavior:contain}
.history-list{display:flex;flex-direction:column;gap:10px;padding-right:4px}
.history-item{display:flex;flex-direction:column;gap:8px;flex-shrink:0;width:100%;text-align:left;white-space:normal;overflow-wrap:anywhere;padding:12px}
.history-item strong{font-size:13px}.history-item span{font-size:14px;line-height:1.6}.history-item small{color:var(--muted);font-weight:400}
.history-item.selected{border-color:var(--blue);background:var(--safe)}
.history-detail{padding:0 12px 12px;border-left:1px solid var(--line)}
.history-detail h3{margin:0 0 12px;font-size:16px}.history-question{line-height:1.7;white-space:pre-wrap;background:var(--safe);padding:12px;border-radius:10px}
.history-detail details{margin-top:14px}.history-detail summary{cursor:pointer;color:var(--deep);font-weight:700}
.history-answer{line-height:1.65}.history-answer [data-redirect]{display:none}
.history-footer{justify-content:flex-end;padding-top:10px;border-top:1px solid var(--line);flex-shrink:0}
.page-header{display:flex;justify-content:space-between;align-items:flex-start;gap:24px;margin-bottom:18px;border-left:4px solid var(--blue);padding-left:18px}
.page-header h1{margin:0}
.page-header .lede{margin:8px 0 0}
.steps{margin-bottom:18px}
.steps li{border-radius:10px}
.project{padding:16px 18px;margin-bottom:18px}
.workspace{display:grid;grid-template-columns:300px minmax(0,1fr);gap:18px;align-items:start}
.entry-panel{position:sticky;top:18px}
/* Panel only — never use bare .coach (collides with .bubble.coach) */
.coach-panel{min-height:0;display:flex;flex-direction:column;align-content:stretch;gap:0;padding:16px}
.coach-header{padding-bottom:14px;border-bottom:1px solid var(--line);margin-bottom:12px;flex:0 0 auto;display:flex;justify-content:space-between;align-items:flex-start;gap:16px}
.coach-header .eyebrow{margin:0 0 6px}
.coach-header h2{margin-bottom:8px}
.thread{flex:1 1 auto;max-height:38vh;min-height:90px;display:flex;flex-direction:column;gap:14px;overflow:auto;border:0;padding:4px 6px 4px 0;background:transparent;border-radius:0;position:relative;align-items:stretch}
.thread.empty{justify-content:center;align-items:center;min-height:60px;text-align:center;padding:12px}
.privacy-hint{font-size:12px;color:var(--muted);margin:0;line-height:1.45}
@media(min-width:901px){main{padding-top:18px}.page-header{margin-bottom:12px}.steps{display:none}.project{padding:12px 16px;margin-bottom:12px}.project .section-title{margin-bottom:8px}.project h2{font-size:16px}.coach-header{padding-bottom:8px;margin-bottom:6px}.coach-header .eyebrow{display:none}.composer{padding:10px;margin-top:8px;gap:6px}.coach-header h2{font-size:19px}.coach-header .hint{margin:4px 0}}
/* Bubbles must not shrink inside the scroll thread, or text spills and stacks */
.bubble{display:block;position:relative;flex:0 0 auto;flex-shrink:0;align-self:flex-start;max-width:78%;width:fit-content;min-width:0;min-height:0;height:auto;max-height:none;border-radius:14px;padding:12px 14px;line-height:1.65;overflow:visible;overflow-wrap:anywhere;word-break:break-word;float:none;clear:both}
.bubble.user{align-self:flex-end;margin-left:auto;background:var(--safe);border:1px solid var(--margin)}
.bubble.coach-msg{align-self:flex-start;margin-right:auto;background:#fff;border:1px solid var(--line);box-shadow:0 2px 8px rgba(20,40,80,.04);max-width:82%;width:auto}
.bubble.coach-msg > *{position:static;float:none;transform:none;max-width:100%}
.coach-label{display:flex;align-items:center;gap:7px;margin:0 0 8px;color:var(--deep);font-weight:700;font-size:12px;line-height:1.4}
.coach-label::before{content:"";width:8px;height:8px;border-radius:50%;background:var(--blue);flex:0 0 auto}
.coach-intro,.bubble.coach-msg > p{display:block;margin:0 0 10px;line-height:1.65;min-width:0;overflow-wrap:anywhere;word-break:break-word}
.coach-intro:last-child,.bubble.coach-msg > p:last-child{margin-bottom:0}
.guide-block{display:block;background:#fff;border:1px solid var(--line);border-radius:10px;padding:11px 12px;margin:10px 0 0;min-width:0;min-height:0;height:auto;overflow:visible;overflow-wrap:anywhere;word-break:break-word}
.guide-block:first-of-type{margin-top:8px}
.guide-block strong,.guide-block summary{display:block;font-size:13px;color:var(--deep);margin:0 0 6px;line-height:1.45;font-weight:700}
.guide-block p{display:block;margin:0;line-height:1.65}
.guide-block p + p{margin-top:6px}
.guide-block ol,.guide-block ul{display:block;margin:8px 0 0;padding-left:1.35em;line-height:1.65}
.guide-block li{display:list-item;margin:6px 0;padding:0;line-height:1.65;min-height:0;height:auto;overflow:visible;overflow-wrap:anywhere;word-break:break-word}
.guide-list{display:block;margin:8px 0 0;padding-left:1.35em;min-width:0;line-height:1.65;overflow-wrap:anywhere;word-break:break-word}
.guide-list li{display:list-item;margin:6px 0;line-height:1.65}
.book-check{display:flex;gap:8px;align-items:flex-start;background:#fff8e8;border:1px solid #f0d9a8;border-radius:10px;padding:10px 12px;margin:10px 0 0;color:#6d4c0f;font-size:13px;line-height:1.6;min-width:0;min-height:0;height:auto;overflow:visible;overflow-wrap:anywhere;word-break:break-word}
.book-check strong{flex:0 0 auto;min-width:0;line-height:1.6}
.book-check span{flex:1 1 auto;min-width:0;line-height:1.6}
.redirect-row{margin-top:10px}
.feedback-row{margin-top:12px;flex-wrap:wrap}
.composer{display:grid;gap:10px;margin-top:14px;background:#fbfcfe;border:1px solid var(--line);border-radius:12px;padding:14px;flex:0 0 auto}
.composer textarea{resize:none;min-height:78px}
.composer-bar{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap}
.composer .actions{margin-left:auto}
.sources{margin-top:18px}
.sources summary{padding:2px 0 10px}
.sources[open] summary{border-bottom:1px solid var(--line);margin-bottom:14px}
button.is-loading{position:relative;color:transparent!important;pointer-events:none}
button.is-loading::after{content:"";position:absolute;left:50%;top:50%;width:16px;height:16px;margin:-8px 0 0 -8px;border:2px solid rgba(255,255,255,.75);border-top-color:transparent;border-radius:50%;animation:spin .7s linear infinite}
button.quiet.is-loading::after{border-color:rgba(16,42,99,.35);border-top-color:transparent}
@keyframes spin{to{transform:rotate(360deg)}}
@media(max-width:900px){
  .page-header{display:block}
  .page-header .site-nav{display:inline-flex;margin-top:14px}
  .workspace{grid-template-columns:1fr}
  .entry-panel{position:static}
  .skill-buttons{display:grid;grid-template-columns:repeat(2,1fr);gap:8px}
  .coach-panel{min-height:auto}
  .thread{max-height:58vh;min-height:280px}
  .composer-bar{align-items:stretch}
  .composer .actions{margin-left:0;width:100%;justify-content:flex-end}
  .bubble,.bubble.coach-msg{max-width:94%}
}


.coach-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: 16px;
  flex-shrink: 0;
}

.reset-btn {
  background: none;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.reset-btn:hover {
  background: #f5f5f5;
  border-color: #999;
  color: #333;
}

.reset-btn:active {
  background: #eee;
}

.confirm-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 24, 52, 0.35);
  backdrop-filter: blur(2px);
  z-index: 80;
}

.confirm-overlay.is-open {
  display: flex;
}

.confirm-card {
  width: min(560px, 90vw);
  background: #fff;
  border: 1px solid #d6deea;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 18px 40px rgba(14, 29, 64, 0.22);
}

.confirm-title {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.4;
}

.confirm-message {
  margin: 0;
  color: #4b556f;
  white-space: pre-line;
  line-height: 1.65;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.confirm-actions button {
  min-width: 90px;
  padding: 8px 14px;
  border-radius: 10px;
}

.confirm-ok {
  background: #1b3f9f;
  color: #fff;
  border: 1px solid #1b3f9f;
}


.skill-brief{margin:0 0 12px;padding:12px 14px;border:1px solid var(--line);border-radius:10px;background:#f8fafc;display:grid;gap:6px}
.skill-brief p{margin:0;line-height:1.6;font-size:13px}
.skill-brief strong{display:inline-block;min-width:5em;margin-right:8px;color:var(--deep)}
.skill-brief .brief-close{color:var(--deep);font-weight:700}
.operator-row{display:flex;flex-wrap:wrap;gap:8px;margin-top:4px}
.operator-chip{display:inline-block;border:1px solid var(--margin);background:var(--safe);color:var(--deep);border-radius:999px;padding:3px 9px;font-size:12px;font-weight:700;line-height:1.4}
.skill-progress{margin:0 0 12px;padding:12px 14px;border:1px solid var(--line);border-radius:10px;background:#fff}
.skill-progress .progress-head{font-size:13px;font-weight:700;color:var(--deep);margin-bottom:8px}
.skill-progress ol{margin:0;padding-left:0;list-style:none;display:grid;gap:6px}
.skill-progress li{display:flex;gap:8px;align-items:flex-start;font-size:13px;line-height:1.5}
.skill-progress .mark{flex:0 0 auto;min-width:3em;font-size:12px;font-weight:700}
.skill-progress li.passed .mark{color:#1d6f42}
.skill-progress li.current .mark{color:var(--blue)}
.skill-progress li.failed .mark{color:#9a3412}
.skill-progress li.todo .mark{color:var(--muted)}
.skill-progress .hint{margin:8px 0 0}
.book-review{display:block;border-radius:10px;padding:11px 12px;margin:10px 0 0;font-size:13px;line-height:1.65;min-width:0}
.book-review strong{display:block;margin:0 0 6px}
.book-review p{margin:0}
.book-review ul{margin:8px 0 0;padding-left:1.2em}
.book-review li{margin:4px 0}
.book-review .ok{color:#1d6f42}
.book-review .no{color:#9a3412}
.book-review.is-pending{background:#fff8e8;border:1px solid #f0d9a8;color:#6d4c0f}
.book-review.is-passed{background:#eef8f1;border:1px solid #bfe5cd;color:#14532d}
.book-review.is-failed{background:#fff4e5;border:1px solid #f0c36d;color:#9a3412}
.model-status{margin:.45rem 0 0;color:#58606b;font-size:.9rem}.model-status.live{color:#17603a}.model-status.fixture{color:#8a5a12}.model-warning{margin:.6rem 0;padding:.65rem .8rem;border-left:4px solid #d18a20;background:#fff7e8;color:#70460b;border-radius:.25rem}.human-check{margin:.6rem 0;padding:.6rem .75rem;background:#f4f6f8;border-radius:.35rem;color:#374151}
.review-choice{display:flex;align-items:center;gap:8px;margin:8px 0;font-weight:400;color:var(--muted)}
.review-choice input{width:16px;height:16px;padding:0;margin:0;flex:0 0 auto}
