/* AI 員工 (list, detail, 權限管理, the department picker) and 帶入個人 Agent: a
   port of Crew's agents-catalog.css and agent-import.css (Jayce
   platform/control/public/console/css/ at 65d1a430) to mk2's markup in
   app.js staffPage() and biPanel(). Kept as Crew writes it, values included;
   what differs is marked "mk2:". Not verbatim (DESIGN.md "The files"): the
   rules for what mk2 does not draw (skills grid and dialog, disclosures that
   open, 刪除 AI 員工, Mac helper, tools step) are left out.
   The schedule rows and the failed-section line are Crew's main at 2b759c01. */

/* ---- the catalog (agents-catalog.css) ---- */
.ac-page { margin-bottom: var(--crew-space-6); --ac-icon: 18px; }
.ac-title { margin: 0; font-size: var(--crew-type-title, 1.5rem); font-weight: 600; overflow-wrap: anywhere; }
.ac-title:focus { outline: none; }
.ac-note { margin: var(--crew-space-1) 0 0; color: var(--crew-text-secondary); overflow-wrap: anywhere; }
.ac-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--crew-space-3); margin: var(--crew-space-5) 0 var(--crew-space-4); }
.ac-toolbar > .crew-btn { margin: 0; }
/* mk2: no view tabs (mk2 has no per-person 你可使用 / 你建立的), so the search keeps to the right. */
.ac-toolbar > .ac-search:only-child { margin-left: auto; }
/* The views 你可使用 / 你建立的 / 所有 AI 員工 (Crew main agents-catalog.css; F-0601). */
.ac-view-tabs { flex: 1 1 auto; border-bottom: 0; flex-wrap: nowrap; }
.ac-search { --ac-icon: 18px; position: relative; width: 280px; max-width: 100%; }
.ac-search svg { position: absolute; left: var(--crew-space-3); top: 50%; transform: translateY(-50%); color: var(--crew-icon-muted); pointer-events: none; }
.ac-search__input, .ac-search .ac-search__input { width: 100%; margin: 0; padding-left: calc(var(--crew-space-3) + var(--ac-icon) + var(--crew-space-2)); }
.ac-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--crew-space-4); }
.ac-card.crew-employee-card { max-width: none; width: 100%; height: 100%; margin: 0; font: inherit; text-align: left; }
.ac-avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex: none; background: var(--crew-surface-subtle); display: inline-flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: 600; color: var(--crew-text-primary); }
.ac-detail-row span.ac-avatar { background: var(--crew-surface-card); box-shadow: inset 0 0 0 1px var(--crew-border-default); }
.ac-tags { display: flex; flex-wrap: wrap; gap: var(--crew-space-1); }
.ac-empty { max-width: none; margin: var(--crew-space-4) 0; }
.ac-error { padding: var(--crew-space-3) var(--crew-space-4); border-radius: var(--crew-radius-card); background: var(--crew-status-error-surface); color: var(--crew-status-error); }
/* mk2: the call-by-name sentence under the title, and the line under the cards. */
.ac-intro { margin-top: var(--crew-space-2); }
.ac-more { margin-top: var(--crew-space-4); }
.ac-detail-row { display: flex; align-items: center; gap: var(--crew-space-4); margin: var(--crew-space-5) 0 var(--crew-space-4); }
.ac-detail-text { min-width: 0; display: flex; flex-direction: column; gap: var(--crew-space-1); align-items: flex-start; }
.ac-detail-text .ac-note { margin: 0; }
.ac-tabs { margin-bottom: var(--crew-space-5); flex-wrap: nowrap; }
.ac-section-head { margin-bottom: var(--crew-space-3); }
.ac-section-title { display: flex; align-items: baseline; gap: var(--crew-space-2); }
.ac-section-title h2 { margin: 0; font-size: var(--crew-type-section); font-weight: 600; }
.ac-count { color: var(--crew-text-secondary); font-size: var(--crew-type-meta); }
.ac-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--crew-space-1); }
.ac-chips .crew-chip { overflow-wrap: anywhere; }
/* mk2: a tab's sections (職責, 怎麼交辦, 能力 ...), one under the other, at the width of a page card. */
.ac-tabpanel { display: flex; flex-direction: column; gap: var(--crew-space-6); max-width: 680px; }
.ac-tabpanel > .ac-note { margin: 0; }
.ac-panel-section p { margin: 0 0 var(--crew-space-1); }
/* mk2: the console's paragraphs are secondary text by default; the detail's name and content read as Crew's body text. */
.ac-detail-text .ac-title, .ac-panel-section p:not(.ac-note):not(.crew-empty__desc) { color: var(--crew-text-primary); }
.ac-panel-section .crew-btn { margin: var(--crew-space-2) 0 0; }
.ac-panel-section .ac-empty { margin: 0; }
/* 主動工作's schedules: Crew's disclosure rows, which do not open there either (only what they draw). */
.ac-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--crew-space-2); }
.ac-disclosure { border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-menu); background: var(--crew-surface-card); }
.ac-disclosure__head { display: flex; align-items: center; gap: var(--crew-space-3); min-height: calc(var(--crew-control-height-lg) + var(--crew-space-2)); padding: var(--crew-space-3) var(--crew-space-4); }
.ac-disclosure__title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ac-disclosure__head > .crew-status { flex: none; }
/* A failed section, the reference's shape: a grey line and a text button under it. */
.ac-failed { display: flex; flex-direction: column; align-items: flex-start; gap: var(--crew-space-2); margin: var(--crew-space-4) 0; }
.ac-failed .ac-note { margin: 0; }

/* 權限管理 (prototype .a-access / a-options / a-exc). */
.ac-access { display: flex; flex-direction: column; gap: var(--crew-space-4); padding-top: var(--crew-space-2); }
.ac-access-section, .ac-access-stack { display: flex; flex-direction: column; gap: var(--crew-space-4); }
.ac-exc { gap: var(--crew-space-3); }
.ac-access .ac-section-head { display: flex; flex-direction: column; gap: var(--crew-space-1); margin: 0; }
.ac-access .ac-section-title h2 { line-height: var(--crew-leading-ui); color: var(--crew-text-primary); }
.ac-access .ac-count { line-height: var(--crew-leading-ui); }
.ac-access .ac-section-head .ac-note { margin: 0; font-size: var(--crew-type-body); line-height: var(--crew-leading-ui); }
.ac-options { border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-card); background: var(--crew-surface-card); overflow: hidden; }
.ac-option { display: flex; align-items: center; gap: var(--crew-space-3); width: 100%; min-height: 64px; margin: 0; padding: var(--crew-space-2) var(--crew-space-4); box-sizing: border-box; border: 0; border-radius: 0; background: var(--crew-surface-card); color: var(--crew-text-primary); font-family: inherit; font-size: var(--crew-type-body); font-weight: var(--crew-weight-regular); line-height: var(--crew-leading-ui); text-align: left; cursor: pointer; }
.ac-option + .ac-option { border-top: 1px solid var(--crew-border-default); }
.ac-option:hover { background: var(--crew-hover); }
.ac-option:focus-visible { outline: 2px solid var(--crew-focus); outline-offset: -2px; }
.ac-option[aria-disabled="true"] { cursor: not-allowed; color: var(--crew-action-disabled-text); }
.ac-option[aria-disabled="true"]:hover { background: var(--crew-surface-card); }
.ac-option__dot { flex: 0 0 18px; width: 18px; height: 18px; box-sizing: border-box; border: 1px solid var(--crew-border-control); border-radius: 50%; background: var(--crew-surface-card); }
.ac-option[aria-checked="true"] .ac-option__dot { border: 5px solid var(--crew-radio-on); }
.ac-option[aria-disabled="true"] .ac-option__dot { border-color: var(--crew-border-disabled); }
.ac-option__text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ac-option__text strong { font-size: var(--crew-type-body); font-weight: var(--crew-weight-semibold); line-height: var(--crew-leading-ui); overflow-wrap: anywhere; }
.ac-option__text span { color: var(--crew-text-secondary); font-size: var(--crew-type-meta); line-height: var(--crew-leading-ui); overflow-wrap: anywhere; }
.ac-audience-summary { display: flex; flex-direction: column; gap: 10px; padding: 14px var(--crew-space-4) var(--crew-space-4) 46px; border-top: 1px solid var(--crew-border-default); background: var(--crew-neutral-50); }
.ac-audience-summary__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--crew-space-3); }
.ac-audience-summary__row strong { font-size: var(--crew-type-body); font-weight: var(--crew-weight-semibold); line-height: var(--crew-leading-ui); color: var(--crew-text-primary); }
.ac-audience-summary .ac-chips { gap: 6px; }
.ac-audience-summary .crew-chip { gap: 6px; max-width: 100%; min-height: 28px; padding: 0 var(--crew-space-2) 0 10px; box-sizing: border-box; border-radius: var(--crew-radius-pill); background: var(--crew-neutral-100); color: var(--crew-text-primary); font-size: var(--crew-type-meta); line-height: var(--crew-leading-ui); }
.ac-audience-summary .crew-chip svg { flex: none; color: var(--crew-icon-muted); }
.ac-search.ac-exc-search { --ac-icon: 16px; width: 320px; max-width: 100%; }
.ac-exc-search .ac-search__input { display: block; width: 100%; min-height: var(--crew-control-height); margin: 0; padding-right: var(--crew-space-3); box-sizing: border-box; font-size: var(--crew-type-body); line-height: var(--crew-leading-ui); }
.ac-exc-results:empty { display: none; }
.ac-exc-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-card); background: var(--crew-surface-card); overflow: hidden; }
.ac-exc-item + .ac-exc-item { border-top: 1px solid var(--crew-border-default); }
.ac-exc-item { display: flex; align-items: center; gap: var(--crew-space-3); min-height: 52px; padding: var(--crew-space-2) var(--crew-space-4); box-sizing: border-box; }
.ac-exc-avatar { display: inline-grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--crew-avatar-person); color: var(--crew-avatar-person-text); font-size: var(--crew-type-meta); font-weight: 700; line-height: 1; }
.ac-exc-name { flex: none; font-size: var(--crew-type-body); line-height: var(--crew-leading-ui); overflow-wrap: anywhere; }
.ac-exc-path { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; font-size: var(--crew-type-meta); line-height: var(--crew-leading-ui); color: var(--crew-text-secondary); }
.ac-exc-item .crew-btn { flex: none; margin: 0; }
.ac-access .crew-btn--32, .ac-page .crew-btn--32, .ai-page .crew-btn--32 { min-height: var(--crew-control-height-sm); margin: 0; }
.ac-exc-none, .ac-exc-empty { margin: 0; padding: var(--crew-space-4); border-radius: var(--crew-radius-card); background: var(--crew-surface-subtle); font-size: var(--crew-type-body); line-height: var(--crew-leading-ui); color: var(--crew-text-secondary); text-align: center; }

/* The department picker (agents-audience-picker.js, prototype :3605-3662). mk2: in #s-modal, on org.css's .o-dialog. */
.crew-dialog.ac-pk-dialog { width: 560px; max-height: calc(100vh - 2 * var(--crew-space-4)); }
/* Crew draws the picker as its int-dialog (24 padding, 24 radius, a 16/600 title), not as the org form dialog it opens through here. */
.o-dialog.ac-pk-dialog { --crew-dialog-pad: var(--crew-space-6); border-radius: var(--crew-radius-card); }
.o-dialog.ac-pk-dialog .crew-dialog__title { font-size: var(--crew-type-section); font-weight: var(--crew-weight-semibold); }
.ac-pk { display: flex; flex: 1 1 auto; flex-direction: column; gap: var(--crew-space-3); min-height: 0; }
.ac-pk-dialog .crew-dialog__content { min-height: 0; flex: 1 1 auto; overflow: hidden; }
.ac-pk > * { flex: 0 0 auto; }
.ac-pk > .error:empty { display: none; }
.ac-pk-picked { display: flex; flex-direction: column; gap: var(--crew-space-2); padding: var(--crew-space-3) var(--crew-space-4); border-radius: var(--crew-radius-card); background: var(--crew-surface-subtle); }
.ac-pk-picked__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--crew-space-2); min-height: 32px; }
.ac-pk-picked__row .crew-btn { margin: 0; }
.ac-pk-picked .crew-chip { overflow-wrap: anywhere; }
.ac-pk-picked .ac-chips { max-height: calc(3 * var(--crew-space-8)); overflow-y: auto; }
.ac-pk-chip-x { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; min-height: 0; margin: 0 -4px 0 0; padding: 0; border: 0; border-radius: var(--crew-radius-small); background: transparent; color: var(--crew-icon-muted); cursor: pointer; }
.ac-pk-chip-x:hover { color: var(--crew-text-primary); background: transparent; }
.ac-pk-chip-x:focus-visible { outline: 2px solid var(--crew-focus); outline-offset: 1px; }
.ac-pk-search { width: 100%; }
.ac-pk > .ac-pk-area { flex: 1 1 360px; }
.ac-pk-area { height: 360px; min-height: calc(3 * var(--crew-space-12)); overflow-y: auto; padding: var(--crew-space-2) 0; border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-card); background: var(--crew-surface-card); }
.ac-pk-tree, .ac-pk-tree ul, .ac-pk-results { list-style: none; margin: 0; padding: 0; }
.ac-pk-row { padding-left: calc(var(--crew-space-3) + var(--ac-pk-depth, 0) * var(--crew-tree-indent)); }
.ac-pk-results > li { padding: 0 var(--crew-space-3); }
.ac-pk-none { margin: 0; padding: var(--crew-space-3) var(--crew-space-4); }
.ac-pk-check { flex: 1 1 auto; display: flex; align-items: center; gap: var(--crew-space-2); min-width: 0; min-height: var(--crew-control-height); margin: 0; padding: 0 var(--crew-space-1); border: 0; border-radius: var(--crew-radius-menu); background: transparent; color: var(--crew-text-primary); font: inherit; font-weight: var(--crew-weight-regular); text-align: left; cursor: pointer; }
.ac-pk-check:hover { background: var(--crew-hover); }
.ac-pk-check:focus-visible { outline: 2px solid var(--crew-focus); outline-offset: 2px; }
.ac-pk-check > svg { flex: 0 0 auto; color: var(--crew-icon-muted); }
.ac-pk-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.ac-pk-name { overflow-wrap: anywhere; }
.ac-pk-path { color: var(--crew-text-secondary); font-size: var(--crew-type-meta); overflow-wrap: anywhere; }
.ac-pk-box { position: relative; flex: 0 0 20px; width: 20px; height: 20px; box-sizing: border-box; border: 1.5px solid var(--crew-border-control); border-radius: var(--crew-radius-small); background: var(--crew-surface-card); }
.ac-pk-box[data-state="true"], .ac-pk-box[data-state="mixed"] { background: var(--crew-checkbox-on); border-color: var(--crew-checkbox-on); }
.ac-pk-box[data-state="true"]::after, .ac-pk-box[data-state="mixed"]::after {
  content: ""; position: absolute; inset: 0; background: var(--crew-action-primary-text);
  -webkit-mask: var(--_mark) center / 14px no-repeat; mask: var(--_mark) center / 14px no-repeat;
  --_mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8.5l3.5 3.5L13 4.5'/%3E%3C/svg%3E");
}
.ac-pk-box[data-state="mixed"]::after {
  --_mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M3.5 8h9'/%3E%3C/svg%3E");
}
/* mk2: the tree's twist button is a plain button (components.css gives every button a box). */
.ac-pk-row .crew-tree-row__toggle { min-height: 0; margin: 0; padding: 0; border: 0; background: transparent; }

/* ---- 帶入個人 Agent (agent-import.css) ---- */
.ai-page { display: flex; flex-direction: column; gap: var(--crew-space-5); max-width: 960px; min-width: 0; }
.ai-page > * { margin: 0; min-width: 0; }
.ai-stepper { row-gap: var(--crew-space-2); }
.ai-meta { margin: 0; font-size: var(--crew-type-meta); color: var(--crew-text-secondary); }
.ai-path { overflow-wrap: anywhere; word-break: break-word; }
.ai-notice { width: 100%; }
.ai-notice__body { display: flex; flex-direction: column; gap: var(--crew-space-1); min-width: 0; }
.ai-notice__body p { margin: 0; overflow-wrap: anywhere; }
.ai-sources { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--crew-space-3); }
@media (max-width: 900px) { .ai-sources { grid-template-columns: minmax(0, 1fr); } }
.ai-source { margin: 0; text-align: left; font: inherit; }
.ai-panel { max-width: 640px; }
.ai-card { gap: var(--crew-space-3); }
.ai-progress { width: 100%; height: 8px; accent-color: var(--crew-action-primary); }
.ai-preview { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--crew-space-4); align-items: start; }
@media (max-width: 1100px) { .ai-preview { grid-template-columns: minmax(0, 1fr); } }
.ai-tree__rows { display: flex; flex-direction: column; margin: 0 calc(var(--crew-space-3) * -1); }
.ai-findings { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: var(--crew-space-1); font-variant-numeric: tabular-nums; }
.ai-form { max-width: 640px; gap: var(--crew-space-5); }
@media (max-width: 700px) {
  .ai-page { gap: var(--crew-space-4); }
  .crew-action-bar { flex-wrap: wrap; }
  .crew-result-card { align-items: flex-start; }
}
.ai-page label { margin: 0; font-size: inherit; }
.ai-page .crew-form-field__label { font-size: var(--crew-type-body); }
.ai-page .crew-checkbox input { width: 20px; height: 20px; min-height: 0; padding: 0; border-radius: var(--crew-radius-small); }
.ai-page .crew-field { font-size: var(--crew-type-body); margin: 0; }
.ai-card p, .ai-form p { margin: 0; }
.ai-page h2[tabindex="-1"]:focus { outline: none; }
.ai-stepper--small { display: none; }
@media (max-width: 700px) {
  .ai-stepper--wide { display: none; }
  .ai-stepper--small { display: flex; column-gap: var(--crew-space-4); row-gap: var(--crew-space-2); }
}
.ai-title { margin: 0; }
.ai-lead { margin: calc(var(--crew-space-3) * -1) 0 0; color: var(--crew-text-secondary); }
.ai-pre { margin: 0; white-space: pre-wrap; font: inherit; max-height: 320px; overflow: auto; }
.ai-drop { display: flex; flex-direction: column; align-items: center; gap: var(--crew-space-2); margin-top: var(--crew-space-2); padding: var(--crew-space-8) var(--crew-space-5); border: 1.5px dashed var(--crew-border-control); border-radius: var(--crew-radius-icon-cell); background: var(--crew-surface-subtle); text-align: center; }
.ai-drop__icon { color: var(--crew-icon-default); line-height: 0; }
.ai-drop__title { font-size: var(--crew-type-section); overflow-wrap: anywhere; }
.ai-drop__or { font-size: var(--crew-type-meta); color: var(--crew-text-secondary); }
@media (max-width: 700px) { .ai-drop { padding: var(--crew-space-5) var(--crew-space-4); } }
/* The helper actions appear only for a supported release (mk2: download only, no launch link). */
.ai-helper__actions { display: flex; flex-wrap: wrap; gap: var(--crew-space-3); }
/* mk2: the helper's words and download sit under the drop zone, filled when mac-helper.json is read. */
.ai-helper { display: flex; flex-direction: column; gap: var(--crew-space-2); }
.ai-helper:empty { display: none; }
.ai-helper .crew-form-field__hint { margin: 0; }
@media (max-width: 700px) { .ai-helper .crew-btn { min-height: var(--crew-control-height-lg); } }
/* mk2: the picker inside the drop zone is the browser's own file input (mk2 reads it on 讀取並預覽). */
.ai-drop input[type="file"], .ai-panel input[type="file"] { width: auto; max-width: 100%; min-height: 0; padding: var(--crew-space-1) 0; border: 0; background: transparent; }
.ai-upload { display: flex; flex-direction: column; gap: var(--crew-space-4); }
.ai-upload > .error:empty, .ai-form .error:empty, .ai-tree .error:empty { display: none; }
/* mk2: the preview's lists (items, dropped files, tools), the recent imports, the two texts. */
.bi-list { list-style: none; margin: 0; padding: 0; }
.bi-recent li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--crew-space-2); min-height: var(--crew-control-height-sm); }
.bi-recent .crew-btn { margin: 0; }
.bi-toolmap li { padding: var(--crew-space-1) 0; overflow-wrap: anywhere; }
.bi-recent-row { justify-content: space-between; padding: var(--crew-space-1) 0; border-top: 1px solid var(--crew-border-default); }
.bi-recent-row:first-child { border-top: 0; }
.bi-recent-acts { display: inline-flex; align-items: center; gap: var(--crew-space-1); }
.bi-details summary { cursor: pointer; font-weight: var(--crew-weight-semibold); padding: var(--crew-space-1) 0; }
.bi-details[open] summary { margin-bottom: var(--crew-space-2); }
/* A row's own files, under it at the category's depth. Crew's tree has no fourth level, so the file
   rows give up their own indent and spacers: a path needs the width. */
.bi-sub { padding-left: calc(var(--crew-space-3) + var(--crew-tree-indent)); }
.bi-sub .crew-tree-row--item { padding-left: 0; }
.bi-sub .crew-tree-row__toggle, .bi-sub .crew-tree-row__included { display: none; }
.bi-details .hint { margin: 0 0 var(--crew-space-2); }
.bi-text { padding: var(--crew-space-3); border-radius: var(--crew-radius-menu); background: var(--crew-surface-subtle); font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: var(--crew-type-meta); }
.ai-tree .crew-tree-row__main { cursor: default; }
.ai-tree .crew-checkbox { min-height: 0; margin: 0; }
.ai-tree form { display: flex; flex-direction: column; gap: var(--crew-space-3); }
.ai-tree form .crew-btn { margin: 0; }
.crew-action-bar .crew-btn { margin: 0; }

@media (max-width: 1100px) { .ac-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) {
  /* Full screen on a phone (Crew .ac-pk-full): the desktop height cap above must not leave the page showing under it. */
  .crew-dialog.ac-pk-dialog { width: 100%; max-height: none; border-radius: 0; }
  .ac-pk-dialog .ac-pk-area { flex: 1 1 auto; height: auto; min-height: 0; }
  .ac-pk-dialog .ac-pk-check { min-height: 48px; }
  .ac-grid { grid-template-columns: 1fr; }
  .ac-tabs { scrollbar-width: none; overflow-x: auto; overflow-y: hidden; border-bottom: 0; box-shadow: inset 0 -1px 0 var(--crew-border-default); }
  .ac-tabs::-webkit-scrollbar, .ac-view-tabs::-webkit-scrollbar { display: none; }
  .ac-view-tabs { scrollbar-width: none; }
  .ac-tabs .crew-tab { margin-bottom: 0; flex: none; }
  /* More tabs past an edge: that edge fades out (the row's flag is set where it can scroll). */
  .ac-tabs.has-more-right { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 3em), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 3em), transparent); }
  .ac-tabs.has-more-left { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 3em), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 3em), transparent); }
  .ac-tabs.has-more-left.has-more-right { -webkit-mask-image: linear-gradient(to right, transparent, #000 3em, #000 calc(100% - 3em), transparent); mask-image: linear-gradient(to right, transparent, #000 3em, #000 calc(100% - 3em), transparent); }
  .ac-disclosure__head { padding: var(--crew-space-3); }
  .ac-search { width: 100%; }
  .ac-toolbar > .crew-btn { width: 100%; }
  .ac-view-tabs { overflow-x: auto; overflow-y: hidden; }
  .ac-view-tabs .crew-tab { margin-bottom: 0; flex: none; }
  .ac-detail-row { flex-direction: column; align-items: flex-start; }
  .ac-audience-summary { padding-left: var(--crew-space-4); }
  .ac-search.ac-exc-search { width: 100%; }
  .ac-exc-item { flex-wrap: wrap; }
  .ac-access .crew-btn--32 { position: relative; }
  .ac-access .crew-btn--32::after { content: ""; position: absolute; inset: -6px; }
}

/* mk2: 指令's 工作指示, read-only (F-0602): the text as written, line breaks kept. */
.ac-instructions__text { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--crew-text-primary); }
/* The text sits in a bordered box capped at about 20 lines (the whole text stays inside it); 展開全部 lifts the cap. */
.ac-instructions__box { border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-card); padding: var(--crew-space-3) var(--crew-space-4); max-height: 30em; overflow: hidden; line-height: 1.5; }
.ac-instructions__box { position: relative; background: var(--crew-surface-card); }
.ac-instructions__box.is-open { max-height: none; }
/* Cut off: a fade at the foot says there is more (the class is set where the text overflows). */
.ac-instructions__box.is-clipped:not(.is-open)::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3em; background: linear-gradient(to bottom, transparent, var(--crew-surface-card)); pointer-events: none; }
.ac-panel-section .ac-instructions__toggle { display: inline-flex; margin-top: var(--crew-space-3); }
.ac-kept { margin: 0; padding: var(--crew-space-3) var(--crew-space-4); border-top: 1px solid var(--crew-border-default); }

/* mk2: 記憶's company memories, read-only (F-0603): one row each, the text as written. */
.ac-memory-list { list-style: none; margin: 0; padding: 0; }
.ac-memory { padding: var(--crew-space-3) 0; border-bottom: 1px solid var(--crew-border-default); }
.ac-memory__text { white-space: pre-wrap; overflow-wrap: anywhere; }

/* 連接工具 (F-0707; Crew agent-import.css, JAYCE-30 7): Integration rows in groups; the action wraps under the text on a phone. */
.ai-subtitle { margin: var(--crew-space-2) 0 0; font-size: var(--crew-type-body); font-weight: 600; }
.ai-tool-group { display: flex; flex-direction: column; gap: var(--crew-space-2); }
.ai-tools { margin: 0 calc(var(--crew-space-4) * -1); padding: 0; list-style: none; display: flex; flex-direction: column; }
.ai-tool { flex-wrap: wrap; }
.ai-tool .crew-integration-row__text { flex: 1 1 0; }
.ai-tool__select { flex: 0 0 20px; width: 20px; height: 20px; padding: 0; }
.ai-tool__choice { display: grid; place-items: center; min-width: 44px; min-height: 44px; cursor: pointer; }
.ai-tool .crew-integration-row__name, .ai-tool .crew-integration-row__desc { overflow-wrap: anywhere; }
.ai-tool__status { display: inline-flex; align-items: center; gap: var(--crew-space-1); font-size: var(--crew-type-meta); color: var(--crew-text-secondary); }
@media (max-width: 700px) { .ai-tool__select { width: 24px; height: 24px; } }

/* 大頭照: Crew's agent-import picker (agent-import.css:63-66). */
.ai-avatars { display: flex; flex-wrap: wrap; gap: var(--crew-space-2); }
.ai-avatar { display: inline-flex; padding: 2px; border: 2px solid transparent; border-radius: 50%; cursor: pointer; margin-top: 0; /* mk2: app.css gives every label a top margin */ }
.ai-avatar:has(input:checked) { border-color: var(--crew-brand-500); }
.ai-avatar:has(input:focus-visible) { outline: 2px solid var(--crew-focus); outline-offset: 2px; }
