/* Opt-in presentation only. Expanded content stays in the page's scroll flow. */
.compact-text,
.chat-message p.compact-text,
#assistant-root .compact-text,
#assistant-root .chat-message p.compact-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: inherit;
}

.copy-fold,
#assistant-root .copy-fold {
  min-width: 0;
  max-width: 100%;
  height: auto;
  max-height: none;
  overflow: visible;
  font-size: inherit;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.copy-fold > summary {
  min-height: 44px;
  padding: 8px 0;
  cursor: pointer;
  list-style: none;
}
.copy-fold > summary::-webkit-details-marker { display: none; }
.copy-fold > summary:focus-visible {
  outline: 3px solid #91b8a4;
  outline-offset: 3px;
  border-radius: 4px;
}
.copy-fold .copy-preview {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.copy-fold .copy-show,
.copy-fold .copy-hide { color: var(--green, #224e42); font-weight: 600; }
.copy-fold .copy-show { display: block; }
.copy-fold .copy-hide { display: none; }
.copy-fold[open] > summary .copy-preview,
.copy-fold[open] > summary .copy-show { display: none; }
.copy-fold[open] > summary .copy-hide { display: inline; }
.copy-fold > .copy-text,
#assistant-root .copy-fold > .copy-text {
  margin: 0;
  padding: 0;
  height: auto;
  max-height: none;
  overflow: visible;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: none;
  border: 0;
  font-size: inherit;
  line-height: inherit;
}
.copy-fold > button[data-action="fold-close"] {
  min-width: 44px;
  min-height: 44px;
  white-space: normal;
}

/* Match the existing short-message bubble, without a second padded full body. */
.chat-message .copy-fold,
#assistant-root .chat-message .copy-fold {
  padding: 3px 13px;
  background: white;
  border: 1px solid var(--line, #e7ece5);
  border-radius: 3px 15px 15px;
  font-size: 15px;
  line-height: 1.65;
}
.chat-message.user .copy-fold,
#assistant-root .chat-message.user .copy-fold {
  background: #e0eddf;
  border-color: #d2e2ce;
  border-radius: 15px 3px 15px 15px;
}

.bounded-controls,
#assistant-root .bounded-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.bounded-controls > button,
.bounded-controls > a,
.bounded-controls > summary { min-height: 44px; white-space: normal; }
.bounded-controls > button,
.bounded-controls > a { min-width: 44px; }
.bounded-controls :is(input, select, textarea) { min-height: 44px; min-width: 0; max-width: 100%; font-size: 16px; }

.folded-section,
.entry-card,
.entry-extra,
.memory-info,
.draft-editor,
.draft-summary,
.conversation-history { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.folded-section > summary { min-height: 44px; padding-block: 8px; cursor: pointer; }
.folded-section > summary:focus-visible { outline: 3px solid #91b8a4; outline-offset: 3px; }
.entry-extra { flex-basis: 100%; }
.entry-extra > .copy-fold,
.memory-info > .copy-fold,
.draft-summary > .copy-fold { margin-top: 4px; }
/* Clamp only merchant/body text, never the containing button, amount, or date. */
.compact-inline,
.entry-card .entry-info strong {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Keep controls adjacent to a bounded set of records, not at an endless list end. */
.bounded-controls { padding: 10px 0; margin-top: 8px; border-top: 1px solid var(--line); }
.bounded-controls > span { flex: 1 1 100%; font-size: 12px; color: var(--muted); }
.entry-card { border-bottom: 1px solid var(--line); }
.entry-card:last-child { border-bottom: 0; }
.entry-card > .entry { border-bottom: 0; }
.entry-extra { padding: 0 14px 10px; font-size: 13px; }
#assistant-root .chat-row > .row-copy { grid-column: 2; min-width: 0; font-size: 12px; }
#assistant-root .conversation-history { margin-bottom: 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); }
#assistant-root .conversation-history > summary { font-size: 13px; color: var(--green); }
#assistant-root .conversation-history .chat-message { max-width: 100%; }
#settings-panel .memory-row { align-items: flex-start; }
#settings-panel .memory-info { flex: 1 1 0; min-width: 0; }
#settings-panel .memory-info > small { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
#settings-panel .memory-row > button { flex: 0 0 auto; min-width: 44px; min-height: 44px; }
#settings-panel > details.setting > summary { font-size: 14px; font-weight: 600; color: var(--green); }
.draft-editor > .draft-summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 10px; padding: 8px 0; min-height: 48px; cursor: pointer; }
.draft-summary > strong { white-space: nowrap; font-size: 15px; }
.draft-summary > small, .draft-summary > .draft-expand-label { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.draft-editor[open] > .draft-summary { margin-bottom: 12px; }
.draft-editor > button { min-height: 44px; }

/* Keep native hidden authoritative even inside opt-in flex containers. */
:is(.compact-text, .copy-fold, .bounded-controls, .folded-section, .entry-card, .entry-extra, .memory-info, .draft-editor, .draft-summary, .conversation-history)[hidden],
:is(.copy-fold, .bounded-controls, .folded-section, .entry-card, .entry-extra, .memory-info, .draft-editor, .draft-summary, .conversation-history) [hidden] {
  display: none !important;
}
@media (prefers-reduced-motion: reduce) {
  :is(.compact-text, .copy-fold, .bounded-controls, .folded-section, .entry-card, .entry-extra, .memory-info, .draft-editor, .draft-summary, .conversation-history),
  :is(.copy-fold, .bounded-controls, .folded-section, .entry-card, .entry-extra, .memory-info, .draft-editor, .draft-summary, .conversation-history) * {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
