.table-wrap {
  overflow-x: auto;
  margin: 12px 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bubble-a);
}

.chat-request-error, #validate-status.err {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg-group.asst .bubble.chat-request-error {
  color: var(--pink-d);
}

#settings-overlay{
  width:100%;height:100%;max-width:none;max-height:none;
  border:0;padding:0;margin:0;color:inherit;box-sizing:border-box;
}
#settings-overlay:not([open]){display:none}
#settings-overlay::backdrop{background:transparent}
@media(prefers-reduced-motion:no-preference){
  #settings-overlay{transition:opacity 160ms ease,visibility 160ms,display 180ms allow-discrete,overlay 180ms allow-discrete}
  #settings-overlay:not([open]){opacity:0;visibility:hidden}
  @starting-style{
    #settings-overlay[open].open{opacity:0}
    #settings-overlay[open].open #settings-panel{opacity:0;transform:translateY(8px) scale(.99)}
  }
}
#settings-panel{max-height:calc(100dvh - 24px);overflow:auto}
.settings-header{display:flex;align-items:center;justify-content:space-between;gap:12px}
#settings-close{background:transparent;border:1px solid var(--border);color:var(--text-soft);border-radius:6px;width:28px;height:28px;font-size:20px;cursor:pointer}
#settings-panel .toggle-switch input:focus-visible+.slider{outline:2px solid var(--mint);outline-offset:3px}
#chat-scroll-latest{position:fixed;right:16px;bottom:calc(var(--moss-composer-height,150px) + 8px);z-index:18;border:1px solid var(--border);border-radius:6px;padding:5px 9px;color:var(--text);background:var(--bg2);font-size:12px;cursor:pointer}
#chat-scroll-latest[hidden]{display:none}
.bubble table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
.bubble th, .bubble td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.bubble th:last-child, .bubble td:last-child {
  border-right: none;
}
.bubble tbody tr:last-child td {
  border-bottom: none;
}
.bubble th {
  background: var(--bg2);
  font-weight: 500;
  color: var(--text-soft);
  text-align: left;
}

.thinking-text {
  max-width: 78%;
  padding: 8px 14px;
  border-radius: var(--r-lg);
  border-bottom-left-radius: var(--r-sm);
  background: var(--bg2);
  border: 1px dashed var(--border2);
  color: var(--text-faint);
  font-size: 12px;
  font-style: italic;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  animation: fadeUp .2s ease both;
}

.reasoning-block {
  width: 100%;
  overflow: hidden;
  border: 1px dashed var(--border2);
  border-radius: var(--r-lg);
  border-bottom-left-radius: var(--r-sm);
  background: var(--bg2);
  color: var(--text-faint);
  animation: fadeUp .2s ease both;
}
.reasoning-block summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.reasoning-block summary::-webkit-details-marker { display: none; }

.chat-open-settings {
  margin-top: 8px;
  padding: 5px 10px;
  color: var(--text);
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  font: inherit;
  cursor: pointer;
}
.fc-expand-btn {
  appearance: none;
  padding: 0;
  border: 0;
  background: transparent;
}
.fc-item .fc-result.failed { color: var(--pink-d, var(--pink)); }
.chat-open-settings:focus-visible, .fc-expand-btn:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
