/* Ask doxi — design tokens lifted verbatim from the Figma export
 * (DoxiTest/sample-doxi-start.html + index.html).
 */
:root {
  color-scheme: light;
  /* Type & color */
  --text-strong: #212121;
  --text-muted: #555555;
  --black: #141414;
  --grayscale-10: #e5e5e5;
  --grayscale-30: #b2b2b2;
  --grayscale-50: #808080;
  --grayscale-60: #666666;
  --grayscale-80: #333333;
  --grayscale-90: #1a1a1a;
  --grayscale-gray-2: #c3c3c3;
  --grayscale-lighter: #f0f0f0;
  --grayscale-light: #dddddd;

  --primary: #052474;
  --pdf: #f40f02;
  --pill-border: #808080;

  --user-bubble: #f3f3f3;

  /* Layout */
  --panel-width: 464px;        /* legacy — used only at very narrow widths */
  --content-max: 760px;        /* reading column on wide windows */
  --history-width: 280px;
  --history-collapsed-width: 60px;

  /* Surfaces */
  --bg-page: #ffffff;
  --bg-surface: #f8f8f8;
  --bg-elevated: #ffffff;
  --bg-subtle: #fafafa;
  --bg-hover: #f3f3f3;
  --border-subtle: var(--grayscale-10);
  --border-default: var(--grayscale-light);
  --border-strong: var(--grayscale-50);
  --shadow-soft: 0 1px 4px rgba(0, 0, 0, 0.05);
  --shadow-panel: 0 18px 54px rgba(0, 0, 0, 0.16);
  --shadow-sidebar: 14px 0 36px rgba(0, 0, 0, 0.10);
  --overlay-scrim: rgba(20, 20, 20, 0.18);
  --focus-ring: rgba(5, 36, 116, 0.10);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --text-strong: #f4f4f5;
  --text-muted: #b8b8bd;
  --black: #f4f4f5;
  --grayscale-10: #343438;
  --grayscale-30: #57575d;
  --grayscale-50: #797981;
  --grayscale-60: #9b9ba2;
  --grayscale-80: #d7d7dc;
  --grayscale-90: #f2f2f4;
  --grayscale-gray-2: #707078;
  --grayscale-lighter: #29292d;
  --grayscale-light: #3b3b40;
  --primary: #8ab4ff;
  --pill-border: #797981;
  --user-bubble: #2b2b30;
  --bg-page: #141416;
  --bg-surface: #1d1d20;
  --bg-elevated: #232326;
  --bg-subtle: #19191c;
  --bg-hover: #2e2e33;
  --border-subtle: #343438;
  --border-default: #3b3b40;
  --border-strong: #62626a;
  --shadow-soft: 0 1px 5px rgba(0, 0, 0, 0.34);
  --shadow-panel: 0 18px 54px rgba(0, 0, 0, 0.46);
  --shadow-sidebar: 14px 0 36px rgba(0, 0, 0, 0.34);
  --overlay-scrim: rgba(0, 0, 0, 0.52);
  --focus-ring: rgba(138, 180, 255, 0.22);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"],
  :root:not([data-theme]) {
    color-scheme: dark;
    --text-strong: #f4f4f5;
    --text-muted: #b8b8bd;
    --black: #f4f4f5;
    --grayscale-10: #343438;
    --grayscale-30: #57575d;
    --grayscale-50: #797981;
    --grayscale-60: #9b9ba2;
    --grayscale-80: #d7d7dc;
    --grayscale-90: #f2f2f4;
    --grayscale-gray-2: #707078;
    --grayscale-lighter: #29292d;
    --grayscale-light: #3b3b40;
    --primary: #8ab4ff;
    --pill-border: #797981;
    --user-bubble: #2b2b30;
    --bg-page: #141416;
    --bg-surface: #1d1d20;
    --bg-elevated: #232326;
    --bg-subtle: #19191c;
    --bg-hover: #2e2e33;
    --border-subtle: #343438;
    --border-default: #3b3b40;
    --border-strong: #62626a;
    --shadow-soft: 0 1px 5px rgba(0, 0, 0, 0.34);
    --shadow-panel: 0 18px 54px rgba(0, 0, 0, 0.46);
    --shadow-sidebar: 14px 0 36px rgba(0, 0, 0, 0.34);
    --overlay-scrim: rgba(0, 0, 0, 0.52);
    --focus-ring: rgba(138, 180, 255, 0.22);
  }
}

* { box-sizing: border-box; }
/* Lock the outer viewport: only inner panes scroll (the hero / messages area).
   - height:100% (not min-height) prevents body from growing past the viewport.
   - overflow:hidden clips any sub-pixel / rounding overflow that would
     otherwise trigger the classic "100vh + scrollbar" infinite-loop bug
     (1px overflow → horizontal scrollbar → adds width → forces vertical
     scrollbar → which the user then sees in every mode that has content). */
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg-page); }
body {
  display: flex;
  position: relative;
  font-family: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-strong);
  isolation: isolate;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 35;
  background: var(--overlay-scrim);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ─────────────────────── Login ─────────────────────── */
.auth-locked .doxi-page,
.auth-locked .history-sidebar {
  pointer-events: none;
  user-select: none;
}
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg-page);
}
.login-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, 384px);
  gap: 14px;
  overflow: hidden;
  padding: 30px 30px 28px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-panel);
}
.login-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, #008bd2 0%, #052474 46%, #e50075 100%);
}
.login-panel__brand {
  display: flex;
  align-items: center;
  align-self: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}
.login-panel__brand-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
}
.login-panel__brand-name {
  margin: 0;
  color: var(--primary);
  font-family: "Montserrat", sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}
.login-panel__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.login-panel__field label {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}
.login-panel__field input,
.login-panel__field select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  background: var(--bg-elevated);
  padding: 8px 10px;
  font-size: 14px;
  outline: none;
}
.login-panel__field input:focus,
.login-panel__field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.login-panel__error {
  margin: 0;
  color: #b42318;
  font-size: 13px;
  line-height: 18px;
}
.login-panel__submit {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
.login-panel__submit {
  min-height: 40px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 600;
}
.login-panel__submit:disabled {
  cursor: wait;
  opacity: 0.72;
}

/* ─────────────────────── Settings ─────────────────────── */
.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--overlay-scrim);
}
.settings-panel {
  display: flex;
  flex-direction: column;
  width: min(100%, 720px);
  max-height: min(720px, calc(100vh - 40px));
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-panel);
}
.settings-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 14px 16px 13px 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.settings-panel__title {
  margin: 0;
  color: var(--text-strong);
  font-size: 18px;
  font-weight: 600;
  line-height: 24px;
}
.settings-panel__icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  padding: 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-strong);
  cursor: pointer;
}
.settings-panel__icon-button:hover,
.settings-panel__icon-button:focus-visible {
  background: var(--bg-hover);
  outline: none;
}
.settings-panel__icon-button svg {
  display: block;
  width: 22px;
  height: 22px;
}
.settings-panel__body {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  min-height: 420px;
  min-width: 0;
}
.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px;
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}
.settings-nav__item {
  min-height: 34px;
  padding: 7px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  cursor: default;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
}
.settings-nav__item.is-active {
  background: var(--bg-elevated);
  color: var(--text-strong);
  box-shadow: var(--shadow-soft);
}
.settings-nav__item:not(:disabled):not(.is-active):hover {
  background: var(--bg-elevated);
  color: var(--text-strong);
  cursor: pointer;
}
.settings-nav__item:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.settings-content {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
  overflow-y: auto;
  padding: 18px 22px 24px;
}
.settings-section {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.settings-section__title {
  margin: 0 0 8px;
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 600;
  line-height: 22px;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 44px;
  padding: 9px 0;
  border-top: 1px solid var(--border-subtle);
}
.settings-row__label {
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
}
.settings-select,
.settings-panel__field input {
  width: min(100%, 190px);
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--border-default);
  border-radius: 7px;
  background: var(--bg-elevated);
  color: var(--text-strong);
  font-size: 13px;
  outline: none;
}
.settings-select:disabled,
.settings-panel__field input:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}
.settings-segment {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-surface);
}
.settings-segment__button {
  min-height: 30px;
  padding: 5px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
}
.settings-segment__button:hover,
.settings-segment__button:focus-visible {
  background: var(--bg-hover);
  color: var(--text-strong);
  outline: none;
}
.settings-segment__button.is-active {
  background: var(--bg-elevated);
  color: var(--text-strong);
  box-shadow: var(--shadow-soft);
}
.settings-segment__button.is-active:hover,
.settings-segment__button.is-active:focus-visible {
  background: var(--bg-elevated);
}
.settings-segment__button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}
.settings-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}
.settings-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.settings-switch__track {
  position: relative;
  display: inline-flex;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: var(--grayscale-light);
  opacity: 0.72;
}
.settings-switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-soft);
}
.settings-switch input:checked + .settings-switch__track {
  background: var(--primary);
}
.settings-switch input:checked + .settings-switch__track::after {
  transform: translateX(18px);
}
.settings-server {
  display: grid;
  grid-template-columns: minmax(92px, 0.8fr) minmax(0, 1.4fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  padding: 9px 0;
  border-top: 1px solid var(--border-subtle);
}
.settings-server__name {
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 500;
}
.settings-server__url {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.settings-server__status {
  justify-self: end;
  min-width: 42px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}
.settings-panel__field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}
.settings-panel__field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.settings-panel__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.settings-panel__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.settings-panel__button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}
.settings-panel__button:hover,
.settings-panel__button:focus-visible {
  background: var(--bg-hover);
  color: var(--text-strong);
  outline: none;
}
.settings-panel__button:disabled:hover,
.settings-panel__button:disabled:focus-visible {
  background: transparent;
  color: var(--text-muted);
}
.settings-panel__button--primary {
  background: var(--primary);
  color: #ffffff;
}
.settings-panel__button--primary:hover,
.settings-panel__button--primary:focus-visible {
  background: var(--primary);
  color: #ffffff;
  filter: brightness(1.08);
}

.auth-status {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
}
.auth-account {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 8px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-strong);
  cursor: pointer;
  text-align: left;
}
.auth-account:hover,
.auth-account:focus-visible,
.auth-account[aria-expanded="true"] {
  background: var(--bg-hover);
  outline: none;
}
.auth-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #d9e3ee url("./assets/user.png") center / cover no-repeat;
  color: transparent;
  font-size: 0;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
  overflow: hidden;
}
.auth-account__identity,
.auth-menu__identity {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.auth-account__user,
.auth-menu__user {
  overflow: hidden;
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.auth-account__role,
.auth-menu__role {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.auth-account__chevron {
  display: block;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--grayscale-80);
}
.auth-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 220;
  padding: 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-panel);
}
.auth-menu__header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 4px 6px 10px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 6px;
}
.auth-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 8px 7px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-strong);
  cursor: pointer;
  font-size: 13px;
  text-align: left;
}
.auth-menu__item:hover,
.auth-menu__item:focus-visible {
  background: var(--bg-hover);
  outline: none;
}
.auth-menu__item svg {
  display: block;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

/* ─────────────────────── Page shell ─────────────────────── */
/*
 * Fills whatever window it's given (desktop / browser tab / embedded iframe).
 * Conversation sections cap themselves at --content-max for readability, so
 * on a 1600px window the chat doesn't stretch to a single line.
 */
.doxi-page {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  width: 100%;
  height: 100%;              /* matches the locked html/body — was 100vh, which
                                drifts on Chromium when a scrollbar appears */
  min-width: 0;              /* allow flex children with wide content to shrink */
  overflow: hidden;          /* belt-and-suspenders: clip any leak so only the
                                designated scroll regions (.hero) ever scroll */
  padding-left: var(--history-collapsed-width);
  background: var(--bg-page);
  transition: padding-left 0.2s ease;
}

.history-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 65;
  display: flex;
  width: var(--history-collapsed-width);
  flex-direction: column;
  min-width: 0;
  height: 100%;
  padding: 12px 10px 14px;
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  box-shadow: none;
  overflow: hidden;
  transition: width 0.2s ease, box-shadow 0.2s ease;
}
.history-open .history-sidebar {
  width: min(var(--history-width), calc(100vw - 32px));
  box-shadow: var(--shadow-sidebar);
}
.history-sidebar__header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 36px;
  margin-bottom: 8px;
}
.history-sidebar__toggle .history-sidebar__toggle-icon--open { display: none; }
.history-open .history-sidebar__toggle .history-sidebar__toggle-icon--collapsed { display: none; }
.history-open .history-sidebar__toggle .history-sidebar__toggle-icon--open { display: block; }
.history-sidebar__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 3px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--black);
  cursor: pointer;
}
.history-sidebar__toggle:hover,
.history-sidebar__toggle:focus-visible { background: var(--bg-hover); }
.history-sidebar__toggle svg {
  display: block;
  width: 22px;
  height: 22px;
}
.history-sidebar__title {
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 500;
}
.history-sidebar__new-chat {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  margin-bottom: 10px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: var(--bg-hover);
  color: var(--text-strong);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}
.history-sidebar__new-chat:hover,
.history-sidebar__new-chat:focus-visible {
  background: var(--grayscale-lighter);
  outline: none;
}
.history-sidebar__new-chat svg {
  display: block;
  width: 28px;
  height: 28px;
}
.history-search {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 100%;
  margin-bottom: 14px;
  color: var(--text-muted);
}
.history-search svg {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  pointer-events: none;
}
.history-search input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--border-default);
  border-radius: 7px;
  background: var(--bg-elevated);
  color: var(--text-strong);
  font-size: 14px;
  line-height: 20px;
  outline: none;
}
.history-search input::placeholder { color: var(--text-muted); }
.history-search input:focus-visible {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.history-collapsed .history-sidebar__title,
.history-collapsed .history-sidebar__new-chat-label,
.history-collapsed .history-search,
.history-collapsed .history-list {
  display: none;
}
.history-collapsed .history-sidebar__header {
  margin-bottom: 12px;
}
.history-collapsed .history-sidebar__new-chat {
  width: 36px;
  min-height: 36px;
  margin-bottom: 0;
  padding: 0;
  border-radius: 10px;
  justify-content: center;
}
.history-collapsed .history-sidebar__new-chat svg {
  width: 28px;
  height: 28px;
}
.history-collapsed .history-sidebar__footer {
  margin-top: auto;
  padding: 0;
  border-top: 0;
}
.history-collapsed .auth-status {
  justify-content: center;
}
.history-collapsed .auth-account {
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  justify-content: center;
  border-radius: 10px;
}
.history-collapsed .auth-account__identity,
.history-collapsed .auth-account__chevron {
  display: none;
}
.history-collapsed .auth-menu {
  left: calc(100% + 8px);
  right: auto;
  bottom: 0;
  width: 220px;
}
.history-list {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
  overflow-y: auto;
  padding: 0 2px 0 0;
}
.history-sidebar__footer {
  flex: 0 0 auto;
  margin-top: 10px;
  padding: 12px 4px 0;
  border-top: 1px solid var(--grayscale-10);
}
.history-list__empty {
  margin: 10px 4px;
  padding: 10px;
  border: 1px dashed var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 13px;
  line-height: 18px;
}
.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  gap: 6px;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 5px 4px 5px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--text-strong);
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.history-item:hover,
.history-item:focus-within,
.history-item.is-active { background: var(--bg-hover); }
.history-item.is-active { border-color: transparent; }
.history-item__main {
  min-width: 0;
  border: 0;
  padding: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.history-item__title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.history-item__title,
.history-item__date {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-item__title {
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
}
.history-item__date {
  margin-top: 1px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 17px;
}
.history-item__mode {
  flex: 0 0 auto;
  max-width: 72px;
  overflow: hidden;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-item__delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--grayscale-80);
  cursor: pointer;
  opacity: 0;
  transform: translateX(4px);
  transition: opacity 0.14s ease, transform 0.14s ease, background 0.14s ease;
}
.history-item__delete:hover,
.history-item__delete:focus-visible {
  background: var(--grayscale-lighter);
  outline: none;
}
.history-item__delete svg {
  width: 18px;
  height: 18px;
}
.history-item:hover .history-item__delete,
.history-item:focus-within .history-item__delete,
.history-item.is-active .history-item__delete {
  opacity: 1;
  transform: translateX(0);
}
.history-delete-menu {
  position: fixed;
  z-index: 95;
  width: 174px;
  padding: 0;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  background: #fff3f2;
  box-shadow: var(--shadow-panel);
  overflow: hidden;
}
.history-delete-menu__button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: #d3200e;
  cursor: pointer;
  font-size: 14px;
  line-height: 20px;
  text-align: left;
}
.history-delete-menu__button:hover,
.history-delete-menu__button:focus-visible {
  background: rgba(211, 32, 14, 0.08);
  outline: none;
}
.history-delete-menu__button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

/* Center conversation sections horizontally on wide windows */
.hero,
.bottom-panel {
  width: 100%;
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
}


/* ─────────────────────── Feedback ─────────────────────── */
.feedback-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 72px 20px 20px;
  background: var(--overlay-scrim);
}
.feedback-panel {
  display: flex;
  flex-direction: column;
  width: min(100%, 380px);
  max-height: min(680px, calc(100vh - 96px));
  overflow: hidden;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-panel);
}
.feedback-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 10px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.feedback-panel__title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}
.feedback-panel__icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}
.feedback-panel__icon-button:hover,
.feedback-panel__icon-button:focus-visible { background: var(--bg-hover); }
.feedback-panel__icon-button svg { width: 22px; height: 22px; }
.feedback-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 72px;
  max-height: 320px;
  overflow: auto;
  padding: 14px 16px;
}
.feedback-list__empty {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}
.feedback-comment {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-subtle);
}
.feedback-comment__meta {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}
.feedback-comment__message {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.45;
}
.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--border-subtle);
}
.feedback-form__input {
  width: 100%;
  resize: vertical;
  min-height: 96px;
  max-height: 220px;
  border: 1px solid var(--border-default);
  border-radius: 8px;
  background: var(--bg-elevated);
  padding: 10px 12px;
  outline: none;
  font-size: 14px;
}
.feedback-form__input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.feedback-form__status {
  min-height: 18px;
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
}
.feedback-form__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.feedback-form__button {
  min-height: 34px;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  background: var(--bg-elevated);
  padding: 7px 12px;
  cursor: pointer;
}
.feedback-form__button--primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}
.feedback-form__button:disabled { cursor: not-allowed; opacity: 0.6; }
body.shared-view .history-sidebar,
body.shared-view .bottom-panel,
body.shared-view #feedback-open,
body.shared-view #share-chat { display: none; }
body.shared-view .hero { padding-bottom: 48px; }
.shared-notice { align-self: center; max-width: 100%; color: var(--text-muted); font-size: 12px; }

/* ─────────────────────── Header ─────────────────────── */
.ad-header {
  position: relative;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  width: 100%;
  min-height: 60px;
  padding: 16px;
  background: var(--bg-page);
}
.ad-header__group,
.ad-header__brand,
.ad-header__brand-inner { display: flex; align-items: center; }
.ad-header__group { gap: 8px; min-width: 0; }
.ad-header__group--actions { gap: 4px; flex: 0 0 auto; }
.ad-header__brand {
  gap: 4px;
  min-width: 0;
  padding: 2px 4px 2px 5px;
  border-radius: 4px;
  color: var(--text-strong);
  text-decoration: none;
}
.ad-header__brand:hover,
.ad-header__brand:focus-visible,
.ad-header__icon-button:hover,
.ad-header__icon-button:focus-visible,
.suggestion:hover,
.suggestion:focus-visible,
.chat-area__icon-button:hover,
.chat-area__icon-button:focus-visible { background: var(--bg-hover); }
.ad-header__brand-inner { gap: 2px; min-width: 0; }
.ad-header__logo {
  display: block;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  object-fit: contain;
}
.ad-header__title {
  overflow: hidden;
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 500;
  line-height: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ad-header__icon-button,
.chat-area__icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 3px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--black);
  cursor: pointer;
}
.ad-header__icon-button svg,
.chat-area__icon-button svg { display: block; width: 22px; height: 22px; }
.ad-header__icon-button:disabled { cursor: not-allowed; opacity: 0.42; }
.ad-header__icon-button--mobile-sidebar { display: none; }
body.history-open #history-toggle { display: none; }

/* ─────────────────────── Hero / scroll area ─────────────────────── */
.hero {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  min-width: 0;              /* allow shrinking inside the flex column */
  min-height: 0;
  padding: 56px 32px 32px;
  overflow-y: auto;
  overflow-x: hidden;        /* wide markdown (tables, code, long URLs) must
                                clip here, not propagate to <body> */
  gap: 16px;
}

/* Empty state */
.suggestions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;
  width: 100%;
  max-width: 480px;          /* keep the welcome block narrow even on big windows */
}
.hero__intro {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}
.hero__title-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}
.hero__logo { display: block; width: 56px; height: 56px; }
.hero__title {
  margin: 0;
  padding-left: 5px;
  color: var(--text-strong);
  font-size: 24px;
  font-weight: 600;
  line-height: normal;
  letter-spacing: 0;
}
.hero__body {
  margin: 0;
  padding-left: 6px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
}
.suggestion-list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  width: 100%;
}
.suggestion {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  max-width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 400;
  line-height: normal;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

/* ─────────────────────── Messages ─────────────────────── */
.messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  min-width: 0;              /* shrink with the hero — otherwise wide bubbles
                                push horizontal scroll into the parent flex */
}

/* User bubble — right-aligned, light gray */
.bubble.user {
  align-self: flex-end;
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--user-bubble);
  color: var(--text-strong);
  font-size: 14px;
  line-height: 22px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Assistant — plain text, no bubble */
.assistant {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-strong);
  font-size: 14px;
  line-height: 22px;
}
.assistant .md > * { margin: 0; }
.assistant .md > * + * { margin-top: 10px; }
.assistant .md p { line-height: 22px; }
.assistant .md ul {
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.assistant .md ol {
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.assistant .md li { line-height: 20px; }
.assistant .md li::marker { color: var(--grayscale-60); }
.assistant .md strong { font-weight: 600; color: var(--text-strong); }

/* Headings */
.assistant .md h1, .assistant .md h2, .assistant .md h3,
.assistant .md h4, .assistant .md h5, .assistant .md h6 {
  font-weight: 600;
  color: var(--text-strong);
  line-height: 1.3;
}
.assistant .md h1 { font-size: 1.25em; margin-top: 18px; }
.assistant .md h2 { font-size: 1.1em;  margin-top: 16px; }
.assistant .md h3 { font-size: 1em;    margin-top: 14px; }
.assistant .md h4, .assistant .md h5, .assistant .md h6 { font-size: 0.95em; margin-top: 12px; }

/* Horizontal rule */
.assistant .md hr {
  border: none;
  border-top: 1px solid var(--grayscale-light);
  margin: 14px 0;
}

/* Blockquote */
.assistant .md blockquote {
  margin: 0;
  padding: 6px 12px;
  border-left: 3px solid var(--grayscale-30);
  color: var(--text-muted);
  font-style: italic;
}

/* Inline code */
.assistant .md code {
  background: var(--bg-surface);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12.5px;
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
}

/* Fenced code blocks */
.assistant .md pre {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  padding: 12px 14px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.6;
}
.assistant .md pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

/* Tables */
.assistant .md table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.5;
}
.assistant .md th, .assistant .md td {
  text-align: left;
  padding: 7px 12px;
  border: 1px solid var(--border-default);
}
.assistant .md th {
  background: var(--bg-surface);
  font-weight: 600;
  color: var(--text-strong);
}
.assistant .md tr:nth-child(even) td {
  background: var(--grayscale-lighter);
}
.assistant.thinking .md::after {
  content: "▍";
  display: inline-block;
  margin-left: 2px;
  animation: blink 1s steps(2, start) infinite;
  color: var(--grayscale-60);
}
@keyframes blink { 50% { opacity: 0; } }

/* Action row under assistant message (copy / 👍 / 👎) */
.action-row {
  display: flex;
  gap: 4px;
  margin-top: 2px;
}
.action-row button {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--grayscale-60);
  border-radius: 4px;
  cursor: pointer;
}
.action-row button:hover { background: var(--bg-hover); color: var(--text-strong); }
.action-row svg { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

/* Error */
.bubble.error {
  align-self: stretch;
  padding: 8px 12px;
  background: #fef2f2;
  color: #b3261e;
  border: 1px solid #fecaca;
  border-radius: 6px;
  font-size: 13px;
}
.bubble.stopped {
  align-self: stretch;
  padding: 8px 12px;
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--grayscale-light);
  border-radius: 6px;
  font-size: 13px;
}

/* ─────────────────────── Loading state (tool-call progress) ─────────────────────── */
.loading-state {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 0 0 0 0;
  background: var(--bg-page);
}
.loading-state__header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.loading-state__logo {
  display: block;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  object-fit: contain;
}
.loading-state__title {
  margin: 0;
  font-size: 14px;
  font-weight: 500;          /* +1 weight so the shimmer reads cleanly */
  line-height: 22px;
  white-space: nowrap;
  /* Shimmer: the dark text colour pads both ends of the gradient so
     the glyphs ALWAYS show a colour (never transparent). The sheen
     occupies only the middle 10% of a 4×-wide gradient, so during the
     "off" half of the cycle the text is plain dark — no visible
     repaint when the animation wraps. Animation auto-starts when this
     element is appended by startThinking() and stops cleanly when
     clearLoadingState() removes the .loading-state subtree. */
  background-image: linear-gradient(
    100deg,
    var(--grayscale-90) 0%,
    var(--grayscale-90) 45%,
    #8fa3d6              50%,
    var(--grayscale-90) 55%,
    var(--grayscale-90) 100%
  );
  background-size: 400% 100%;
  background-repeat: no-repeat;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: doxi-thinking-shimmer 2.4s linear infinite;
}
@keyframes doxi-thinking-shimmer {
  /* Sweep from "sheen entering from the left" to "sheen exited on the right".
     Both endpoints sit in the dark padding of the gradient, so the loop
     wrap is invisible — no text-vanish frame. */
  from { background-position: 100% 0; }
  to   { background-position: 0% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .loading-state__title {
    animation: none;
    background-image: none;
    color: var(--grayscale-90);
    -webkit-text-fill-color: currentColor;
  }
}
.loading-state__items {
  display: flex;
  flex-direction: column;
  width: 100%;
}
.loading-state__item {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding-left: 38px;
}
.loading-state__status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  color: var(--grayscale-50);
}
.loading-state__status-icon svg { display: block; width: 22px; height: 22px; }
.loading-state__status-icon .step-done { display: none; }
.loading-state__item-text {
  margin: 0;
  min-width: 0;
  color: var(--grayscale-60);
  font-size: 14px;
  font-weight: 400;
  line-height: 22px;
}
.loading-state__item--complete .loading-state__status-icon { color: var(--grayscale-30); }
.loading-state__item--complete .loading-state__status-icon .step-pending { display: none; }
.loading-state__item--complete .loading-state__status-icon .step-done { display: block; }
.loading-state__item--complete .loading-state__item-text { color: var(--grayscale-30); }

/* ─────────────────────── Bottom panel ─────────────────────── */
.bottom-panel {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  position: relative;   /* anchor for .skill-picker */
  padding-bottom: 2px;
}

/* Context bar */
.context-wrap { width: 100%; padding: 0 16px 8px; }
.context-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 6px 8px;
  border: 0.5px solid var(--grayscale-10);
  border-radius: 8px;
  background: var(--bg-surface);
}
.context-bar__content {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}
.context-bar__label {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 2px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 400;
  line-height: normal;
  white-space: nowrap;
}
.context-bar__count { color: var(--text-strong); font-weight: 600; }
.context-bar__items {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
  overflow-x: auto;
}
.context-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  height: 28px;
  padding: 4px;
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--grayscale-80);
  overflow: hidden;
}
.context-pill--flex { flex: 1 1 0; }
.context-pill__main {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}
.context-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 32px;
  height: 28px;
  padding: 5px 6px;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  font-family: inherit;
}
.context-more:hover { filter: brightness(1.1); }
.context-pill__text {
  min-width: 0;
  overflow: hidden;
  color: var(--grayscale-80);
  font-size: 12px;
  font-weight: 400;
  line-height: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.context-pill__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--grayscale-80);
  cursor: pointer;
}
.context-pill__remove:hover,
.context-pill__remove:focus-visible { background: var(--bg-hover); }
.context-pill__remove svg { display: block; width: 16px; height: 16px; }

.context-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
}
.context-icon--pin svg { display: block; width: 16px; height: 16px; }

/* PDF tile (red) */
.context-icon--pdf {
  width: 16px;
  height: 20px;
  margin-inline: 2px;
  border-radius: 2px;
  background: var(--pdf);
  box-shadow: inset 3px 0 0 rgba(255, 255, 255, 0.18);
  color: #ffffff;
}
.context-icon--pdf svg { display: block; width: 16px; height: 20px; }

/* Folder tile (blue) */
.context-icon--folder::before {
  content: "";
  position: absolute;
  left: 3px; top: 5px;
  width: 14px; height: 11px;
  border-radius: 2px;
  background: #42ade2;
}
.context-icon--folder::after {
  content: "";
  position: absolute;
  left: 4px; top: 4px;
  width: 6px; height: 3px;
  border-radius: 2px 2px 0 0;
  background: #68c0ec;
}

/* PPTX tile (orange) */
.context-icon--deck {
  width: 16px; height: 20px;
  margin-inline: 2px;
  border-radius: 2px;
  background: #ff6b3a;
  box-shadow: inset 3px 0 0 rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 9px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
}

/* Chat input area */
.chat-wrap { width: 100%; padding: 0 16px; }
.chat-area {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  width: 100%;
  min-height: 96px;
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-soft);
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.chat-area:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), var(--shadow-soft);
}

.chat-area__input-row {
  display: flex;
  align-items: flex-start;
  width: 100%;
  padding: 6px;
}
.chat-area__input {
  flex: 1;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 400;
  line-height: 22px;
  min-height: 22px;
  max-height: 160px;
  width: 100%;
  font-family: inherit;
}
.chat-area__input::placeholder { color: var(--grayscale-60); }

.chat-area__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.chat-area__action-group { display: flex; align-items: center; gap: 4px; }
.chat-area__send-button,
.chat-area__stop-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 6px;
  border: 0;
  border-radius: 6px;
  background: var(--grayscale-lighter);
  color: var(--grayscale-gray-2);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.chat-area__send-button.is-ready {
  background: var(--primary);
  color: #ffffff;
}
.chat-area__stop-button {
  background: var(--text-strong);
  color: #ffffff;
}
.chat-area__send-button:disabled { cursor: not-allowed; }
.chat-area__send-button svg,
.chat-area__stop-button svg { display: block; width: 16px; height: 16px; }

/* Disclaimer */
.disclaimer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  margin: 0;
  padding: 8px 24px 10px;
  color: var(--grayscale-60);
  font-size: 11px;
  font-weight: 400;
  line-height: normal;
  /* The text + icon is ~330px wide. nowrap caused horizontal body scroll on
     narrow windows / zoomed-in users — wrap to two lines when needed and
     keep the icon aligned via flex-wrap. */
  text-align: center;
  flex-wrap: wrap;
}
.disclaimer svg {
  display: block;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
}

/* ─────────────────────── Human-in-the-loop card ─────────────────────── */
.question-card {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}
.question-card__intro {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.question-card__logo {
  display: block;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  object-fit: contain;
  margin-top: 2px;
}
.question-card__intro-text {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.question-card__title {
  margin: 0;
  color: var(--grayscale-90);
  font-size: 14px;
  font-weight: 500;
  line-height: 22px;
}
.question-card__body {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 400;
  line-height: 22px;
}
.question-card__panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border: 0.5px solid var(--border-strong);
  border-radius: 10px;
  background: var(--bg-elevated);
}
.question-card__panel-title {
  margin: 0;
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 600;
  line-height: 22px;
}
.question-card__options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.question-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: background 0.12s;
}
.question-option:hover { background: var(--bg-hover); }
.question-option.is-selected { background: var(--bg-surface); }
.question-option__radio {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 2px 0 0 0;
  accent-color: var(--primary);
  cursor: pointer;
}
.question-option__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.question-option__label {
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
}
.question-option__desc {
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 400;
  line-height: 18px;
}
.question-card__empty-options {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 20px;
}
.question-card__text-input {
  width: 100%;
  padding: 10px 12px;
  border: 0.5px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-strong);
  font-family: inherit;
  font-size: 14px;
  line-height: 22px;
  resize: vertical;
  outline: none;
}
.question-card__text-input:focus { border-color: var(--primary); }
.question-card__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.question-card__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font: 500 13px/1 inherit;
  font-family: inherit;
  cursor: pointer;
}
.question-card__btn:hover { background: var(--bg-hover); color: var(--text-strong); }
.question-card__btn--primary {
  background: var(--primary);
  color: #ffffff;
  padding-inline: 18px;
}
.question-card__btn--primary:hover { filter: brightness(1.1); background: var(--primary); color: #ffffff; }
.question-card__btn--primary:disabled {
  background: var(--grayscale-lighter);
  color: var(--grayscale-gray-2);
  cursor: not-allowed;
  filter: none;
}
.question-card--form .question-card__panel {
  gap: 12px;
  border-color: var(--grayscale-light);
}
.question-card--form[data-severity="caution"] .question-card__panel {
  border-color: #d99a25;
  box-shadow: inset 3px 0 0 #d99a25;
}
.question-card--form[data-severity="danger"] .question-card__panel {
  border-color: #d83a3a;
  box-shadow: inset 3px 0 0 #d83a3a;
}
.question-card--form[data-severity="admin"] .question-card__panel {
  border-color: #8b5cf6;
  box-shadow: inset 3px 0 0 #8b5cf6;
}
.question-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.question-form__section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding-top: 2px;
}
.question-form__section + .question-form__section {
  padding-top: 12px;
  border-top: 1px solid var(--grayscale-lighter);
}
.question-form__section-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.question-form__section-title {
  margin: 0;
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 600;
  line-height: 20px;
}
.question-form__section-desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 18px;
}
.question-form__fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.question-form__field {
  display: grid;
  grid-template-columns: minmax(120px, 0.42fr) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-width: 0;
}
.question-form__field-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.question-form__label {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  min-width: 0;
  padding-top: 8px;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 18px;
}
.question-form__required,
.question-form__status {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 18px;
  text-transform: capitalize;
}
.question-form__required {
  background: #fff3d6;
  color: #8a5b00;
}
.question-form__status--missing,
.question-form__status--ambiguous {
  background: #fff3d6;
  color: #8a5b00;
}
.question-form__status--inferred {
  background: #e8f0fe;
  color: var(--primary);
}
.question-form__control,
.question-form__readonly {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 0.5px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-strong);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 20px;
  outline: none;
}
.question-form__control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.question-form__control--textarea {
  resize: vertical;
  min-height: 74px;
}
.question-form__readonly {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  color: var(--text-muted);
}
.question-form__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 8px;
  align-items: center;
}
.question-form__help {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 18px;
}
.question-form__error {
  margin: 0;
  color: #b3261e;
  font-size: 12px;
  line-height: 18px;
}
.question-form__schema-error {
  padding: 10px 12px;
  border: 1px solid #f2c8c3;
  border-radius: 8px;
  background: #fff7f5;
  color: #9f2318;
  font-size: 13px;
  line-height: 19px;
}
.question-form__field.is-invalid .question-form__control,
.question-form__field.is-invalid .question-form__choice-list {
  border-color: #d83a3a;
}
.question-form__choice-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 4px;
  border: 0.5px solid var(--border-default);
  border-radius: 8px;
  background: var(--bg-elevated);
}
.question-form__check,
.question-form__option-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 0;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.question-form__check:hover,
.question-form__option-row:hover {
  background: var(--bg-hover);
}
.question-form__check input,
.question-form__option-row input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--primary);
}
.question-form__option-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.question-form__option-title {
  color: var(--text-strong);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 19px;
}
.question-form__option-detail {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 17px;
}

@media (max-width: 560px) {
  .question-form__field {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .question-form__label {
    padding-top: 0;
  }
}

/* ─────────────────────── Drag and drop overlay ─────────────────────── */
.doxi-page.is-drag-over {
  position: relative;
}
.doxi-page.is-drag-over::before {
  content: "Drop files to attach";
  position: absolute;
  inset: 8px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 36, 116, 0.06);
  border: 2px dashed var(--primary);
  border-radius: 14px;
  color: var(--primary);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
  pointer-events: none;          /* drop event still reaches the document */
  backdrop-filter: blur(2px);
}

/* ─────────────────────── Doxi Deep — Todo-list card ─────────────────────── */
.plan-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 170;
  display: grid;
  place-items: start center;
  padding: 78px 18px 18px;
  background: rgba(20, 20, 20, 0.20);
  backdrop-filter: blur(2px);
}
.plan-dialog {
  width: min(100%, 560px);
  max-height: min(680px, calc(100vh - 112px));
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-panel);
}
.plan-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 16px 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
}
.plan-dialog__brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 11px;
}
.plan-dialog__logo {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  object-fit: contain;
}
.plan-dialog__eyebrow {
  margin: 0 0 1px;
  color: #6d28d9;
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
}
.plan-dialog__title {
  margin: 0;
  color: var(--text-strong);
  font-size: 18px;
  font-weight: 650;
  line-height: 24px;
}
.plan-dialog__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  padding: 4px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-strong);
  cursor: pointer;
}
.plan-dialog__close:hover,
.plan-dialog__close:focus-visible {
  background: var(--bg-hover);
  outline: none;
}
.plan-dialog__close svg {
  display: block;
  width: 20px;
  height: 20px;
}
.todos-card {
  align-self: stretch;
  margin: 4px 0;
  padding: 14px 16px;
  border: 0.5px solid var(--border-strong);
  border-radius: 10px;
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.todos-card--dialog {
  max-height: calc(min(680px, 100vh - 112px) - 82px);
  overflow-y: auto;
  margin: 0;
  padding: 16px 18px 18px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.todos-card__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.todos-card__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-strong);
}
.todos-card__progress {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.todos-card__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.todos-card__item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  font-size: 13.5px;
  line-height: 20px;
  color: var(--text-strong);
}
.todos-card__mark {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  border: 1.5px solid var(--grayscale-30);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.todos-card__item--in_progress .todos-card__mark {
  border-color: var(--primary);
  background: radial-gradient(circle, var(--primary) 0 4px, transparent 5px);
  animation: todos-pulse 1.6s ease-in-out infinite;
}
.todos-card__item--completed .todos-card__mark {
  background: var(--primary);
  border-color: var(--primary);
}
.todos-card__item--completed .todos-card__mark::after {
  content: "";
  width: 8px;
  height: 4px;
  border-left: 1.5px solid #fff;
  border-bottom: 1.5px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px);
}
.todos-card__item--completed .todos-card__text {
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: var(--grayscale-30);
}
.todos-card__text {
  min-width: 0;
  flex: 1 1 auto;
  word-break: break-word;
}
@keyframes todos-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

@media (max-width: 560px) {
  .plan-dialog-overlay {
    align-items: end;
    padding: 12px;
  }
  .plan-dialog {
    max-height: min(620px, calc(100vh - 24px));
  }
  .todos-card--dialog {
    max-height: calc(min(620px, 100vh - 24px) - 82px);
  }
}

/* ─────────────────────── Attachment download chip ─────────────────────── */
.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 10px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-surface);
  text-decoration: none;
  color: var(--text-strong);
  font-size: 13px;
  line-height: 1.3;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, border-color 0.12s, transform 0.12s;
  max-width: 320px;
}
.attachment-chip:hover {
  background: var(--bg-elevated);
  border-color: var(--primary);
  transform: translateY(-1px);
}
.attachment-chip.is-disabled,
.attachment-chip:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}
.attachment-chip.is-disabled:hover,
.attachment-chip:disabled:hover {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
  transform: none;
}
.attachment-chip__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  color: var(--primary);
}
.attachment-chip__icon svg {
  display: block;
  width: 16px;
  height: 20px;
}
.attachment-chip__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}
.attachment-chip__name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.attachment-chip__meta {
  color: var(--text-muted);
  font-size: 11.5px;
}
.attachment-chip__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: var(--primary);
}
.attachment-chip__action svg {
  display: block;
  width: 16px;
  height: 16px;
}

/* Provenance accent on the left edge of the chip — quick visual cue
 * for whether this attachment was generated (green), edited from another
 * (blue), or uploaded by the user (gray). */
.attachment-chip[data-source="create"] { border-left: 3px solid #2c9c5a; }
.attachment-chip[data-source="edit"]   { border-left: 3px solid var(--primary); }
.attachment-chip[data-source="upload"] { border-left: 3px solid var(--grayscale-30); }

/* Pill states while a file is uploading or has failed. */
.context-pill[data-status="uploading"] {
  border-style: dashed;
  opacity: 0.85;
}
.context-pill[data-status="uploading"]::after {
  content: "…";
  margin-left: 4px;
  color: var(--text-muted);
  font-weight: 600;
}
.context-pill[data-status="error"] {
  border-color: #d83a3a;
  background: #fef2f2;
}
.context-pill[data-status="error"]::after {
  content: "⚠";
  margin-left: 4px;
  color: #d83a3a;
}

/* ─────────────────────── Mode picker ─────────────────────── */
.mode-picker {
  position: relative;
}
.mode-picker__trigger {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 4px 8px 4px 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-strong);
  cursor: pointer;
  font: inherit;
}
.mode-picker__trigger:hover,
.mode-picker__trigger:focus-visible {
  border-color: var(--grayscale-10);
  background: var(--bg-hover);
}
.mode-picker__chevron {
  display: block;
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  color: var(--grayscale-50);
  transition: transform 0.18s ease;
}
.mode-picker__trigger[aria-expanded="true"] .mode-picker__chevron {
  transform: rotate(180deg);
}
.mode-picker__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 200;
  min-width: 248px;
  max-width: calc(100vw - 32px);
  padding: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  box-shadow: var(--shadow-panel);
}
.mode-picker__item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-strong);
  font: inherit;
  text-align: left;
  cursor: pointer;
  gap: 1px;
}
.mode-picker__item:hover,
.mode-picker__item:focus-visible { background: var(--bg-hover); }
.mode-picker__item.is-active {
  background: var(--bg-surface);
  box-shadow: inset 2px 0 0 var(--primary);
}
.mode-picker__item-name {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.3;
}
.mode-picker__item.is-active .mode-picker__item-name { color: var(--primary); }
.mode-picker__item-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Soft kill-switch — server-disabled modes still appear in the picker
   (selectable, so the user can read the description) but are greyed out
   and tagged. Selecting one locks the composer; see .is-mode-disabled. */
.mode-picker__item.is-disabled {
  opacity: 0.55;
}
.mode-picker__item.is-disabled .mode-picker__item-desc::after {
  content: " · disabled";
  color: var(--text-muted);
  font-style: italic;
}

/* When the currently-selected mode is server-disabled, fade the composer
   so it's visually obvious why it isn't accepting input. The actual
   `disabled` attribute is set on inputEl + sendBtn in applyModeLock(). */
body.is-mode-disabled .composer,
body.is-mode-disabled .composer__field {
  opacity: 0.65;
}

/* ── Mode name: "Doxi" same everywhere, variant word gets per-mode color ── */
.mp-brand {
  font-weight: 600;
  color: var(--text-strong);
}
.mp-variant {
  font-weight: 600;
  color: var(--text-strong);
}
/* Header trigger is smaller — weight 600 is enough */
.ad-header__title .mp-variant { font-weight: 600; }
/* Per-mode colors */
.mp-variant--creator { color: #06B6D4; }
.mp-variant--deep    { color: #8B5CF6; }
.mp-variant--designer{ color: #EC4899; }

/* ─────────────────────── Entity result cards ─────────────────────── */
.result-card {
  align-self: stretch;
  border: 0.5px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-elevated);
  font-size: 13px;
  overflow: hidden;
  /* subtle lift */
  box-shadow: var(--shadow-soft);
}

/* Header row */
.rc-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border-bottom: 0.5px solid var(--border-subtle);
  background: var(--bg-surface);
}
.rc-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rc-count {
  flex: 0 0 auto;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Icon badge */
.rc-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 5px;
}
.rc-icon--doc,
.rc-icon--ws,
.rc-icon--wf,
.rc-icon--task,
.rc-icon--user {
  width: 30px;
  height: 30px;
  border-radius: 7px;
}
.rc-icon--doc { background: #e8f0fe; color: var(--primary); }
.rc-icon--ws  { background: #e0f2fe; color: #0369a1; }
.rc-icon--wf  {
  background: #ffffff;
  color: #052474;
  box-shadow: inset 0 0 0 1px var(--border-subtle);
}
.rc-icon--org { background: #dcfce7; color: #15803d; }
.rc-icon--user{ background: #ffffff; color: #abdbef; box-shadow: inset 0 0 0 1px var(--border-subtle); }
.rc-icon--wb  { background: #fef3c7; color: #a16207; }
.rc-icon--task{ background: #ffffff; color: #2a866e; box-shadow: inset 0 0 0 1px var(--border-subtle); }
.rc-icon-svg  { display: block; width: 14px; height: 14px; }
.rc-icon--doc .rc-icon-svg,
.rc-icon--ws .rc-icon-svg,
.rc-icon--wf .rc-icon-svg,
.rc-icon--task .rc-icon-svg,
.rc-icon--user .rc-icon-svg {
  width: 21px;
  height: 21px;
}

/* List row */
.rc-rows { display: flex; flex-direction: column; }
.rc-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 9px 14px;
  border-bottom: 0.5px solid var(--border-subtle);
}
.rc-row:last-child { border-bottom: none; }
.rc-row__main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.rc-row__title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.rc-row__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.rc-row__meta {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Attributes row */
.rc-attrs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  padding: 7px 14px;
  border-bottom: 0.5px solid var(--border-subtle);
  font-size: 12.5px;
  color: var(--text-muted);
}
.rc-attrs strong { font-weight: 500; color: var(--text-strong); }

/* Files section */
.rc-files {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 14px;
}
.rc-file-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rc-file-meta {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Folders section */
.rc-folders {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 8px 14px;
}

.rc-attrs--generic {
  gap: 6px 16px;
}

.rc-row--generic .rc-row__chips {
  margin-top: 2px;
}

.rc-section-title {
  padding: 9px 14px 3px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.rc-tree-section {
  padding-bottom: 8px;
}

.rc-tree {
  list-style: none;
  margin: 0;
  padding: 4px 14px 0;
}

.rc-tree--child {
  padding: 5px 0 0 16px;
}

.rc-tree__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 3px 0 3px 12px;
  flex-wrap: wrap;
}

.rc-tree__view {
  margin-left: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.rc-tree__item:hover .rc-tree__view {
  opacity: 1;
}

.rc-tree__item::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 13px;
  width: 5px;
  height: 1px;
  background: var(--border-default);
}

.rc-tree--child .rc-tree__item::after {
  content: "";
  position: absolute;
  left: 1px;
  top: -5px;
  bottom: 12px;
  width: 1px;
  background: var(--border-subtle);
}

.rc-tree__label {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(3, 105, 161, 0.07);
  color: var(--text-strong);
  font-size: 12px;
  line-height: 1.35;
}

.rc-tree__item--d1 > .rc-tree__label {
  background: var(--grayscale-lighter);
}

.rc-tree__item--d2 > .rc-tree__label,
.rc-tree__item--d3 > .rc-tree__label {
  background: transparent;
  padding-left: 0;
  color: var(--text-muted);
}

.rc-note {
  padding: 7px 14px;
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Shared chip (file name, folder name) */
.rc-chip {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 4px;
  background: var(--grayscale-lighter);
  color: var(--text-strong);
  font-size: 11.5px;
  font-weight: 400;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Workflow task pipeline */
.rc-tasks { display: flex; flex-direction: column; }
.rc-task {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px;
  border-bottom: 0.5px solid var(--border-subtle);
}
.rc-task:last-child { border-bottom: none; }
.rc-task__dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--grayscale-lighter);
  border: 1.5px solid var(--grayscale-30);
}
.rc-task--active .rc-task__dot { background: #3b82f6; border-color: #3b82f6; }
.rc-task--done   .rc-task__dot { background: #22c55e; border-color: #22c55e; }
.rc-task__name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12.5px;
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rc-task--done .rc-task__name {
  color: var(--text-muted);
  text-decoration: line-through;
}
.rc-task__status {
  flex: 0 0 auto;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0;
}
.rc-task--active .rc-task__status { color: #3b82f6; }
.rc-task--done   .rc-task__status { color: #22c55e; }

/* ───────── Object cards tray (end-of-turn) ───────── */
.object-cards {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
  padding: 10px;
  border: 0.5px solid var(--border-subtle);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--bg-elevated), var(--bg-surface));
  box-shadow: var(--shadow-sm);
}
.object-cards__summary {
  display: none;
}
.object-cards__label {
  flex: 0 0 auto;
  color: var(--text-strong);
  font-weight: 700;
  line-height: 1.2;
}
.object-cards__sub {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.object-cards__count {
  flex: 0 0 auto;
  font-size: 11.5px;
  font-weight: 650;
  color: var(--text-muted);
  background: var(--grayscale-lighter);
  padding: 3px 8px;
  border-radius: 999px;
}
.object-cards__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}
.object-cards__body .result-card {
  box-shadow: none;
}

/* ─────────────────────── Skill picker ─────────────────────── */
/* Pops UP from the composer when the user types "/" at a word boundary.
   Filtered to kind="external" skills loaded by the current mode. */
.skill-picker {
  position: absolute;
  bottom: 100%;
  left: 16px;
  right: 16px;
  margin-bottom: 8px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  box-shadow: var(--shadow-panel);
  z-index: 50;
  font-family: inherit;
}
.skill-picker__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--grayscale-lighter);
  cursor: pointer;
  font-family: inherit;
  color: var(--text-strong);
}
.skill-picker__item:last-child {
  border-bottom: 0;
}
.skill-picker__item.is-active,
.skill-picker__item:hover {
  background: var(--bg-hover);
}
.skill-picker__item-name {
  display: block;
  font-weight: 600;
  font-size: 13px;
  color: var(--primary);
}
.skill-picker__item-desc {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
  /* clamp very long descriptions to two lines */
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.skill-picker__empty {
  padding: 14px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

/* ─────────────────── Mention picker (@workspace) ─────────────────── */
.mention-picker {
  position: absolute;
  bottom: 100%;
  left: 16px;
  right: 16px;
  margin-bottom: 8px;
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  box-shadow: var(--shadow-panel);
  z-index: 51;
  font-family: inherit;
}
.mention-picker__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--grayscale-lighter);
  cursor: pointer;
  font-family: inherit;
  color: var(--text-strong);
}
.mention-picker__item:last-child { border-bottom: 0; }
.mention-picker__item.is-active,
.mention-picker__item:hover { background: var(--bg-hover); }
.mention-picker__item-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  opacity: 0.6;
}
.mention-picker__item-label {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mention-picker__empty {
  padding: 14px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

/* Workspace tile (folder icon) */
.context-icon--workspace {
  width: 20px;
  height: 20px;
}
.context-icon--workspace svg { display: block; width: 20px; height: 20px; }

/* ─────────────────────── Responsive ─────────────────────── */
@media (min-width: 900px) {
  body.history-open .doxi-page {
    padding-left: var(--history-width);
  }
  body.history-open .history-sidebar {
    box-shadow: none;
  }
}

@media (max-width: 899px) {
  body.history-open::before {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 640px) {
  .settings-overlay {
    align-items: stretch;
    padding: 12px;
  }
  .settings-panel {
    max-height: calc(100vh - 24px);
  }
  .settings-panel__body {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .settings-nav {
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--grayscale-10);
  }
  .settings-nav__item {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .settings-content {
    padding: 16px;
  }
  .settings-row,
  .settings-server {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }
  .settings-row {
    flex-direction: column;
    gap: 8px;
  }
  .settings-server__status {
    justify-self: start;
  }
}

@media (pointer: coarse) {
  .history-item__delete {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 820px) {
  body { display: block; }
  .ad-header__icon-button--mobile-sidebar { display: inline-flex; }
  .doxi-page {
    width: 100%;
    height: 100%;
    padding-left: 0;
  }
  .doxi-page { border-left: 0; border-right: 0; }
  .hero { padding: 32px 24px 24px; }
  .hero__title { font-size: clamp(20px, 5vw, 24px); }
  .history-sidebar {
    width: 0;
    padding-left: 0;
    padding-right: 0;
    border-right: 0;
  }
  body.history-open .history-sidebar {
    width: calc(100vw - 24px);
    max-width: 360px;
    padding-left: 10px;
    padding-right: 10px;
    border-right: 1px solid var(--border-subtle);
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  .doxi-page,
  .history-sidebar,
  .history-item,
  .history-item__delete {
    transition: none;
  }
}

/* ── Remember-me checkbox on the login form ──────────────────────────── */
.login-panel__remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  user-select: none;
  margin-top: -4px;
}
.login-panel__remember input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--primary, #1A4FB6);
  cursor: pointer;
}
.login-panel__remember span { cursor: pointer; }

/* ── Connection Settings (login-screen popup) ─────────────────────────── */
/* Action row: gear button + sign-in button side by side */
.login-panel__actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.login-panel__actions .login-panel__submit {
  flex: 1;
  margin: 0;
}
.login-panel__gear {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: auto;
  background: var(--bg-surface, transparent);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  line-height: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.login-panel__gear:hover {
  color: var(--text-strong);
  border-color: var(--text-muted);
}
.login-panel__gear:focus-visible {
  outline: 2px solid var(--primary, #1A4FB6);
  outline-offset: 1px;
}
.login-panel__gear svg { width: 20px; height: 20px; }

.conn-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
}
.conn-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  box-shadow: var(--shadow-panel);
  width: min(460px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  color: var(--text-strong);
}
.conn-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.conn-panel__title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-strong);
}
.conn-panel__close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.25rem;
  border-radius: 0.25rem;
  line-height: 0;
}
.conn-panel__close:hover { color: var(--text-strong); }
.conn-panel__close svg { width: 22px; height: 22px; }
.conn-panel__footer {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

.conn-section {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.conn-section__title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin: 0;
}
.conn-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.conn-field--row {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}
.conn-field__label {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.conn-field__input {
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  background: var(--bg-surface);
  color: var(--text-strong);
  font-size: 0.875rem;
  width: 100%;
  box-sizing: border-box;
}
select.conn-field__input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'><path d='M2.5 4L6 7.5L9.5 4' stroke='%2364748b' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  padding-right: 1.75rem;
}
.conn-field__hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0.1rem 0 0 0;
  line-height: 1.35;
}
.conn-field__input:focus {
  outline: 2px solid var(--primary, #1A4FB6);
  outline-offset: -1px;
}
.conn-proxy-fields {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-left: 1.25rem;
}

.conn-btn {
  border: 1px solid var(--border-subtle);
  background: none;
  border-radius: 6px;
  padding: 0.4rem 1rem;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--text-strong);
  white-space: nowrap;
}
.conn-btn--primary {
  background: var(--primary, #1A4FB6);
  color: #fff;
  border-color: transparent;
}
.conn-btn:hover:not(:disabled) { filter: brightness(1.1); }

.conn-status { font-size: 0.8rem; }
.conn-status[data-status-type="ok"]      { color: #16a34a; }
.conn-status[data-status-type="warning"] { color: #d97706; }
.conn-status[data-status-type="error"]   { color: #dc2626; }

.conn-restart-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  font-size: 0.82rem;
  color: #92400e;
}
[data-theme="dark"] .conn-restart-notice {
  background: #451a03;
  border-color: #92400e;
  color: #fcd34d;
}


/* Entity card v2 */
.rc-card-v2 {
  background: linear-gradient(180deg, var(--bg-elevated), var(--bg-surface));
}

.rc-header--v2 {
  align-items: flex-start;
  gap: 10px;
}

.rc-collapse { display: none; }

/* Entity card header is the collapse toggle */
.rc-header--v2[data-card-toggle="collapse"],
.rc-header--v2[data-card-action="entity_card_fetch"] {
  cursor: pointer;
  border-radius: 12px 12px 0 0;
  transition: background 0.1s;
}
.rc-header--v2[data-card-toggle="collapse"]:hover,
.rc-header--v2[data-card-action="entity_card_fetch"]:hover,
.rc-header--v2[data-card-action="entity_card_fetch"].is-loading {
  background: rgba(3, 105, 161, 0.05);
}
.rc-header--v2[data-card-toggle="collapse"]:focus-visible,
.rc-header--v2[data-card-action="entity_card_fetch"]:focus-visible,
.rc-result-row-v2[data-card-action="entity_card_fetch"]:focus-visible {
  outline: 2px solid rgba(3, 105, 161, 0.45);
  outline-offset: 2px;
}
.result-card.is-collapsed .rc-card-v2 > :not(.rc-header--v2) { display: none; }
.result-card.is-collapsed .rc-card-v2 { overflow: hidden; }
.result-card.is-collapsed .rc-header--v2[data-card-toggle="collapse"] {
  border-radius: 12px;
}
.object-cards .result-card--legacy-collapsible > .rc-header[data-card-toggle="collapse"] {
  cursor: pointer;
  transition: background 0.1s;
}
.object-cards .result-card--legacy-collapsible > .rc-header[data-card-toggle="collapse"]:hover {
  background: rgba(3, 105, 161, 0.05);
}
.object-cards .result-card--legacy-collapsible > .rc-header[data-card-toggle="collapse"]:focus-visible {
  outline: 2px solid rgba(3, 105, 161, 0.45);
  outline-offset: 2px;
}
.object-cards .result-card--legacy-collapsible.is-collapsed > :not(.rc-header) { display: none; }

/* Task rows as card-header-style toggle buttons */
.rc-task-v2:has(.rc-task-v2__header) {
  display: block;
  padding: 0;
}

.rc-task-v2__header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-strong);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.rc-task-v2__header:hover {
  background: rgba(3, 105, 161, 0.05);
}

.rc-task-v2__header[aria-expanded="true"] {
  background: rgba(3, 105, 161, 0.06);
}

.rc-task-v2__header .rc-task-v2__title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Hide the redundant inline-detail header inside task rows */
.rc-task-v2 .rc-inline-detail__header { display: none; }
.rc-task-v2 .rc-inline-detail {
  margin-top: 0;
  border-radius: 0 0 8px 8px;
}


.rc-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.rc-subtitle {
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.35;
}

.rc-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  max-width: 45%;
}

.rc-badge,
.rc-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--grayscale-lighter);
  color: var(--text-strong);
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.rc-badge--muted { color: var(--text-muted); }
.rc-badge--success,
.rc-status-pill--success { background: rgba(22, 163, 74, 0.11); color: #166534; }
.rc-badge--active,
.rc-status-pill--active { background: rgba(3, 105, 161, 0.12); color: #075985; }
.rc-badge--warning,
.rc-status-pill--warning { background: rgba(217, 119, 6, 0.13); color: #92400e; }
.rc-badge--danger,
.rc-status-pill--danger { background: rgba(220, 38, 38, 0.11); color: #991b1b; }

.rc-attrs-title {
  padding: 8px 14px 0;
  color: var(--text-muted);
  font-size: 11px;
}

.rc-attrs-v2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 12px;
  padding: 10px 14px;
  border-bottom: 0.5px solid var(--border-subtle);
}

.rc-attr {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  color: var(--text-muted);
  font-size: 11.5px;
}

.rc-attr strong {
  color: var(--text-strong);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.rc-attr span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rc-file-grid,
.rc-task-list-v2,
.rc-result-list-v2,
.rc-people,
.rc-flow {
  list-style: none;
  margin: 0;
  padding: 8px 14px 10px;
}

.rc-file-grid,
.rc-task-list-v2,
.rc-result-list-v2,
.rc-people {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rc-file-card {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 7px 8px;
  border: 0.5px solid var(--border-subtle);
  border-radius: 9px;
  background: var(--bg-elevated);
}

.rc-file-view {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 3px 10px;
  border: 0.5px solid var(--border-default);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-muted);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.rc-file-view:hover {
  color: var(--text-strong);
  background: rgba(3, 105, 161, 0.08);
}

.rc-file-view:focus-visible {
  outline: 2px solid rgba(3, 105, 161, 0.42);
  outline-offset: 2px;
}

.rc-file-view.is-loading {
  color: var(--text-strong);
  background: rgba(3, 105, 161, 0.08);
}

.rc-file-preview {
  flex: 1 0 calc(100% - 42px);
  width: calc(100% - 42px);
  min-width: 0;
  margin: 2px 0 0 42px;
  border: 0.5px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-surface);
  overflow: hidden;
}

.rc-file-preview.is-loading,
.rc-file-preview--error {
  padding: 9px 10px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.rc-file-preview--error {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.06);
}

.rc-file-preview__header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 10px;
  border-bottom: 0.5px solid var(--border-subtle);
}

.rc-file-preview__title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-strong);
  font-size: 12px;
  font-weight: 650;
}

.rc-file-preview__meta {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 11px;
}

.rc-file-preview__body {
  max-height: 280px;
  margin: 0;
  padding: 10px;
  overflow: auto;
  color: var(--text-strong);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.rc-file-ext {
  flex: 0 0 auto;
  min-width: 34px;
  padding: 3px 5px;
  border-radius: 6px;
  background: rgba(3, 105, 161, 0.11);
  color: #075985;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
}

.rc-file-body,
.rc-person__body,
.rc-task-v2__body,
.rc-flow__body,
.rc-result-row-v2__main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.rc-file-name,
.rc-person__name,
.rc-task-v2__title,
.rc-flow__title {
  color: var(--text-strong);
  font-size: 12.5px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rc-flow {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.rc-flow__item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  position: relative;
  padding: 5px 0 8px;
}

.rc-flow__item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 20px;
  bottom: -2px;
  width: 1px;
  background: var(--border-subtle);
}

.rc-flow__dot,
.rc-task-v2__dot {
  width: 11px;
  height: 11px;
  margin-top: 3px;
  border-radius: 999px;
  background: var(--border-default);
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.12);
}

.rc-flow__item.is-current .rc-flow__dot,
.rc-task-v2--active .rc-task-v2__dot {
  background: #0284c7;
  box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.14);
}

.rc-flow__item--success .rc-flow__dot,
.rc-task-v2--success .rc-task-v2__dot { background: #16a34a; }
.rc-flow__item--warning .rc-flow__dot,
.rc-task-v2--warning .rc-task-v2__dot { background: #d97706; }
.rc-flow__item--danger .rc-flow__dot,
.rc-task-v2--danger .rc-task-v2__dot { background: #dc2626; }

.rc-flow__status,
.rc-flow__meta,
.rc-task-v2__meta,
.rc-file-meta,
.rc-person__meta {
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.35;
}

.rc-task-v2,
.rc-result-row-v2,
.rc-person {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 0;
  border-bottom: 0.5px solid var(--border-subtle);
}

.rc-task-v2:last-child,
.rc-result-row-v2:last-child,
.rc-person:last-child { border-bottom: 0; }

.rc-status-pill { margin-left: auto; }

.rc-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  color: var(--text-strong);
  font-size: 11px;
  font-weight: 750;
}

.rc-person--group .rc-avatar { background: rgba(217, 119, 6, 0.14); color: #92400e; }
.rc-person--unit .rc-avatar { background: rgba(3, 105, 161, 0.13); color: #075985; }

.rc-result-row-v2 {
  align-items: flex-start;
}

.rc-result-row-v2[data-card-action="entity_card_fetch"] {
  cursor: pointer;
  border-radius: 8px;
  padding-inline: 6px;
}

.rc-result-row-v2[data-card-action="entity_card_fetch"]:hover,
.rc-result-row-v2[data-card-action="entity_card_fetch"].is-loading {
  background: rgba(3, 105, 161, 0.05);
}

.rc-result-row-v2 .rc-badges {
  justify-content: flex-start;
  max-width: none;
  margin-left: auto;
}

.rc-result-row-v2.is-expanded,
.rc-task-v2.is-expanded {
  flex-wrap: wrap;
  align-items: stretch;
}

.rc-inline-detail {
  flex: 1 0 100%;
  margin-top: 8px;
  border: 0.5px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-elevated);
}

.rc-inline-detail__header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 10px;
  border: 0;
  border-bottom: 0.5px solid var(--border-subtle);
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(241, 245, 249, 0.72));
  color: var(--text-strong);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.rc-inline-detail__header:hover {
  background: rgba(3, 105, 161, 0.08);
}

.rc-inline-detail__header:focus-visible {
  outline: 2px solid rgba(3, 105, 161, 0.42);
  outline-offset: -2px;
}

.rc-inline-detail__title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 700;
}

.rc-inline-detail.is-collapsed .rc-inline-detail__body {
  display: none;
}

.rc-inline-detail.is-collapsed .rc-inline-detail__header {
  border-bottom: 0;
}

.rc-inline-detail .rc-card-v2 {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.rc-inline-detail__body > .rc-card-v2 > .rc-header {
  display: none;
}

.rc-actions {
  display: flex;
  gap: 6px;
}

.rc-actions--footer {
  justify-content: flex-end;
  padding: 9px 14px 12px;
  border-top: 0.5px solid var(--border-subtle);
}

.rc-action {
  border: 0.5px solid var(--border-default);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-strong);
  min-height: 28px;
  padding: 0 10px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
}

.rc-action:hover {
  background: rgba(3, 105, 161, 0.08);
  border-color: rgba(3, 105, 161, 0.28);
}

.rc-action:focus-visible {
  outline: 2px solid rgba(3, 105, 161, 0.45);
  outline-offset: 2px;
}

.rc-more-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 14px 12px;
}

.rc-more-row .rc-note {
  padding: 0;
}

.rc-action--more {
  min-height: 24px;
  padding: 0 9px;
  font-size: 11px;
}

.rc-tree__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
}

@media (max-width: 720px) {
  .rc-attrs-v2 { grid-template-columns: 1fr; }
  .rc-badges { max-width: 100%; justify-content: flex-start; }
  .rc-result-row-v2 { flex-wrap: wrap; }
  .rc-result-row-v2 .rc-badges { margin-left: 0; }
}
