/* Conversation first: one input row, optional tools, one mobile header. */
.shell[data-view='chat'] .composer--enhanced {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto auto;
  align-items: end; gap: 0 .25rem; padding: .4rem;
  border-radius: 1.75rem; box-shadow: 0 2px 14px #00000008;
}
.shell[data-view='chat'] .composer__field {
  grid-column: 2; grid-row: 1; order: 0; min-height: 44px;
  padding: .65rem .15rem; line-height: 1.45; max-height: min(10rem, 24dvh);
}
.shell[data-view='chat'] .chat-attachments { display: contents; }
.shell[data-view='chat'] .composer__more { grid-column: 1; grid-row: 1; position: static; }
.shell[data-view='chat'] .composer__more > summary {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 50%;
}
.composer__more > summary svg { width: 22px; height: 22px; }
.shell[data-view='chat'] .composer__toolbar { grid-column: 5; grid-row: 1; }
.shell[data-view='chat'] .composer > .guard-status { grid-column: 3; grid-row: 1; align-self: end; min-height: 44px; justify-content: center; }
.shell[data-view='chat'] .composer__actions { margin: 0; }
.shell[data-view='chat'] .composer__actions > .button,
.shell[data-view='chat'] .chat-speech > .ui-action { width: 44px; height: 44px; min-width: 44px; min-height: 44px; border-radius: 50%; padding: .65rem; }
.shell[data-view='chat'] .composer__actions > .button:disabled { background: var(--surface); color: var(--text-quiet); opacity: .65; }
.shell[data-view='chat'] .chat-speech--input { grid-column: 4; grid-row: 1; }
.shell[data-view='chat'] .chat-speech--conversation { grid-column: 5; grid-row: 1; }
.shell[data-view='chat'] .chat-speech--input,
.shell[data-view='chat'] .chat-speech--conversation { padding: 0; margin: 0; border: 0; background: none; gap: .35rem; min-width: 0; }
.shell[data-view='chat'] .chat-speech[data-active='true'],
.shell[data-view='chat'] .chat-speech:has(> .notice),
.shell[data-view='chat'] .chat-speech:has(> .form__hint) {
  grid-column: 1 / -1; grid-row: auto; flex-wrap: wrap; padding: .5rem; border-top: 1px solid var(--line);
}
.shell[data-view='chat'] .chat-speech[data-active='true'] select { min-width: 0; max-width: 100%; }
.shell[data-view='chat'] .chat-speech > :is(.notice, .form__hint) { flex-basis: 100%; }
.shell[data-view='chat'] .composer[data-has-draft='true'] .chat-speech--conversation[data-active='false'] > [data-action='conversation'] { display: none; }
.shell[data-view='chat'] .composer[data-has-draft='false']:has(.chat-speech--conversation[data-active='false']) .composer__toolbar { display: none; }
.shell[data-view='chat'] .chat-speech--conversation[data-active='false'] > .button { color: var(--surface-raised); background: var(--text); }
.shell[data-view='chat'] .chat-attachments__pending,
.shell[data-view='chat'] .chat-attachments__files,
.shell[data-view='chat'] .chat-attachments__error { grid-column: 1 / -1; order: -1; min-width: 0; margin: .35rem; }
.shell[data-view='chat'] .composer__status:not([hidden]),
.shell[data-view='chat'] .composer > .form__hint { grid-column: 1 / -1; margin: .35rem .65rem; }
.shell[data-view='chat'] .composer__more-menu {
  left: 0; right: auto; bottom: calc(100% + .5rem); width: min(21rem, 100%);
  max-height: calc(var(--workspace-height, 100dvh) - 9rem); text-align: left;
}
.shell[data-view='chat'] .chat-attachments__toolbar { display: grid; gap: .15rem; }
.shell[data-view='chat'] .chat-attachments__toolbar .ui-action,
.shell[data-view='chat'] .composer__option-items > .button {
  width: 100%; min-height: 44px; justify-content: flex-start; padding: .6rem .7rem; font-size: .875rem;
  white-space: normal; text-align: left; margin: 0;
}
.shell[data-view='chat'] .chat-attachments__toolbar .ui-action > span { display: inline; }
.composer__option-items { border-top: 1px solid var(--line); padding-top: .35rem; display: grid; gap: .2rem; }
.shell[data-view='chat'] .composer__more-menu .composer__research { min-height: 44px; font-size: .875rem; border: 0; margin: 0; }
.shell[data-view='chat'] .chat-project-files,
.shell[data-view='chat'] .chat-attachments__options,
.shell[data-view='chat'] .chat-speech__settings {
  position: absolute; left: 0; right: 0; bottom: calc(100% + .5rem); z-index: 24;
  max-height: calc(var(--workspace-height, 100dvh) - 10rem); overflow-y: auto;
  margin: 0; padding: .75rem; border: 1px solid var(--line); border-radius: 1rem;
  background: var(--surface-raised); box-shadow: 0 8px 24px #0002;
}
.chat-speech__settings { display: flex; align-items: center; gap: .5rem; }
.chat-speech__settings select { flex: 1; min-width: 0; }
.chat-attachments__options > .ui-action:first-child { float: right; }
.shell[data-view='chat'] .main__tools { gap: .35rem; min-width: 0; }
.main__tools .chat-model-picker { min-width: 0; max-width: min(17rem, 35vw); }
.main__tools .chat-model-picker__popover { top: calc(100% + .5rem); bottom: auto; left: auto; right: 0; max-height: calc(var(--workspace-height, 100dvh) - 10rem); overflow-y: auto; }
.chat-model-picker__popover > .chat-model-picker__option { margin-bottom: .8rem; }
.main__tools .chat-model-picker__icon { display: none; }
.main__tools .chat-model-picker > summary { min-height: 44px; }
.shell[data-view='chat'] .turn__details { opacity: .7; font-size: .75rem; }
.shell[data-view='chat'] .turn__details[open], .shell[data-view='chat'] .turn__details:hover { opacity: 1; }
@media (max-width: 68rem) {
  .shell[data-view='chat'][data-sidebar='closed'] { --topbar-height: 0px; grid-template-rows: 0 minmax(0, 1fr); }
  .shell[data-view='chat'][data-sidebar='closed'] > .shell__body { grid-row: 2; }
  .shell[data-view='chat'][data-sidebar='closed'] > .topbar { display: none; }
  .application:has(.shell[data-view='chat'][data-sidebar='closed']) .kintari-launcher { display: none; }
  .shell[data-view='chat'] { --header-height: calc(3.5rem + env(safe-area-inset-top)); }
  .shell[data-view='chat'] .main__header { padding: env(safe-area-inset-top) .5rem 0; gap: .25rem; }
  .shell[data-view='chat'] .main__left { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .shell[data-view='chat'] .main__left .button { display: none; }
  .shell[data-view='chat'] .main__tools { flex: 1; margin-left: 0; }
  .main__tools .chat-model-picker { flex: 1; max-width: none; position: static; }
  .main__tools .chat-model-picker__current { flex: 1; min-width: 0; }
  .main__tools .chat-model-picker__current strong { max-width: 100%; }
  .main__tools .chat-model-picker__popover { top: calc(3.5rem + env(safe-area-inset-top)); left: .5rem; right: .5rem; width: auto; }
  .shell[data-view='chat'] .main__footer { padding: .4rem max(.6rem, env(safe-area-inset-right)) max(.6rem, env(safe-area-inset-bottom)) max(.6rem, env(safe-area-inset-left)); }
  .shell[data-view='chat'] .main__middle { padding: .5rem .9rem; }
  .shell[data-view='chat'] .chat-preview { top: var(--header-height); height: calc(var(--workspace-height, 100dvh) - var(--header-height)); }
}

.shell[data-view='chat'] .main__tools .chat-model-picker__current strong { max-width: 100%; }

.chat-speech__output-settings { position: relative; order: 1; }
.chat-speech__output-settings > summary { list-style: none; display: grid; place-items: center; width: 44px; height: 44px; cursor: pointer; color: var(--text-quiet); border-radius: 50%; }
.chat-speech__output-settings > summary::-webkit-details-marker { display: none; }
.chat-speech__output-settings > summary svg { width: 18px; height: 18px; }
.chat-speech__output-settings > summary:focus-visible { outline: 2px solid var(--accent); }
.chat-speech__output-settings > select { position: absolute; bottom: calc(100% + .25rem); left: 0; width: min(20rem, calc(100vw - 7rem)); max-width: none; z-index: 2; }

.chat-context { display: flex; align-items: center; gap: .15rem; flex-shrink: 0; }
.chat-context__usage { font-size: .75rem; color: var(--text-quiet); font-variant-numeric: tabular-nums; cursor: help; }
.chat-context__usage[data-high='true'] { color: var(--text); font-weight: 700; }
.chat-context__usage:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
.chat-context > .ui-action { width: 32px; min-width: 32px; padding: .35rem; }

/* One sidebar for navigation and conversations. Brand colours remain inherited. */
:root { --rail-width: 18rem; }
.rail .rail__items { gap: .65rem; }
.rail .rail__item { min-height: 2.6rem; font-size: .9rem; }
.rail__new-chat { justify-content: flex-start; background: var(--accent-soft); color: var(--accent); border-color: transparent; padding: .7rem .85rem; }
.rail__new-chat:hover { border-color: var(--accent); }
.rail .rail__label { font-size: .8rem; text-transform: none; letter-spacing: normal; }
.rail__conversations { min-width: 0; margin-top: .5rem; }
.rail__conversation-heading h2 { font-size: .8rem; font-weight: 500; color: var(--text-quiet); margin: 0; }
.rail .rail__section-toggle { display: flex; align-items: center; justify-content: flex-start; box-sizing: border-box; width: 100%; min-height: 44px; gap: .35rem; margin: 0; padding: .6rem .65rem; border: 0; border-radius: .3rem; background: transparent; color: var(--text-quiet); font-family: var(--font-ui); font-size: .8rem; font-weight: 500; line-height: 1.4; text-align: left; list-style: none; cursor: pointer; }
.rail__section-toggle::-webkit-details-marker { display: none; }
.rail .rail__section-toggle > svg { flex: none; width: 1rem; height: 1rem; }
.rail__disclosure[open] > .rail__section-toggle > svg,
.rail__section-toggle[aria-expanded='true'] > svg { transform: rotate(90deg); }
.rail .rail__section-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.rail__conversations .conversations__search { margin: .4rem .25rem; }
.rail__conversations .conversations__search .field { min-height: 2.4rem; font-size: .85rem; }
.rail__conversations .conversation { border-radius: .4rem; margin-block: 0; }
.rail__conversations .conversation__open { min-height: 44px; padding: .35rem .7rem; }
.rail__conversations .conversation__title { font-size: .875rem; font-weight: 400; }
.rail__conversations .conversation__timestamp, .rail__conversations .conversation__turns { display: none; }
/* Keep each desktop row compact; touch keeps the full 44px opening target. */
@media (hover: hover) and (pointer: fine) {
  .rail__conversations .conversation__open { min-height: 32px; padding-block: .25rem; }
}
.rail__administration { margin-top: 0; min-height: 0; }
.rail__administration > .rail__links { max-height: min(45dvh, 24rem); overflow-y: auto; overscroll-behavior-y: contain; }
.rail .rail__foot { border: 0; padding: .5rem 0 0; font-size: .7rem; }
.rail__foot .rail__version { margin-left: .7rem; }
.rail__foot .rail__legal-links { padding-inline: .7rem; }
.workspace-details { position: relative; }
.topbar:has(.workspace-details[open]) { overflow: visible; z-index: 31; }
.workspace-details > summary { list-style: none; cursor: pointer; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; }
.workspace-details > summary::-webkit-details-marker { display: none; }
.workspace-details > summary svg { width: 22px; height: 22px; }
.workspace-details > summary:hover { background: var(--surface); }
.workspace-details > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.workspace-details > summary .topbar__avatar { display: grid; }
.workspace-details__body { position: absolute; right: 0; top: calc(100% + .5rem); width: min(18rem, calc(100vw - 2rem)); max-height: 75dvh; overflow: auto; z-index: 30; padding: .4rem; display: grid; gap: 0; border: 1px solid var(--line); border-radius: .85rem; background: var(--surface-raised); box-shadow: 0 8px 28px #0002; }
.workspace-details__body .topbar__me { gap: .65rem; padding: .7rem .6rem; border-bottom: 1px solid var(--line); margin-bottom: .3rem; }
.workspace-details__body .topbar__avatar { display: grid; }
.workspace-details__body .topbar__who { display: grid; gap: .15rem; min-width: 0; overflow-wrap: anywhere; flex: 1; }
.profile-menu__actions { display: grid; gap: .1rem; }
.profile-menu__footer { border-top: 1px solid var(--line); margin-top: .3rem; padding-top: .3rem; }
.workspace-details__body .profile-menu__action { display: flex; width: 100%; min-height: 44px; justify-content: flex-start; gap: .65rem; padding: .6rem; border: 0; border-radius: .45rem; background: transparent; color: var(--text); font-size: .85rem; font-weight: 400; text-align: left; }
.workspace-details__body .profile-menu__action:hover { background: var(--accent-soft); }
.workspace-details__body .profile-menu__action > svg { flex: none; width: 1.1rem; height: 1.1rem; color: var(--text-quiet); }
.workspace-details__body .update-controls__status:has(> span:empty):not(:has(a)) { display: none; }
.workspace-details__body .index-badge__text { display: inline; }
.chat-technical-details { padding: .5rem; }
.chat-technical-details > summary { cursor: pointer; font-size: .85rem; }
.chat-technical-details .chat-context { padding-top: .5rem; }
.shell[data-view='chat'] .main__middle > .content,
.shell[data-view='chat'] .main__footer > .content { max-width: 52rem; margin-inline: auto; }
.shell[data-view='chat'] .main--welcome { grid-template-rows: var(--header-height) minmax(0, 1fr) auto minmax(0, 1.2fr); }
.shell[data-view='chat'] .main--welcome > .main__middle { display: flex; align-items: flex-end; padding-bottom: 1.25rem; }
.shell[data-view='chat'] .main--welcome .empty { min-height: 0; padding: 0; text-align: center; }
.shell[data-view='chat'] .main--welcome .empty__visual { display: none; }
.shell[data-view='chat'] .main--welcome .empty__title { font-family: var(--font-ui); font-size: clamp(1.6rem, 2.5vw, 2.2rem); font-weight: 550; letter-spacing: -.035em; }
.shell[data-view='chat'] .main--welcome .empty p { max-width: 34rem; margin: .8rem auto 0; font-size: .95rem; color: var(--text-quiet); }
.shell[data-view='chat'] .main--welcome > .main__footer { grid-row: 3; }
.shell[data-view='chat'] .main--welcome .composer--enhanced { border-radius: 1.5rem; padding: .75rem; }
/* Keep the text and all controls on the same baseline, including the welcome view. */
.shell[data-view='chat'] .main--welcome .composer__field { min-height: 44px; }
.shell[data-view='chat'] .composer__field { margin: 0; padding: .65rem .35rem; }
.shell[data-view='chat'] .composer__toolbar { align-self: end; }
.shell[data-view='chat'] .composer__actions { align-items: center; }
@media (max-width: 68rem) {
  .shell__body[data-panel='false'] .drawer > .rail { flex: 1; min-height: 0; overflow: hidden; }
  .shell__body[data-panel='false'] .drawer .rail__items { overflow-y: auto; }
  .shell[data-view='chat'] .main--welcome { grid-template-rows: var(--header-height) minmax(0, 1fr) auto minmax(0, 1fr); }
  .shell[data-view='chat'] .main--welcome .empty__title { font-size: 1.65rem; }
}
@media (max-height: 560px) {
  .shell[data-view='chat'] .main--welcome { grid-template-rows: var(--header-height) minmax(0, 1fr) auto; }
  .shell[data-view='chat'] .main--welcome .empty p { display: none; }
}

.agent-file-draft__heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.agent-file-draft__heading strong { overflow-wrap: anywhere; }
.agent-file-draft__location { margin-top: .4rem; font-size: .8rem; color: var(--text-quiet); }
.agent-file-draft__location > summary { cursor: pointer; }
.agent-file-draft__location .agent-file-draft__path { margin-top: .4rem; }
.agent-file-draft__location > summary:focus-visible,
.chat-technical-details > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.rail .rail__legal-links a { color: var(--text-quiet); }

/* Desktop collapse is independent of the mobile drawer's automatic dismissal. */
@media (min-width: 68.001rem) {
  .shell[data-sidebar-collapsed='true'] > .shell__body { grid-template-columns: minmax(0, 1fr); }
  .shell[data-sidebar-collapsed='true'] > .shell__body > .drawer { display: none; }
}
@media (max-width: 68rem) {
  .sidebar-toggle--desktop { display: none; }
}

.chat-compose { width: 100%; min-width: 0; }
.chat-file-drop { position: fixed; inset: 12px; z-index: 1000; display: grid; place-items: center; pointer-events: none; border: 2px dashed var(--accent); border-radius: 14px; background: color-mix(in srgb, var(--surface-raised) 85%, transparent); color: var(--accent); }
.chat-file-drop__label { padding: 1rem; text-align: center; font-weight: 600; }
.chat-starters { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin-top: 1rem; }
.chat-starters .chat-starters__item { min-height: 2.75rem; padding: .65rem .9rem; border: 1px solid var(--line); border-radius: .85rem; background: var(--surface-raised); font-size: .85rem; white-space: normal; }
.chat-starters .chat-starters__item:not(:disabled):hover { border-color: var(--accent); background: var(--accent-soft); }
.chat-starters__item svg { width: 1.1rem; height: 1.1rem; flex-shrink: 0; color: var(--accent); }
@media (max-width: 36rem) {
  .chat-starters { display: grid; grid-template-columns: minmax(0, 1fr); }
  .chat-starters .chat-starters__item { justify-content: flex-start; }
}
.result-card > strong,
.result-card .agent-file-draft__heading strong { overflow-wrap: anywhere; }
.result-card__status { color: var(--muted, #5e6875); margin: .5rem 0; }
.result-card__details { margin-top: .85rem; min-width: 0; }
.result-card__details > summary { cursor: pointer; color: var(--muted, #5e6875); font-size: .85rem; width: fit-content; }
.result-card__details > summary:focus-visible { outline: 2px solid var(--accent, #188e86); outline-offset: 4px; border-radius: 3px; }
.result-card__details[open] > summary { margin-bottom: .65rem; }
.result-card__details pre,
.result-card__details code { overflow-wrap: anywhere; word-break: break-word; }
.answer-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .85rem 0 .4rem; }
.answer-actions__status { font-size: .85rem; color: var(--muted, #5e6875); }
.answer-editor .agent-file-draft__actions { align-items: center; }
.files-upload-zone { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border: 1px dashed var(--accent); background: var(--accent-soft); border-radius: 1rem; padding: 1.25rem; margin: 1rem 0; }
.files-upload-zone[data-dragging='true'] { outline: 2px solid var(--accent); outline-offset: 3px; }
.files-upload-zone .form__hint { margin-bottom: 0; }
.files-upload__result { border-top: 1px solid var(--line); margin-top: .85rem; padding-top: .85rem; overflow-wrap: anywhere; }
.upload-followups { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .65rem; }
.upload-followups .button { white-space: normal; font-size: .85rem; }
.upload-followups .button svg { flex-shrink: 0; }
.chat-attachments__location { font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }
.chat-attachments__location > summary { cursor: pointer; }

/* Plain-language feedback stays separate from optional execution details. */
.chat-feedback { margin: 16px 0; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.chat-feedback__message { margin: 0 0 10px; line-height: 1.6; }
.chat-feedback__hint, .chat-feedback__details { color: var(--text-quiet); font-size: .9rem; }
.chat-feedback__details { margin-top: 12px; }
.chat-feedback__details summary { cursor: pointer; width: fit-content; }
.chat-feedback__details code { overflow-wrap: anywhere; white-space: pre-wrap; }
.chat-feedback__progress { display: flex; align-items: center; gap: 10px; color: var(--text-quiet); margin: 12px 0; }
.chat-feedback__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }
.shell[data-view='chat'] .composer__actions > .button--stop,
.shell[data-view='chat'] .composer__actions > .button--retry { width: auto; min-width: 44px; padding-inline: 14px; gap: 7px; border-radius: 22px; }

/* Project creation keeps optional storage choices out of the first step. */
.project-create { width: 100%; max-width: 42rem; }
.project-create__settings { margin: .25rem 0 1rem; }
.project-create__settings > summary { cursor: pointer; color: var(--text-quiet); padding: .5rem 0; }
.project-create__settings > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: .25rem; }
.project-create__settings[open] > summary { margin-bottom: .5rem; }

/* Files keep the next useful action visible and disclose storage details on demand. */
.files-browser .tree__item--file { border-bottom: 1px solid var(--line); padding: .35rem 0 .55rem; }
.file-entry__info { display: grid; gap: .25rem; min-width: 0; text-align: left; }
.file-entry__meta { font-size: .7rem; color: var(--text-quiet); font-weight: 400; line-height: 1.5; }
.file-status[data-state="ready"] { color: var(--accent); }
.file-status[data-state="needs-attention"], .file-status[data-state="too-large"] { color: var(--warning); }
.file-entry__actions { display: flex; align-items: flex-start; flex-wrap: wrap; gap: .4rem .75rem; padding: .1rem .35rem; }
.file-entry__actions .file-chat-action { padding: .35rem .55rem; min-height: 2rem; font-size: .72rem; }
.file-entry-details { min-width: 0; font-size: .72rem; color: var(--text-quiet); }
.file-entry-details > summary { cursor: pointer; padding: .45rem .15rem; }
.file-entry-details[open] { flex-basis: 100%; }
.file-entry-details dl { display: grid; gap: .4rem; margin: .4rem 0; }
.file-entry-details dl > div { display: grid; grid-template-columns: minmax(4rem, 35%) minmax(0, 1fr); gap: .4rem; }
.file-entry-details dd { margin: 0; overflow-wrap: anywhere; color: var(--text); }
.file-entry-details summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.file-view__head > .file-status { font-size: .8rem; }
.file-view__actions { flex-wrap: wrap; }
.files-browser__maintenance .files__actions { flex-wrap: wrap; margin-top: .75rem; }

/* Compact attachments keep the message field in focus. */
.composer--enhanced .chat-attachments__list {
  grid-template-columns: minmax(0, 1fr);
  gap: .35rem;
  max-height: min(18rem, 30vh);
}
.composer--enhanced .chat-attachments__item { padding: .45rem .6rem; border-radius: .65rem; }
.chat-attachments__file-actions { display: flex; align-items: center; gap: .15rem; flex-shrink: 0; }
.chat-attachments__file-actions .ui-action { width: 2rem; height: 2rem; padding: .35rem; }
.chat-attachments__file-actions .ui-action[aria-expanded='true'] { background: var(--accent-soft); color: var(--accent); }
.chat-attachments__file-header { gap: .5rem; }
.chat-attachments__type { height: 2.1rem; flex-basis: 2rem; }
.chat-attachments__data-class { margin-top: .35rem; font-size: .72rem; }
.chat-attachments__data-class label { flex-wrap: wrap; color: var(--text-quiet); }
.chat-attachments__data-class .field { font-size: .72rem; min-height: 1.65rem; padding: .15rem .4rem; max-width: 100%; }
.chat-attachments__details { margin-top: .3rem; font-size: .75rem; }
.chat-attachments__details > summary { width: fit-content; color: var(--text-quiet); cursor: pointer; }
.chat-attachments__metadata { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .35rem .75rem; }
.chat-attachments__metadata dt { color: var(--text-quiet); }
.chat-attachments__metadata dd { margin: 0; overflow-wrap: anywhere; }
.chat-attachments__bundle > summary {
  cursor: pointer; padding: .55rem .65rem; border: 1px solid var(--line);
  border-radius: .65rem; font-size: .8rem; background: var(--accent-soft);
}
.chat-attachments__bundle-status { margin-left: .6rem; color: var(--text-quiet); font-size: .72rem; }
.chat-attachments__bundle > summary:focus-visible,
.chat-attachments__details > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.chat-attachments__preview { padding-top: .4rem; }
.chat-attachments__preview .chat-attachments__text { margin: 0; }

/* Task-oriented templates: outcome and Use first, administration on demand. */
.skills-tasks .skill-card__icon { color: var(--accent); background: var(--accent-soft); }
.skills-tasks .skill-card__primary { margin: .8rem 0 .6rem; }
.skills-tasks .skill-card__primary .ui-action { font-size: .82rem; }
.skill-card__details { font-size: .8rem; color: var(--text-quiet); }
.skill-card__details > summary, .skills-editor-details > summary { cursor: pointer; width: fit-content; }
.skill-card__details > summary:focus-visible, .skills-editor-details > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.skill-card__details dl { display: grid; gap: .3rem; }
.skill-card__details dt { font-weight: 600; }
.skill-card__details dd { margin: 0 0 .5rem; overflow-wrap: anywhere; }
.skill-card__details .skill-card__actions { flex-wrap: wrap; }
.skills-editor-title { font-weight: 600; }
.skills-editor-details { margin-top: 1rem; }
.skills-editor-details > summary { margin-bottom: 1rem; }

/* Connections start with the user's task; protocol and account configuration are optional. */
.source-task-picker { display: flex; flex-wrap: wrap; gap: .45rem; margin: .8rem 0 1rem; }
.source-task-picker .button { font-size: .85rem; }
.source-task-picker .button[aria-pressed='true'] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.source-task-picker .button:focus-visible, .source-connection-advanced > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.source-service__try { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin: 0 1rem .85rem; min-width: 0; }
.source-service__try > .button { flex: 0 1 auto; font-size: .8rem; white-space: normal; }
.source-service__try .sources__hint { flex: 1 1 18rem; margin: 0; line-height: 1.5; }

/* Keep connected services scannable even with many accounts. */
.source-services__filters { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.source-services__filters input { flex: 1 1 16rem; min-width: 0; }
.source-services__filters select { flex: 0 1 16rem; min-width: 0; }
.source-services__filters .sources__hint { white-space: nowrap; }
.source-services__no-results { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.source-services--group { gap: .5rem; }
.source-services__list { border: 1px solid var(--line); border-radius: .75rem; overflow: hidden; min-width: 0; }
.source-service--compact { border: 0; border-radius: 0; }
.source-service--compact + .source-service--compact { border-top: 1px solid var(--line); }
.source-service--compact .source-service__head { display: grid; grid-template-columns: 3.5rem minmax(8rem, 1fr) auto auto; gap: .75rem; padding: .65rem .85rem; }
.source-service--compact .source-service__logo { width: 3.5rem; height: 2.25rem; padding: .25rem; box-sizing: border-box; border-radius: .4rem; }
.source-service__toggle { border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; padding: .15rem 0; min-width: 0; }
.source-service__toggle strong { display: block; font-size: .85rem; overflow-wrap: anywhere; }
.source-service__toggle:hover strong { color: var(--accent); }
.source-service__toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: .2rem; }
.source-service__statuses, .source-service__row-actions { display: flex; align-items: center; gap: .4rem; }
.source-service__statuses { flex-wrap: wrap; justify-content: flex-end; }
.source-service--compact .source-service__row-actions .button { flex: 0 0 auto; }
.source-service__body { border-top: 1px solid var(--line); padding: .85rem; display: grid; gap: .75rem; }
.source-service__body > .button { justify-self: start; }
.source-service__body .source-service__settings { border: 1px solid var(--line); border-radius: .5rem; }
.source-service__body .source-service__next { margin: 0; }
@media (max-width: 760px) {
  .source-service--compact .source-service__head { grid-template-columns: 2.5rem minmax(0, 1fr) auto; gap: .4rem .6rem; padding: .6rem; }
  .source-service--compact .source-service__logo { width: 2.5rem; }
  .source-service__row-actions { grid-column: 3; grid-row: 1; }
  .source-service__statuses { grid-column: 2 / -1; grid-row: 2; justify-content: flex-start; }
  .source-services__filters input, .source-services__filters select { flex-basis: 100%; width: 100%; }
}
.mcp-personal-access__date { display: inline-block; font-size: .72rem; }
@media (max-width: 600px) {
  .source-service__try { margin-inline: .85rem; }
  .source-service__head .button--icon { flex: 0 0 auto; }
  .mcp-personal-access .sources__actions .button--icon { flex: 0 0 auto; }
}
.source-badge[data-tone='success'] { background: var(--accent-soft); color: var(--accent); }
.source-connection-advanced { grid-column: 1 / -1; min-width: 0; }
.source-connection-advanced[open] { display: grid; gap: .8rem; }
.source-connection-advanced > summary { cursor: pointer; }
.source-connection-advanced label { display: grid; gap: .3rem; }
.source-connection-advanced input, .source-connection-advanced select { max-width: 100%; box-sizing: border-box; }
.sources__provider .sources__provider-arrow { color: var(--accent); font-weight: 600; margin-top: auto; }

/* Approval previews: readable values, including nested recipients and content. */
.approval-preview { margin: .75rem 0; }
.approval-preview__field { display: grid; grid-template-columns: minmax(7rem, 28%) minmax(0, 1fr); gap: .4rem 1rem; padding: .65rem 0; border-bottom: 1px solid var(--border, #e5e7eb); }
.approval-preview__field dt { font-weight: 600; }
.approval-preview__field dd { margin: 0; min-width: 0; }
.approval-preview__value { white-space: pre-wrap; overflow-wrap: anywhere; }
.approval-preview__list { margin: 0; padding-left: 1.2rem; }
.approval-preview__list li + li { margin-top: .4rem; }
.approval-preview .approval-preview { margin: 0; }
.approval-preview .approval-preview .approval-preview__field { grid-template-columns: 1fr; }
.approval-error { margin: .75rem 0; }
.event-decision select:focus-visible { outline: 2px solid var(--accent, #198f85); outline-offset: 3px; }
@media (max-width: 560px) { .approval-preview__field { grid-template-columns: 1fr; } }
.event-decision select { font: inherit; min-height: 2.75rem; padding: .6rem .75rem; border: 1px solid var(--border, #d9dcdf); border-radius: .6rem; color: inherit; background: var(--surface, #fff); }

.project-entry { width: 100%; text-align: center; margin: .9rem auto 0; }
.project-entry__title { font-weight: 600; margin: 0 0 .65rem; }
.project-entry__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
.project-entry__actions .button { min-height: 2.75rem; }
.project-entry .form__hint { margin: .65rem 0 0; }
@media (max-width: 560px) { .project-entry__actions { flex-direction: column; } .project-entry__actions .button { justify-content: center; } }
.chat-attachments__location { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem .75rem; margin: .35rem 0; }
.chat-attachments__location .form__hint { margin: 0; }

/* Self-service profile editor, shared by local and team accounts. */
.profile-editor { width: min(30rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); overflow: auto; padding: 1.25rem; border: 1px solid var(--line); border-radius: 1rem; color: var(--text); background: var(--surface-raised); box-shadow: 0 16px 60px #0003; }
.profile-editor::backdrop { background: #0005; }
.profile-editor form { display: grid; gap: 1.1rem; }
.profile-editor__header, .profile-editor__footer { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.profile-editor__header h2 { font-size: 1.2rem; margin: 0; }
.profile-editor__photo { display: flex; align-items: center; gap: .75rem; }
.profile-editor__photo > div { display: grid; gap: .35rem; min-width: 0; flex: 1; }
.profile-editor__photo .topbar__avatar { display: grid; width: 4rem; height: 4rem; font-size: 1.5rem; }
.profile-editor__photo input { max-width: 100%; font: inherit; font-size: .8rem; }
.profile-editor__photo small { font-size: .75rem; color: var(--text-quiet); }
.profile-editor__field { display: grid; gap: .4rem; font-size: .85rem; }
.profile-editor__field input { width: 100%; }
.profile-editor__footer { justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 1rem; }

.personal-memory-editor { width: min(48rem, calc(100vw - 2rem)); }
.personal-memory-editor textarea { width: 100%; min-height: 12rem; resize: vertical; font-family: var(--font-mono, monospace); }
.personal-memory-editor .profile-editor__footer { flex-wrap: wrap; }

/* A compact file workspace: actions, selection, then the list and preview. */
.files-browser { gap: .65rem; }
.files-browser__add { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.files-browser__add .files__actions { margin: 0; }
.files-browser .files-upload-zone { flex: 1 1 20rem; padding: .65rem .85rem; margin: 0; gap: .5rem; border-radius: .6rem; }
.files-browser .files-upload-zone > div:first-of-type strong { font-size: .8rem; }
.files-browser .files-upload-zone .form__hint { font-size: .7rem; margin-top: .15rem; }
.files-browser .files-selection { margin: 0; padding: .5rem .65rem; background: var(--surface); border: 1px solid var(--line); border-radius: .6rem; font-size: .78rem; }
.files-browser .files-selection__actions > [role='status'] { margin-right: auto; color: var(--text-quiet); }
.files-browser .files { grid-template-columns: minmax(20rem, 2fr) minmax(0, 3fr); gap: .85rem; }
.files-browser .files[data-preview-open='false'] { grid-template-columns: minmax(0, 1fr); }
.files-browser .files[data-preview-open='false'] > .files__content { display: none; }
.files-browser .files__tree { position: static; max-height: 70dvh; padding: .65rem; }
.files-browser .tree__item > .tree__dir { border-bottom: 1px solid var(--line); min-height: 2.8rem; gap: .15rem; }
.files-browser .tree__row { min-width: 0; }
.files-browser .tree__name { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; display: block; }
.files-browser .file-entry__info { min-width: 0; }
.files-browser .file-entry__meta { font-size: .68rem; }
.files-browser .tree__dir .file-chat-action { flex: 0 0 auto; }
.files-browser .tree__dir .tree__rename { flex: 0 0 auto; }
.files-browser .tree__select { margin: .4rem; }
.files-browser .files-browser__back { display: inline-flex; margin-bottom: .5rem; }
.files-browser .files-browser__maintenance { border-bottom: 0; border-top: 1px solid var(--line); padding-top: .65rem; margin-top: .25rem; }
@media (max-width: 1000px) {
  .files-browser .files { grid-template-columns: minmax(16rem, 1fr) minmax(0, 1fr); }
}
@media (max-width: 768px) {
  .files-browser .files { grid-template-columns: minmax(0, 1fr); }
  .files-browser .files-selection__all { flex: 1 1 100%; }
  .files-browser .files-upload-zone { flex-basis: 100%; }
}

/* File actions share the name row; details never expand the list. */
.files-browser .tree__dir .file-details-action,
.files-browser .tree__dir .file-chat-action { flex: 0 0 auto; width: 1.8rem; min-width: 1.8rem; min-height: 2rem; padding: .3rem; }
.file-entry-details-popover { width: min(24rem, calc(100vw - 2rem)); box-sizing: border-box; max-height: calc(100dvh - 2rem); overflow: auto; margin: auto; padding: 1rem; border: 1px solid var(--line); border-radius: .75rem; background: var(--surface-raised); color: var(--text); box-shadow: var(--shadow-card); overflow-wrap: anywhere; }
.file-entry-details-popover dl { display: grid; gap: .6rem; margin: .8rem 0 0; font-size: .8rem; }
.file-entry-details-popover dt { color: var(--text-quiet); }
.file-entry-details-popover dd { margin: .15rem 0 0; }
