/* Resume assistant workspace and chat panel.
   Tokens only. No gradients, no animation, no uppercase text. */

:root {
  --w-assistant: 380px;
}

.resume-banner-slot:empty {
  display: none;
}

/* Fit-to-window Create resume workspace: active only while .resume-workspace is visible on screen. */
.app-shell:has(.resume-workspace:not(.hidden)) {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.app-shell:has(.resume-workspace:not(.hidden)) .main-column {
  height: 100%;
  min-height: 0;
}

.app-shell:has(.resume-workspace:not(.hidden)) .main-column > main,
.app-shell:has(.resume-workspace:not(.hidden)) .main-column > main > div {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.app-shell:has(.resume-workspace:not(.hidden)) .main-content {
  flex: 1 1 auto;
  min-height: 0;
  max-width: none;
  padding-bottom: var(--sp-4);
  display: flex;
  flex-direction: column;
}

.app-shell:has(.resume-workspace:not(.hidden)) .tabs-bar {
  margin-bottom: 0;
}

.app-shell:has(.resume-workspace:not(.hidden)) .resume-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Two panes side by side: preview (~60%) on the left, assistant (~40%, never under 380px) on the right. */
.resume-workspace {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(var(--w-assistant), 40%);
  gap: var(--sp-4);
}

.resume-main {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.resume-preview-host {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.resume-assistant-host {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Panel */
.assistant-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: var(--page);
  border: 1px solid var(--rule);
  border-radius: var(--r-box);
}

.assistant-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--rule);
}

.assistant-title {
  margin: 0;
  font-size: var(--t-body-size);
  line-height: var(--t-body-line);
}

.assistant-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.assistant-chat {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto; /* only when the window is very short: nothing is ever cut off */
  overscroll-behavior: contain;
}

/* The conversation keeps room for the last reply (about three rows of text); the waiting cards give way first. */
.assistant-log {
  flex: 1 1 8rem;
  min-height: 4.5rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--sp-4);
}

.assistant-tray,
.assistant-footer,
.assistant-composer,
.assistant-working,
.assistant-notices {
  flex: 0 0 auto;
}

.assistant-tray,
.assistant-footer,
.assistant-composer,
.assistant-working,
.assistant-notices {
  padding: var(--sp-2) var(--sp-4);
}

.assistant-tray {
  display: flex;
  flex: 0 1 auto;
  flex-direction: column;
  min-height: 0;
  border-top: 1px solid var(--rule);
  padding-top: var(--sp-3);
}

/* The count, Discard all and Save to resume share one row; Accept all / Reject all show under it while changes wait. */
.assistant-tray-head {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}

.assistant-tray-count {
  min-width: 0;
}

/* Discard all and Save to resume sit together on the right of the count. */
.assistant-tray-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: var(--sp-1);
  margin-left: auto;
}

/* Undo last save is a text button at the end of the Saved notice. */
.assistant-undo-save {
  align-self: flex-start;
}

/* The waiting cards take what the conversation and the composer leave, and scroll inside it. */
.assistant-tray-cards {
  flex: 1 1 auto;
  min-height: 7rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.assistant-tray-cards:empty {
  display: none;
}

.assistant-working:empty,
.assistant-notices:empty,
.assistant-footer:empty {
  display: none;
}

.assistant-composer {
  padding-bottom: var(--sp-3);
}

/* The hint, the character count and Send share one row. */
.assistant-send-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.assistant-send-meta {
  flex: 1 1 auto;
  min-width: 0;
}

/* The box grows with its text (the page sets its rows, up to 10), then scrolls. */
.assistant-input {
  min-height: 4.5rem;
  max-height: calc(10 * var(--t-body-line) + var(--sp-4));
  overflow-y: auto;
}

.assistant-count-near {
  color: var(--caution);
}

.assistant-count-over {
  color: var(--bad);
}

.assistant-privacy {
  flex: 0 0 auto;
  margin: 0;
  padding: 0 var(--sp-4) var(--sp-3);
  max-width: none;
  font-size: var(--t-meta-size);
  line-height: var(--t-meta-line);
}

.assistant-notices .notice,
.assistant-log .notice {
  margin-bottom: 0;
}

/* Intro and examples */
.assistant-intro-text {
  margin: 0;
}

.assistant-examples {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.assistant-example {
  width: 100%;
  justify-content: flex-start;
  height: auto;
  padding-top: var(--sp-2);
  padding-bottom: var(--sp-2);
  text-align: left;
  white-space: normal;
}

/* Messages */
.assistant-msg {
  border: 1px solid var(--rule);
  border-radius: var(--r-box);
  padding: var(--sp-3);
}

.assistant-msg-user {
  background: var(--navy-wash);
}

.assistant-msg-assistant {
  background: var(--wash);
}

.assistant-msg-who {
  display: block;
  font-size: var(--t-meta-size);
  line-height: var(--t-meta-line);
  color: var(--ink-2);
}

.assistant-msg-text {
  margin: 0;
  max-width: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.assistant-list {
  margin: var(--sp-2) 0 0;
  padding-left: var(--sp-4);
}

.assistant-reason {
  display: inline;
}

/* Cards */
.assistant-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-box);
  padding: var(--sp-3);
  background: var(--page);
}

.assistant-card-accepted {
  border-color: var(--good);
}

.assistant-card-rejected {
  background: var(--wash);
}

.assistant-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-2);
}

.assistant-badge {
  padding: 0 var(--sp-2);
  border: 1px solid var(--navy);
  border-radius: var(--r-ctl);
  color: var(--navy);
  font-size: var(--t-meta-size);
  line-height: var(--t-meta-line);
  font-weight: 600;
}

.assistant-place {
  font-size: var(--t-meta-size);
  line-height: var(--t-meta-line);
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

.assistant-line-label {
  display: block;
}

.assistant-line-text {
  margin: 0;
  max-width: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.assistant-struck {
  text-decoration: line-through;
  color: var(--ink-2);
}

.assistant-card .notice {
  margin-bottom: 0;
}

/* Several cautions share one box. */
.assistant-cautions {
  display: block;
  padding: var(--sp-2) var(--sp-3);
}

.assistant-cautions-list {
  margin: var(--sp-2) 0 0;
  font-size: var(--t-meta-size);
  line-height: var(--t-meta-line);
}

.assistant-card-actions {
  justify-content: flex-end;
}

/* A tall card in the tray keeps its Reject and Accept buttons at the bottom of the tray while it scrolls. */
.assistant-tray-cards .assistant-card-actions {
  position: sticky;
  bottom: 0;
  padding-top: var(--sp-2);
  background: var(--page);
}

/* Project card */
.assistant-rich-title {
  margin: 0;
  max-width: none;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.assistant-rich-detail,
.assistant-rich-year {
  margin: 0;
  max-width: none;
  overflow-wrap: anywhere;
}

.assistant-bullets {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.assistant-bullet {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}

.assistant-bullet-text {
  flex: 1 1 12rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.assistant-bullet-editing {
  align-items: stretch;
}

.assistant-bullet-input {
  flex: 1 1 12rem;
  min-width: 0;
}

.assistant-sources-btn {
  align-self: flex-start;
}

.assistant-sources {
  margin: 0;
  padding-left: var(--sp-4);
}

/* Print on */
.assistant-print {
  border-top: 1px solid var(--rule);
  padding-top: var(--sp-2);
}

.assistant-print-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.assistant-print-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}

.assistant-print-details {
  width: 100%;
}

/* The summary line is a link that opens the list; the list's own "none" marker is not inherited. */
.assistant-print-summary {
  cursor: pointer;
  padding: var(--sp-1) 0;
  color: var(--navy);
  text-decoration: underline;
  font-size: var(--t-meta-size);
  line-height: var(--t-meta-line);
  list-style: disclosure-closed inside;
}

.assistant-print-details[open] > .assistant-print-summary {
  list-style-type: disclosure-open;
}

.assistant-fit {
  margin-left: auto;
}

/* Left out */
.assistant-leftout-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.assistant-phrase {
  height: auto;
  padding-top: var(--sp-1);
  padding-bottom: var(--sp-1);
  text-align: left;
  white-space: normal;
}

.assistant-saved-line {
  margin: 0;
  max-width: none;
}

/* Preview (left pane) */
.assistant-preview {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  max-width: none;
}

.assistant-preview-toolbar {
  flex: 0 0 auto;
}

.assistant-preview-version-wrap {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  max-width: 100%;
}

.assistant-preview-select {
  width: auto;
  max-width: 100%;
  min-height: 36px;
}

.assistant-preview-status-row {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}

.assistant-preview-status-row:empty {
  display: none;
}

.assistant-preview-status {
  margin: 0;
}

.assistant-preview-tick {
  min-height: 36px;
  font-size: var(--t-meta-size);
  line-height: var(--t-meta-line);
}

.assistant-preview-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

/* The page picture fits the pane width by default. A zoom step makes it larger and the area scrolls. */
.assistant-preview-image {
  overflow-x: auto;
}

.assistant-preview-image .resume-page-img {
  width: 100%;
}

.assistant-zoom-1 .resume-page-img {
  width: 125%;
}

.assistant-zoom-2 .resume-page-img {
  width: 150%;
}

.assistant-zoom-3 .resume-page-img {
  width: 200%;
}

/* A refresh keeps the previous picture on screen, dimmed, until the new one is ready. */
.assistant-dim {
  opacity: 0.5;
}

/* A quiet line under the toolbar: lines that end with one word, and the button that asks the assistant to shorten them. */
.assistant-fit-notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}

.assistant-fit-text {
  margin: 0;
  max-width: none;
}

/* Room left on the shown version: one line of text, then quiet buttons that wrap (up to four). */
.assistant-room {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  min-width: 0;
}

.assistant-room-text {
  overflow-wrap: anywhere;
}

.assistant-room-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  min-width: 0;
}

.assistant-room-chip {
  max-width: 100%;
  height: auto;
  min-height: 36px;
  white-space: normal;
  text-align: left;
  overflow-wrap: anywhere;
}

.assistant-room-note:empty {
  display: none;
}

.assistant-zoom-bar {
  align-items: center;
  gap: var(--sp-2);
}

.assistant-bulk {
  justify-content: flex-end;
}

/* A panel too short for the conversation, a waiting card, a saved summary and the message box together (a phone, a phone
   with the keyboard up, a small laptop window, or any window with the "details changed" banner above): only the
   conversation shrinks. The waiting cards keep a small area of their own that scrolls, the message box and Send stay at
   the bottom, and everything else scrolls above them, so nothing is ever drawn over the box or its buttons. This is
   about the panel's height, not the window's, so it always applies. */
.assistant-tray {
  flex-shrink: 0;
}

.assistant-tray-cards {
  flex: 0 0 auto;
  max-height: max(7rem, calc(100vh - 30rem));
  max-height: max(7rem, calc(100dvh - 30rem));
}

.assistant-composer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: var(--page);
  border-top: 1px solid var(--rule);
}

/* The box stops growing at about five lines and scrolls, so a long note does not push the conversation away. */
.assistant-input {
  max-height: 7.5rem;
}

/* Narrow screens: the paper fills the page; the assistant opens as a bottom sheet (v7-resume.css). */
@media (max-width: 899px) {
  .app-shell:has(.resume-workspace:not(.hidden)) .main-content {
    padding-bottom: calc(var(--sp-12) + var(--sp-2));
  }

  .resume-workspace {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
  }

  .assistant-preview-select,
  .assistant-preview-tick,
  .assistant-room-chip {
    min-height: 44px;
  }

  /* The panel is short even in a tall phone window: the cards scroll in a smaller area. */
  .assistant-tray-cards {
    max-height: 10rem;
  }

  .assistant-header {
    flex-shrink: 0;
  }
}
