
/* --- Prep sheet (conditions 3, 5, 6, and 7) ------------------------------ */

.prep-sheet {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 18px 20px;
}

.prep-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.prep-head strong {
  color: #003b4e;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
}

.prep-status {
  color: #2f7f69;
  font-size: 12px;
  font-weight: 700;
}

.prep-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
}

.prep-section-head {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.prep-section-head strong {
  color: #003b4e;
  font-size: 14px;
}

.prep-section-badge {
  color: #1d4f41;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

.prep-section-prompt {
  color: #52646c;
  font-size: 12.5px;
  line-height: 1.4;
  margin: 0;
}

.prep-commit-input {
  border: 1px solid #b9d5df;
  font: inherit;
  font-size: 13px;
  line-height: 1.45;
  min-height: 90px;
  padding: 8px 10px;
  resize: vertical;
}

.prep-commit-input:focus {
  border-color: var(--accent);
  outline: none;
}

.prep-section-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prep-extend-button,
.prep-connect-button {
  background: var(--accent);
  border: 0;
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
}

.prep-extend-button:disabled,
.prep-connect-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.prep-extend-button.prep-extend-ready {
  box-shadow: 0 0 0 3px rgba(211, 151, 33, 0.28);
  outline: 1px solid #d39721;
  animation: prep-ai-unlock 500ms ease-out;
}

.prep-ai-gate-hint {
  color: #667085;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

.prep-ai-gate-hint.prep-ai-gate-ready {
  color: #7b5713;
}

.prep-draft-summary {
  align-items: center;
  border-block: 1px solid #b9d5df;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 9px 0;
}

.prep-draft-summary-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.prep-draft-summary-copy strong {
  color: #003b4e;
  font-size: 12px;
}

.prep-draft-summary-copy span {
  color: #667085;
  font-size: 10.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prep-draft-edit {
  background: transparent;
  border: 1px solid #7fa9b7;
  color: #00688b;
  cursor: pointer;
  flex: 0 0 auto;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 9px;
}

.prep-draft-collapsed > .prep-field-grid,
.prep-draft-collapsed > .prep-section-actions,
.prep-draft-collapsed > .prep-prompt-editor {
  display: none;
}

@keyframes prep-ai-unlock {
  from { box-shadow: 0 0 0 8px rgba(211, 151, 33, 0); }
  to { box-shadow: 0 0 0 3px rgba(211, 151, 33, 0.28); }
}

.prep-section-failed {
  color: #a33;
  font-size: 12px;
  margin: 0;
}

.prep-section-loading {
  color: #667085;
  font-size: 12.5px;
  margin: 0;
}

.prep-extension {
  background: transparent;
  border: 0;
  border-top: 1px solid #d6e8ee;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 0 0;
}

.prep-extension-heading {
  color: #00688b;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.prep-extension .board-list {
  margin: 0;
  padding-left: 18px;
}

.prep-extension .board-list li {
  font-size: 12.5px;
  line-height: 1.45;
  margin-bottom: 4px;
}

.prep-extension-question {
  border-top: 1px dashed #cfe3ec;
  color: #1d4f41;
  font-size: 12.5px;
  font-style: italic;
  margin: 4px 0 0;
  padding-top: 8px;
}

.prep-connect {
  border-top: 2px solid #d6e8ee;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
}

.prep-connect-hint {
  color: #667085;
  font-size: 12px;
  margin: 0;
}

.prep-prompt-editor {
  background: transparent;
  border: 0;
  border-top: 1px solid #ddd5c0;
  padding: 10px 0 0;
}

.prep-prompt-editor summary {
  color: #6b5d2e;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.prep-prompt-note {
  color: #6b6b5a;
  font-size: 11.5px;
  line-height: 1.4;
  margin: 8px 0;
}

.prep-prompt-input {
  border: 1px solid #d8cfae;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11.5px;
  line-height: 1.45;
  padding: 8px;
  resize: vertical;
  width: 100%;
}

.prep-prompt-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.prep-prompt-actions button {
  background: #6b5d2e;
  border: 0;
  color: #fff;
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 800;
  padding: 6px 10px;
}

.prep-prompt-actions .prep-prompt-reset {
  background: #98917c;
}

.prep-prompt-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.prep-prompt-custom-flag {
  color: #8a6d1d;
  font-size: 11.5px;
  font-weight: 800;
  margin: 6px 0 0;
}

.prep-sheet .board-list {
  list-style: disc;
}

/* --- In-workspace task chrome ---------------------------------------------
   showScreen sets body.task-active BEFORE syncTopbarHeight measures, so the
   hidden topbar's zero height flows into --topbar-height automatically. */

.reader-toolbar .timer {
  align-items: baseline;
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  margin-left: auto;
  white-space: nowrap;
}

.reader-toolbar .timer strong {
  font-size: 18px;
}

.reader-toolbar .role-chip {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Assigned-side strip at the top of the right panel. */
.chat-panel .role-chip {
  background: #eef5f8;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  padding: 8px 14px;
}

/* --- Sheet-mode aside: sheet scrolls, guide stays docked ------------------ */

.sheet-mode .prep-sheet {
  flex: 1 1 auto;
  min-height: 120px;
}

/* Chat conditions (2, 3, 5, 6, 7): the AI docks under the reader column,
   NotebookLM style — the chat belongs to the document it answers about,
   sticking to the bottom of the reading area as a slim strip that grows
   only as the conversation does. The right panel stays whole for the prep
   sheet (3/5/6/7) or notes (2). */
.chat-tools.guide-dock {
  background: #fff;
  border-top: 2px solid var(--line);
  flex: 0 0 auto;
  /* Rows: resize handle, header, messages, C7 suggestion, form (.chat-note is display:none). */
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
}

/* Grab strip on the dock's top edge: drag up/down to trade document space
   for conversation space. */
.guide-dock-resize {
  cursor: row-resize;
  display: none;
  height: 8px;
  margin-bottom: -8px;
  touch-action: none;
  z-index: 2;
}

.guide-dock .guide-dock-resize {
  display: block;
}

.guide-dock-resize:hover,
.guide-dock.dock-resizing .guide-dock-resize {
  background: var(--accent-soft);
}

.guide-dock.dock-resized .chat-messages {
  max-height: none;
}

.guide-dock.guide-collapsed .guide-dock-resize {
  display: none;
}

.guide-dock.guide-collapsed {
  height: auto !important;
}

.chat-tools.guide-dock .chat-note {
  display: none;
}

/* Slim one-line header: kicker + quiet subtitle on the left, status and
   Hide pushed to the right (no more button floating mid-bar). */
.chat-tools.guide-dock .chat-header {
  gap: 12px;
  justify-content: flex-start;
  padding: 8px 18px;
}

.guide-dock .chat-header div {
  align-items: baseline;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.guide-dock .chat-header p,
.guide-dock .chat-header > span {
  white-space: nowrap;
}

.guide-dock .chat-header strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guide-dock .chat-header p {
  margin: 0;
}

.guide-dock .chat-header strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.guide-dock .chat-header > span {
  margin-left: auto;
  order: 2;
}

.guide-dock #guideToggle {
  order: 3;
}

.sheet-mode .guide-dock #guideToggle {
  margin-left: auto;
}

/* The chat column shares the document's 760px measure and symmetric
   padding, so chat lines align with the text above and stay readable at
   any window width. */
.guide-dock .chat-messages {
  background: #fff;
  max-height: 30vh;
  padding: 14px calc(max(34px, (100% - 760px) / 2));
}

/* Assistant replies read as text, not floating cards: the dark user bubble
   is the only "who's speaking" marker the thread needs. */
.guide-dock .message.assistant {
  background: none;
  border: 0;
  box-shadow: none;
  max-width: none;
  padding: 0;
}

.guide-dock .message.user {
  max-width: 75%;
}

/* Keep the empty messages div in the grid: it owns the 1fr row, so a
   user-resized dock grows blank chat space — not the form. display:none
   here would hand the 1fr row to the form and stretch the Send button. */
.guide-dock .chat-messages:empty {
  padding: 0;
}

.chat-focus-suggestion {
  background: #fff8e8;
  border: 1px solid rgba(199, 123, 24, 0.58);
  border-left: 4px solid #c77b18;
  margin: 0 calc(max(34px, (100% - 760px) / 2)) 10px;
  padding: 9px 12px;
}

.chat-focus-suggestion[hidden] {
  display: none;
}

.chat-focus-suggestion span {
  color: #95580d;
  display: block;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
  text-transform: uppercase;
}

.chat-focus-suggestion p {
  color: #4b351b;
  font-size: 13px;
  line-height: 1.35;
  margin: 0;
}

/* Composer: one rounded container — borderless textarea on top, circular
   send button bottom-right (ChatGPT-style), aligned with the text column. */
.guide-dock .chat-form {
  background: #fff;
  border: 1px solid #bdc5cf;
  border-radius: 18px;
  border-top: 1px solid #bdc5cf;
  gap: 4px;
  margin: 0 calc(max(34px, (100% - 760px) / 2)) 12px;
  padding: 10px 12px;
}

.guide-dock .chat-form:focus-within {
  border-color: var(--accent);
}

.guide-dock .chat-form textarea {
  background: none;
  border: 0;
  min-height: 40px;
  outline: none;
  padding: 2px 4px;
  resize: none;
}

.guide-dock .chat-form button {
  border-radius: 999px;
  font-size: 15px;
  height: 30px;
  line-height: 1;
  padding: 0;
  width: 30px;
}

.chat-tools.guide-collapsed .chat-messages,
.chat-tools.guide-collapsed .chat-focus-suggestion,
.chat-tools.guide-collapsed .chat-form {
  display: none;
}

#guideToggle {
  background: #fff;
  border: 1px solid #b9d5df;
  color: #003b4e;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
}
