/* Crew console, on Crew's design system (DESIGN.md). Every page that links
   this file (the console, and the server-rendered vault, live browser and
   sign-in result pages) gets Crew's four stylesheets first, copied verbatim
   from the Jayce repo into crew/ (do not edit them here; DESIGN.md says how to
   refresh them). What follows is mk2's own: the font while Crew's web font is
   undecided, the LINE WORKS and LINE mark colours, and the layout of mk2's
   pages, coloured and sized only with Crew's tokens. */
@import url("crew/crew-tokens.css");
@import url("crew/crew-components.css");
@import url("crew/tokens.css");
@import url("crew/components.css");

/* System fonts, no web font, until Crew settles Google Fonts (Crew's stacks without Pontano Sans). */
:root { --crew-font: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', 'Microsoft JhengHei', 'Helvetica Neue', Arial, sans-serif; }
:root:lang(ja) { --crew-font: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Noto Sans JP', 'Yu Gothic', 'Meiryo', sans-serif; }
:root:lang(en) { --crew-font: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, 'Noto Sans TC', sans-serif; }
/* The LINE WORKS and LINE marks (no Crew token: they are the platforms' own colours). */
:root { --lw: #00C73C; --ln: #06C755; }
body { font-size: var(--crew-type-body); }
small { color: var(--crew-text-secondary); }
time, .n, td { font-variant-numeric: tabular-nums; }
a { color: var(--crew-link); }
a:hover { color: var(--crew-link-hover); }
code { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; }
h1 { text-wrap: balance; }
h2:focus, [tabindex="-1"]:focus { outline: none; }
p { margin: 0 0 10px; }
select { width: 100%; }

/* ---- the column: entry, link and onboarding pages ---- */
/* Crew's standalone header (standalone.css .sa-header, .sa-brand): the mark in the middle, the language and the
   account at the right; under 700px the mark moves to the left. */
.topbar { position: relative; display: flex; align-items: center; justify-content: center; gap: var(--crew-space-3); min-height: 36px; padding: var(--crew-space-8) max(var(--crew-space-6), env(safe-area-inset-right, 0px)) var(--crew-space-6) max(var(--crew-space-6), env(safe-area-inset-left, 0px)); font-size: var(--crew-type-meta); color: var(--crew-text-secondary); overflow-wrap: anywhere; }
.topbar .brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; border-radius: var(--crew-radius-pill); }
.topbar .brand .s-logo { width: 36px; height: 36px; border: 1px solid var(--crew-border-default); border-radius: 50%; background: var(--crew-neutral-0); color: var(--crew-brand-700); font-size: 18px; }
.topbar .brand .s-brand-name { display: block; }
.topbar #topbar-right { position: absolute; top: var(--crew-space-8); right: max(var(--crew-space-6), env(safe-area-inset-right, 0px)); min-height: 36px; align-items: center; gap: var(--crew-space-3); margin: 0; }
.topbar .link { padding: 4px 0; min-height: 0; }
.stage-platform .topbar { display: none; }
main { max-width: 480px; margin: 8px auto 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); min-height: 440px; }
/* The onboarding stepper is Crew's Step (crew-components.css .crew-stepper); only its place on the page is here. */
.progress { margin: 0 0 var(--crew-space-8); }
#s-currency-card { scroll-margin-top: calc(var(--crew-control-height) + var(--crew-space-6)); } /* 前往設定 lands here: clear of the phone top bar */
.card > :first-child { margin-top: 0; }
.card h2 { font-size: var(--crew-type-section); font-weight: var(--crew-weight-semibold); line-height: var(--crew-leading-ui); margin: 0 0 6px; }
.logo { width: 32px; height: 32px; object-fit: contain; vertical-align: middle; margin-right: 10px; border-radius: var(--crew-radius-menu); }
.channel { display: flex; align-items: center; font-size: var(--crew-type-section); font-weight: var(--crew-weight-semibold); margin-bottom: 16px; }
label:first-child { margin-top: 0; }
.card > .primary:first-child, .card > a.primary:first-child { margin-top: 0; }
/* A link drawn as the primary button keeps the button's text colour over Crew's .s-content link colour. */
a.primary, .s-content a.primary, a.primary:hover, .s-content a.primary:hover { color: var(--crew-action-primary-text); text-decoration: none; }
/* A disabled text button (重新寄送驗證碼 while it counts down) stays text, without the disabled button fill. */
.link:disabled { background: none; border: 0; color: var(--crew-text-secondary); text-decoration: none; }
.card > a.primary { display: flex; align-items: center; justify-content: center; min-height: var(--crew-control-height); padding: 6px 18px; border-radius: var(--crew-radius-control); text-decoration: none; }
.secondary { width: 100%; margin-top: 10px; }
.row.between { justify-content: space-between; }
.hint { color: var(--crew-text-secondary); }
.divider { border-top: 1px solid var(--crew-border-default); margin-top: 20px; padding-top: 14px; }
main > p, .card > p { overflow-wrap: anywhere; }
main > p .link, .card > .hint .link, .line-bind .hint .link { margin-left: 6px; }
.external-link { display: block; text-decoration: none; text-align: center; line-height: 1.5; }

/* third-party sign-in (lwapp/login.ts, linelogin.ts) */
.or-divider { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; text-align: center; color: var(--crew-text-secondary); margin: 16px 0 12px; font-size: var(--crew-type-meta); }
.or-divider::before, .or-divider::after { content: ""; height: 1px; background: var(--crew-border-default); }
a.lw-login { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: var(--crew-control-height); padding: 6px 18px; border: 1px solid var(--crew-border-control); border-radius: var(--crew-radius-control); background: var(--crew-surface-card); color: var(--crew-text-primary); font-weight: var(--crew-weight-semibold); text-decoration: none; transition: background-color var(--crew-motion-quick) ease; }
a.lw-login:hover { background: var(--crew-hover); color: var(--crew-text-primary); }
a.lw-login + a.lw-login { margin-top: 10px; }
/* Crew's a.lineworks-button (onboard.css): the platform's own 20px logo, not a lettered badge. */
a.lw-login::before { content: ""; flex: none; width: 20px; height: 20px; background: url(img/lineworks.png) center / contain no-repeat; }
a.line-login::before { background-image: url(img/line.png); }
.lw-result { max-width: 440px; margin: 64px auto; padding: 0 16px; }

/* the mailed code: one box per digit, drawn as Crew's six code cells (onboard.css .code-cells, .code-cell) */
.code-label { display: block; font-size: var(--crew-type-label); font-weight: var(--crew-weight-semibold); margin: 0 0 8px; }
.lw-code-boxes { display: grid; grid-template-columns: repeat(4, minmax(0, 56px)); gap: 10px; margin: 12px 0; }
.lw-code-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.lw-methods { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.code-boxes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.code-box, .lw-code-box { min-width: 0; height: 56px; padding: 0; text-align: center; font-size: 24px; font-weight: var(--crew-weight-semibold); line-height: 1.3; font-variant-numeric: tabular-nums; border-color: var(--crew-border-control); }
.code-box:focus, .code-box:focus-visible, .lw-code-box:focus, .lw-code-box:focus-visible { border-color: var(--crew-focus); box-shadow: 0 0 0 1px var(--crew-focus); outline: none; }
.code-box[aria-invalid="true"], .lw-code-box[aria-invalid="true"] { border-color: var(--crew-status-error); box-shadow: none; }
.code-box[aria-invalid="true"]:focus { box-shadow: 0 0 0 1px var(--crew-status-error); }
.code-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--crew-space-1) var(--crew-space-4); color: var(--crew-text-secondary); }
.code-meta .link, .resend-line .link { margin: 0; color: var(--crew-text-primary); }
.resend-line { text-align: center; color: var(--crew-text-secondary); text-wrap: balance; }
.resend-line .link:disabled { color: var(--crew-text-secondary); }

/* platforms (connect): Crew's option cards (onboard.css .platforms, .platform), one per platform; selected is the
   card's own 2px brand border; one not open yet is grey with a muted tag and takes no click. */
/* Two by two: Crew's three across leave no room for a tag next to the mark once Teams is a fourth card (en-US, ja-JP). */
.platforms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--crew-space-3); margin: var(--crew-space-8) 0 0; }
.platform { position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 10px; min-height: 132px; margin: 0; padding: 17px; text-align: left; border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-control); background: var(--crew-surface-card); color: var(--crew-text-primary); font-weight: var(--crew-weight-regular); }
.platform:not([aria-disabled="true"]):hover { background: var(--crew-surface-card); border-color: var(--crew-brand-200); }
.platform.selected, .platform.selected:hover { border: 2px solid var(--crew-brand-500); padding: 16px; }
.platform-logo { width: 30px; height: 30px; object-fit: contain; flex: none; }
.platform strong { font-size: var(--crew-type-label); font-weight: var(--crew-weight-semibold); line-height: var(--crew-leading-ui); color: var(--crew-text-primary); }
.platform-blurb { font-size: var(--crew-type-meta); line-height: var(--crew-leading-ui); color: var(--crew-text-secondary); }
.platform[aria-disabled="true"], .platform:disabled, .platform:disabled:hover { cursor: default; background: var(--crew-neutral-50); border-color: var(--crew-border-default); color: var(--crew-text-secondary); }
.platform[aria-disabled="true"] strong { color: var(--crew-text-secondary); }
.platform .development-badge { position: absolute; top: 17px; right: 17px; font-size: var(--crew-type-meta); font-weight: var(--crew-weight-semibold); line-height: var(--crew-leading-ui); background: var(--crew-status-muted-surface); color: var(--crew-status-muted); border-radius: var(--crew-radius-tag); padding: 2px 8px; white-space: nowrap; }
.platform-hint { margin-top: var(--crew-space-4); text-align: center; }
.identity { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 14px; background: var(--crew-surface-card); border: 1px solid var(--crew-border-default); margin: 0 0 16px; border-radius: var(--crew-radius-control); }
.identity strong { font-size: var(--crew-type-body); display: block; }
.identity span { font-size: var(--crew-type-meta); color: var(--crew-text-secondary); }
.identity .identity-state { color: var(--crew-status-warning); font-weight: var(--crew-weight-semibold); text-align: right; }
.identity.joined .identity-state { color: var(--crew-status-success); }

/* 設定中 and 開通完成: a list of steps with a state word each */
.todo { list-style: none; margin: 18px 0 0; padding: 6px 22px; }
.todo li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--crew-border-default); }
.todo li:first-child { border-top: 0; }
.todo-text { min-width: 0; }
.todo-text strong { display: block; font-size: var(--crew-type-body); font-weight: var(--crew-weight-semibold); }
.todo-text small { display: block; font-size: var(--crew-type-meta); color: var(--crew-text-secondary); overflow-wrap: anywhere; }
.state { font-size: var(--crew-type-meta); font-weight: var(--crew-weight-semibold); color: var(--crew-text-secondary); white-space: nowrap; }
.state.done { color: var(--crew-status-success); }
.state.now { color: var(--crew-text-primary); display: inline-flex; align-items: center; gap: 6px; }
.state.now::before, .first-wait::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--crew-neutral-300); border-top-color: var(--crew-action-primary); flex: none; }
@media (prefers-reduced-motion: no-preference) { .state.now::before, .first-wait::before { animation: spin 1s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } } }
.next-steps .secondary { width: auto; margin: 0; min-height: var(--crew-control-height-sm); padding: 0 12px; font-size: var(--crew-type-body); flex: none; }
.first-wait { margin: 12px 0 0; display: flex; align-items: center; gap: 8px; }
.channel-text { display: block; min-width: 0; }
.channel-text strong { display: block; }
.channel-text span { display: block; font-size: var(--crew-type-meta); font-weight: var(--crew-weight-regular); color: var(--crew-text-secondary); }
.admin-note { white-space: pre-line; overflow-wrap: anywhere; }
main > p .primary { width: 100%; margin-top: 0; }

/* ---- the column pages laid out as Crew's (app.js columnClass) ----
   #app.col-wizard: the onboarding wizard (onboard.css .wizard-main): a 608 column on the wizard's page background,
   the stepper, the title, then cards. #app.col-card: one white card holding the whole page (Crew's sign-in card and
   standalone pages, standalone.css .login-main); a .card inside it is a section of it, not a second card.
   #app.col-solo: the email and code steps, in the middle of the screen (onboard.css .solo-card). */
body:not(.stage-platform) { min-height: 100dvh; background: var(--crew-surface-page); }
body:has(> #app.col-wizard), body:has(> #app.col-solo) { background: var(--crew-glow-horizon-entry), var(--crew-bg-page); }
#app.col { min-height: 0; }
#app.col h1 { font-size: var(--crew-type-title); font-weight: var(--crew-weight-semibold); line-height: var(--crew-leading-title); margin: 0 0 var(--crew-space-2); }
#app.col h1 + p { color: var(--crew-text-secondary); margin: 0 0 var(--crew-space-4); }
/* A result page's actions right under its title (the removed screen) keep their own space. */
#app.col h1 + p.mo-result-acts { margin-top: var(--crew-space-6); }
#app.col h2 { font-size: var(--crew-type-card-title); font-weight: 650; line-height: var(--crew-leading-title); margin: 0 0 var(--crew-space-2); }
#app.col .notice { margin: 0 0 var(--crew-space-4); }
/* Crew's onboarding controls are the large ones (48: --crew-control-height-onboarding). */
#app.col-solo input:not(.code-box), #app.col-wizard input, #app.col-wizard select, #app.col-solo .primary, #app.col-wizard .primary, #app.col-solo a.lw-login { min-height: var(--crew-control-height-onboarding); }

#app.col-wizard { max-width: none; width: min(608px, calc(100% - 2 * var(--crew-page-margin-mobile))); margin: 0 auto; padding: var(--crew-space-6) 0 64px; }
#app.col-wizard > .card { margin: var(--crew-space-6) 0 0; padding: var(--crew-space-8); border-radius: var(--crew-radius-card); }
#app.col-wizard > h1 + p + .card, #app.col-wizard > .title-row + .card { margin-top: var(--crew-space-4); }
#app.col-wizard > .card > .primary:last-child:not(:first-child), #app.col-wizard .connect-form > .primary { margin-top: var(--crew-space-6); }
#app.col-wizard > p:last-child { margin-top: var(--crew-space-5); text-align: center; }
#app.col-wizard > p:last-child .primary { width: 100%; }
#app.col-wizard .hint.platform-hint { margin-top: var(--crew-space-4); }
.title-row { display: flex; align-items: center; gap: var(--crew-space-3); }
.title-row .title-avatar { width: 60px; height: 60px; flex: none; border-radius: var(--crew-radius-pill); border: 1px solid var(--crew-border-default); object-fit: cover; background: var(--crew-surface-card); }
.title-row .title-text { min-width: 0; }
.title-row h1 { text-wrap: balance; }
#app.col .title-row h1 + p { margin: 0; }
#app.col-wizard .platforms + .card { margin-top: var(--crew-space-6); }
/* The connect form: its platform at the top (Crew's .channel), then the fields. */
#app.col .connect-form .channel { gap: var(--crew-space-3); margin: 0 0 var(--crew-space-3); line-height: var(--crew-leading-ui); }
#app.col .connect-form .channel .logo { width: 36px; height: 36px; margin: 0; }
#app.col .connect-form > p:not(.hint):not(.notice) { color: var(--crew-text-secondary); }
#app.col .connect-form .form-foot { margin: var(--crew-space-4) 0 0; text-align: center; }
#app.col .connect-form .form-foot .link { margin: 0; }
/* 請 LINE WORKS 管理員幫忙: the note as Crew's invite text (onboard.css .invite-text). */
#app.col .admin-note { margin: 0; padding: var(--crew-space-4); border: 1px solid var(--crew-border-control); border-radius: var(--crew-radius-control); background: var(--crew-surface-card); color: var(--crew-text-primary); line-height: var(--crew-leading-body); }
/* 正在設定: Crew's progress rows (onboard.css .progress-row): a mark, the step, its state in words. */
.progress-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.progress-row { display: flex; align-items: center; gap: var(--crew-space-3); min-height: 48px; padding: var(--crew-space-1) 0; color: var(--crew-text-secondary); }
.progress-row .row-icon { flex: none; width: 20px; height: 20px; border-radius: var(--crew-radius-pill); border: 1px solid var(--crew-border-control); display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; }
.progress-row .row-icon svg { width: 12px; height: 12px; }
.progress-row .row-name { flex: 1; min-width: 0; }
.progress-row .row-name strong { display: block; font-weight: var(--crew-weight-regular); }
.progress-row .row-name small { display: block; font-size: var(--crew-type-meta); overflow-wrap: anywhere; }
.progress-row .row-state { font-size: var(--crew-type-meta); white-space: nowrap; }
.progress-row.is-done .row-icon { background: var(--crew-status-success); border-color: var(--crew-status-success); color: var(--crew-text-inverse); }
.progress-row.is-done .row-name strong, .progress-row.is-active .row-name strong { color: var(--crew-text-primary); }
.progress-row.is-active .row-name strong { font-weight: var(--crew-weight-semibold); }
.progress-row.is-active .row-icon { border: 2px solid var(--crew-neutral-300); border-top-color: var(--crew-action-primary); }
@media (prefers-reduced-motion: no-preference) { .progress-row.is-active .row-icon { animation: spin 1s linear infinite; } }
/* 開通完成: Crew's arrival (onboard.css .arrival-page, .avatar-badge): the avatar with a check, the title under it. */
.arrival { text-align: center; }
.arrival-avatar { position: relative; display: block; width: 120px; height: 120px; margin: 0 auto var(--crew-space-4); }
.arrival-avatar img { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: var(--crew-surface-card); border: 1px solid var(--crew-border-default); }
.arrival-badge { position: absolute; right: 0; bottom: 4px; width: 34px; height: 34px; box-sizing: border-box; border-radius: 50%; background: var(--crew-status-success); border: 3px solid var(--crew-surface-card); }
.arrival-badge::after { content: ""; position: absolute; left: 10px; top: 5px; width: 7px; height: 13px; border: solid var(--crew-text-inverse); border-width: 0 3px 3px 0; transform: rotate(45deg); }
#app.col .try-this { margin: var(--crew-space-4) 0; }

/* One card (standalone.css .login-main): the page is the card. */
#app.col-card { max-width: none; width: min(480px, calc(100% - 2 * var(--crew-space-4))); margin: 0 auto var(--crew-space-12); padding: var(--crew-space-8); background: var(--crew-surface-card); border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-card); }
#app.col-card:has(.claim-list) { width: min(640px, calc(100% - 2 * var(--crew-space-4))); }
#app.col-card > :last-child { margin-bottom: 0; }
#app.col-card > .card { padding: 0; margin: var(--crew-space-6) 0 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
#app.col-card > h1 + .card, #app.col-card > h1 + p + .card, #app.col-card > p + .card { margin-top: var(--crew-space-4); }
/* The main action is as wide as its label; full width on a phone and on the email and code steps (Crew's solo card). */
#app.col-card .primary { width: auto; min-width: 120px; }
#app.col-card > .card > a.primary { display: inline-flex; padding: 6px 18px; }
#app.col-solo .primary, #app.col-solo > .card > a.primary { width: 100%; }
/* A way out under the card's action (Crew's .login-actions): links in a row. */
#app.col-card > p:not(.resend-line):has(> .link:only-child), #app.col-card > p:has(> .link + .link) { display: flex; flex-wrap: wrap; gap: var(--crew-space-4) var(--crew-space-6); align-items: center; margin: var(--crew-space-4) 0 0; }
#app.col-card > p > .link { margin: 0; }
.login-actions { display: flex; flex-wrap: wrap; gap: var(--crew-space-4) var(--crew-space-6); align-items: center; margin-top: var(--crew-space-4); }
.login-actions .primary { margin: 0; }
#app.col-card .or-divider { margin: var(--crew-space-6) 0 var(--crew-space-4); }
#app.col-solo { margin-top: max(0px, calc((100dvh - 640px) / 2)); }
#app.col-solo .code-meta { margin: 0 0 var(--crew-space-4); }
#app.col-solo .code-meta + .card { margin-top: 0; }
#app.col-solo .resend-line { margin: var(--crew-space-5) 0 0; }
/* 尚無工作空間: the companies that listed this email, one card each (Crew's .claim-list). */
.claimable { margin-top: var(--crew-space-6); }
.claim-list { list-style: none; margin: var(--crew-space-3) 0 var(--crew-space-4); padding: 0; display: grid; gap: var(--crew-space-3); }
.claim-entry { padding: var(--crew-space-5) var(--crew-space-6); border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-control); background: var(--crew-surface-card); }
.claim-entry h2 { font-size: var(--crew-type-section); margin: 0 0 var(--crew-space-1); }
.claim-entry p { margin: 0; color: var(--crew-text-secondary); }
.claim-entry .notice { margin: var(--crew-space-3) 0 0; }

@media (max-width: 900px) {
  .topbar { justify-content: space-between; }
  .topbar #topbar-right { position: static; }
}
@media (max-width: 700px) {
  .topbar { padding: var(--crew-space-6) var(--crew-space-4) var(--crew-space-4); }
  #app.col-wizard { padding-top: var(--crew-space-2); }
  #app.col-wizard > .card { padding: var(--crew-space-6); }
  #app.col-card { padding: var(--crew-space-6); margin-bottom: var(--crew-space-8); }
  #app.col-card .primary, #app.col-card > .card > a.primary { width: 100%; }
  .login-actions .primary { width: 100%; }
  .claim-entry { padding: var(--crew-space-4); }
}
@media (max-width: 480px) {
  .platforms { grid-template-columns: 1fr; }
  .platform { min-height: 0; }
  /* Crew drops the connectors on a phone (onboard.css), so a wrapped bar has no line dangling at its end. */
  .crew-stepper.progress { gap: var(--crew-space-2) var(--crew-space-4); }
  .crew-stepper.progress .crew-step-connector { display: none; }
}

/* the inline confirmation box (index.html): under the page, or over an open dialog */
.confirm-box { max-width: 480px; margin: 20px auto; padding: 20px 24px; }
.confirm-box .row button:first-child { background: var(--crew-action-primary); border-color: var(--crew-action-primary); color: var(--crew-action-primary-text); }
.confirm-box .row button:first-child:hover { background: var(--crew-action-hover); border-color: var(--crew-action-hover); }
.confirm-box.danger .row button:first-child { background: var(--crew-action-danger); border-color: var(--crew-action-danger); color: var(--crew-action-danger-text); }
.confirm-box.danger .row button:first-child:hover { background: var(--crew-action-danger-hover); border-color: var(--crew-action-danger-hover); }
.s-modal-open .confirm-box { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); z-index: calc(var(--crew-z-dialog) + 1); width: min(480px, calc(100vw - 40px)); margin: 0; }

/* bind commands (工作平台), the join message, LINE QR */
.join-message { margin: 0 0 12px; }
.join-message code { display: block; font-size: 20px; font-weight: 700; letter-spacing: 1px; padding: 12px 14px; background: var(--crew-surface-card); border: 1px dashed var(--crew-border-control); border-radius: var(--crew-radius-menu); user-select: all; -webkit-user-select: all; word-break: break-all; }
.join-steps { margin: 14px 0 8px; padding-left: 20px; line-height: var(--crew-leading-body); font-size: var(--crew-type-body); color: var(--crew-text-secondary); }
.join-status { margin: 8px 0 0; font-weight: var(--crew-weight-semibold); color: var(--crew-accent-text); }
.line-bind { display: flex; gap: 18px; align-items: center; margin-top: 8px; }
.line-qr { flex: 0 0 148px; width: 148px; height: 148px; background: #fff; border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-icon-cell); padding: 6px; }
.line-qr svg { width: 100%; height: 100%; display: block; }
.line-bind a.line-open { display: inline-block; padding: 9px 16px; border-radius: var(--crew-radius-control); background: var(--ln); color: #fff; text-decoration: none; font-weight: var(--crew-weight-semibold); }
@media (max-width: 560px) { .line-bind { flex-direction: column; align-items: flex-start; } .line-qr { display: none; } }
.copy-fallback { margin: 8px 0 0; }
.copy-fallback-hint { font-size: var(--crew-type-meta); color: var(--crew-text-secondary); }

/* Google Chat setup */
.gchat-steps { padding-left: 20px; font-size: var(--crew-type-body); line-height: var(--crew-leading-body); }
.gchat-steps li { margin: 0 0 14px; }
/* Step 2's "what the script does": a plain sub-list, not more steps. */
.gchat-steps .gchat-script-does { margin: var(--crew-space-2) 0 0; padding-left: 18px; line-height: var(--crew-leading-ui); }
.gchat-steps .gchat-script-does li { margin: 0 0 2px; }
.gchat-steps > li > strong { display: block; }
.gchat-steps > li > p { margin: 4px 0 0; }
.gchat-steps textarea { font-family: ui-monospace, monospace; font-size: 13px; margin: 6px 0 8px; }
.gchat-copy, .gchat-values dd, .m-dept-field { display: flex; align-items: center; gap: 8px; margin: 6px 0 8px; }
.gchat-copy code, .gchat-values dd code { flex: 0 1 auto; min-width: 0; }
.gchat-copy .link, .gchat-values .link, .m-dept-field button { flex: none; }
.gchat-copy code, .gchat-values code { font-size: var(--crew-type-meta); padding: 4px 8px; background: var(--crew-surface-subtle); border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-tag); overflow-wrap: anywhere; }
.gchat-values { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: var(--crew-type-body); margin: 8px 0 16px; }
.gchat-values dt { color: var(--crew-text-secondary); padding-top: 6px; }
.gchat-values dd { margin: 0; }
@media (max-width: 560px) { .gchat-values { grid-template-columns: 1fr; } .gchat-values dt { padding-top: 10px; } }

/* ---- the management shell: Crew's (components.css .s-*; app.js drawShell). mk2's entries, breadcrumb
   steps and brand are buttons (mk2 moves between pages without changing the URL), drawn as Crew draws its links. */
.s-brand-link, .crew-crumbs .crew-crumb-link { min-height: 0; padding: 0; border: 0; background: none; font: inherit; font-weight: inherit; color: inherit; }
.s-brand-link:hover, .crew-crumbs .crew-crumb-link:hover { background: none; }
.crew-crumbs .crew-crumb-link { padding: 0 2px; color: var(--crew-text-secondary); }
.crew-crumbs .crew-crumb-link:hover { color: var(--crew-text-primary); text-decoration: underline; text-underline-offset: 3px; }
/* Every page opens with the breadcrumb (Crew: .s-content > .crew-crumbs); mk2's lead line sits under it as Crew's .s-page-lead. */
.s-content .crew-crumbs { margin: 0 0 var(--crew-space-5); }
.s-content .crew-crumbs + .sr-only + p { margin-top: calc(var(--crew-space-5) * -1 + var(--crew-space-2)); }
/* The sidebar is sticky and one viewport high, so on a long page its white column ended there (a full-page capture, an
   overscroll). The shell paints the column itself, behind the sidebar, the whole page down; it follows the rail. */
@media (min-width: 701px) {
  .s-shell { position: relative; }
  .s-shell::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 232px; background: var(--crew-surface-nav); transition: width var(--crew-motion-standard) var(--crew-motion-ease); }
  .s-shell:has(> .s-sidebar[data-collapsed="true"])::before { width: 68px; }
}
/* 403 and 404 in the shell (app.js refusedPage): Crew's in-shell not-found box (agents-catalog.css .ac-empty), the page's width. */
.s-refused { max-width: none; margin: var(--crew-space-4) 0; }
/* The title is an h2 (Crew's notFoundBox); .s-content h2 would give it a section heading's size and margin, not the Empty state's. */
.s-content .s-refused .crew-empty__title { margin: 0; font-size: inherit; }
.s-search-label { color: var(--crew-text-secondary); margin-top: 20px; }
.s-filters { display: inline-flex; gap: 2px; padding: 2px; background: var(--crew-segmented-track); box-shadow: inset 0 0 0 1px var(--crew-border-default); border-radius: var(--crew-radius-control); margin: 14px 0 20px; }
.s-filters button { font-size: var(--crew-type-body); font-weight: var(--crew-weight-regular); border: 0; background: none; min-height: 36px; padding: 0 14px; border-radius: var(--crew-radius-control-inner); color: var(--crew-text-secondary); }
.s-filters button:hover { background: none; color: var(--crew-text-primary); }
.s-filters .active, .s-filters .active:hover { color: var(--crew-text-primary); background: var(--crew-segmented-thumb); font-weight: var(--crew-weight-semibold); box-shadow: 0 1px 2px var(--crew-shadow-2); }
.d-more { margin: 10px 0 0; text-align: center; }
.cu-starter-note { margin: 10px 0 0; }
.s-dialog h3 { font-size: var(--crew-type-section); margin: 20px 0 4px; }
.s-dialog select { display: block; width: 100%; }
/* 應用程式, as Crew's 應用程式整合 (Jayce integrations.css, the page glue over the crew-* classes): the search, the
   filter chips, the app grid, and the connect, manage and 誰可以用 windows (.int-dialog). mk2 addition: the
   danger colour of 中斷連接 (a text button). */
.int-search { display: block; margin: 0 0 var(--crew-space-4); font-weight: var(--crew-weight-regular); }
.int-search .crew-field { width: 100%; padding: 0 var(--_px, 12px); }
/* The native clear button of a search field is blue and not on a token: draw it with the text colour. */
.int-search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; margin: 0; cursor: pointer; background-color: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M4 4l8 8M12 4l-8 8'/%3E%3C/svg%3E") center/16px no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M4 4l8 8M12 4l-8 8'/%3E%3C/svg%3E") center/16px no-repeat; }
.int-filters { margin: 0 0 var(--crew-space-6); }
/* The filter chips are 32 tall; the base `button` min-height (40) is older than the design system. */
.int-filters .crew-filter-chip { min-height: var(--crew-control-height-sm); padding-top: 0; padding-bottom: 0; }
.int-page .crew-app-grid { margin-top: var(--crew-space-4); }
.int-page .crew-app-card { min-height: 82px; font-weight: var(--crew-weight-regular); }
.int-empty { margin: var(--crew-space-6) auto 0; }
.int-more { text-align: center; margin: var(--crew-space-6) 0; }
.int-more .crew-btn { min-width: 96px; }
/* A new search is on its way: keep the old cards, dimmed. */
.int-grid-busy { opacity: .5; pointer-events: none; transition: opacity .15s; }
.int-note { font-size: var(--crew-type-meta); line-height: var(--crew-leading-body); color: var(--crew-text-secondary); }
.int-lead { color: var(--crew-text-primary); line-height: var(--crew-leading-body); }
.int-subhead { margin: 0 0 var(--crew-space-2); padding: 0; font-size: var(--crew-type-label); font-weight: 600; line-height: var(--crew-leading-ui); }

/* Dialogs: the connect and manage windows are crew-dialog--form. */
.int-modal .crew-btn--32 { min-height: var(--crew-control-height-sm); padding-top: 0; padding-bottom: 0; }
.int-modal .crew-btn--40 { min-height: var(--crew-control-height); padding-top: 0; padding-bottom: 0; }
.int-modal .crew-btn--icon-only { min-height: var(--crew-control-height-sm); padding: 0; }
.int-modal .crew-btn { margin: 0; }
.int-dialog { display: flex; flex-direction: column; width: 520px; max-height: calc(100dvh - var(--crew-space-8)); overflow: hidden; box-sizing: border-box; }
.int-dialog.int-dialog--wide { width: 640px; max-width: calc(100vw - var(--crew-space-8)); }
.int-dialog > .crew-dialog__header, .int-dialog > .crew-dialog__actions { flex: none; }
.int-dialog > .crew-dialog__content { flex: 1 1 auto; min-height: 0; overflow: auto; padding: var(--crew-space-1); margin: calc(var(--crew-space-1) * -1); gap: var(--crew-space-4); }
.int-dialog > .crew-dialog__content > * { flex-shrink: 0; }
.int-dialog .crew-dialog__content p { margin: 0; }
.int-dialog .crew-dialog__content .error:empty { display: none; }
.int-dialog .crew-form-field__label { margin: 0; }
.int-dialog .crew-dialog__title:focus { outline: none; }
.int-dialog .crew-dialog__title { overflow-wrap: anywhere; }
.int-dialog .crew-dialog__title-icon { border-radius: var(--crew-radius-icon-cell); }
/* The authorization control: the main action of the connect window. */
.int-auth { max-width: 100%; white-space: normal; text-align: center; overflow-wrap: anywhere; }
a.int-auth { align-self: flex-start; height: auto; min-height: var(--crew-control-height); padding-top: 8px; padding-bottom: 8px; }

/* The accounts of one app, as the manage window lists them. */
.int-accounts { display: flex; flex-direction: column; gap: var(--crew-space-6); min-width: 0; }
.int-accounts > section { display: flex; flex-direction: column; gap: var(--crew-space-3); min-width: 0; }
.int-accounts > section > .int-subhead { margin: 0; }
.int-accounts__note { display: flex; flex-direction: column; gap: var(--crew-space-2); }
.int-accounts__note:empty { display: none; }
.int-account { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "head actions" "meta meta" "scope scope"; gap: var(--crew-space-2) var(--crew-space-3); align-items: center; margin: 0; padding: var(--crew-space-3) var(--crew-space-4); border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-card); min-width: 0; font-size: var(--crew-type-body); }
.int-account:not(:has(> .int-account__meta)) { grid-template-areas: "head actions" "scope scope"; }
.int-account__head { grid-area: head; display: flex; align-items: center; gap: var(--crew-space-2); flex-wrap: wrap; min-width: 0; }
.int-account__head strong { font-weight: 600; overflow-wrap: anywhere; }
.int-account__head .crew-status { font-weight: 400; }
.int-account__title:focus { outline: none; }
.int-account__actions { grid-area: actions; display: flex; gap: var(--crew-space-2); }
.int-account__meta { grid-area: meta; display: flex; flex-direction: column; gap: var(--crew-space-1); min-width: 0; font-size: var(--crew-type-meta); color: var(--crew-text-secondary); overflow-wrap: anywhere; }
.int-account__meta > p { margin: 0; }
.int-account__scope { grid-area: scope; display: flex; align-items: center; gap: var(--crew-space-3); color: var(--crew-text-secondary); min-width: 0; }
.int-account__scope > span:first-child { flex: none; font-size: var(--crew-type-meta); }
.int-account__scope > span:last-child { min-width: 0; color: var(--crew-text-primary); overflow-wrap: anywhere; }
.int-scope-trigger { width: 280px; max-width: 100%; justify-content: flex-start; gap: var(--crew-space-2); font-weight: var(--crew-weight-regular); color: var(--crew-text-primary); }
.int-scope-trigger__text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }

/* 誰可以用: a plain radio row with a divider; the dot is the only sign of the chosen one. */
.int-levels { display: flex; flex-direction: column; margin: 0; padding: 0; border: 0; min-width: 0; }
.int-levels > legend { padding: 0; margin: 0 0 var(--crew-space-2); }
.int-level-group { border-bottom: 1px solid var(--crew-border-default); }
.int-level { align-items: flex-start; box-sizing: border-box; width: 100%; margin: 0; padding: var(--crew-space-4) var(--crew-space-3); font-weight: var(--crew-weight-regular); }
.int-level__extra { display: flex; flex-direction: column; gap: var(--crew-space-3); padding: 0 var(--crew-space-3) var(--crew-space-4) calc(var(--crew-space-3) + 20px + var(--crew-space-2)); }
.int-level__extra[hidden] { display: none; }
.int-level-group:has(.int-level__extra:not([hidden])) .int-level { padding-bottom: var(--crew-space-3); }
.int-level input, .int-dept input { flex: none; box-sizing: border-box; width: 20px; height: 20px; min-width: 20px; min-height: 0; padding: 0; margin: 0; }
.int-level__text { display: flex; flex: 1 1 auto; flex-direction: column; gap: var(--crew-space-1); min-width: 0; }
.int-level__name { font-weight: var(--crew-weight-regular); overflow-wrap: anywhere; }
.int-level__desc { font-size: var(--crew-type-meta); font-weight: var(--crew-weight-regular); color: var(--crew-text-secondary); }
.int-level__note { margin-left: auto; flex: none; font-size: var(--crew-type-meta); font-weight: var(--crew-weight-regular); color: var(--crew-text-secondary); }
.s-connect-scope { margin: 0; }
.int-dept-list { padding: var(--crew-space-2); border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-control); }
.int-dept { box-sizing: border-box; display: flex; align-items: center; width: 100%; margin: 0; padding: var(--crew-space-1) var(--crew-space-2) var(--crew-space-1) calc(10px + var(--depth, 0) * var(--crew-space-6)); font-weight: var(--crew-weight-regular); }
.int-dept .crew-checkbox { flex: none; min-height: 0; }
.st-check input { width: 20px; min-height: 0; padding: 0; }

@media (max-width: 700px) {
  .int-modal:has(.int-dialog) { padding: 0; align-items: stretch; }
  .int-dialog, .int-dialog.int-dialog--wide { width: 100%; max-width: none; height: 100dvh; max-height: none; border-radius: 0; }
  .int-modal .crew-btn--32, .int-modal .crew-btn--40, .int-modal .crew-btn--icon-only { position: relative; }
  .int-modal .crew-btn--32::after { content: ""; position: absolute; inset: -7px -5px; }
  .int-modal .crew-btn--40::after { content: ""; position: absolute; inset: -3px; }
  .int-modal .crew-btn--icon-only::after { content: ""; position: absolute; inset: -7px; }
  .int-level, .int-dept { min-height: 44px; }
  .int-account { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "meta" "scope" "actions"; row-gap: var(--crew-space-4); }
  .int-account:not(:has(> .int-account__meta)) { grid-template-areas: "head" "scope" "actions"; }
  .int-account__actions { justify-content: flex-start; }
  .int-account__scope { flex-direction: column; align-items: stretch; gap: var(--crew-space-1); }
  .int-scope-trigger { width: 100%; }
  /* Touch targets are 44 while the chips look 32: an invisible hit area. 16px text so a phone does not zoom on focus. */
  .int-filters .crew-filter-chip { position: relative; }
  .int-filters .crew-filter-chip::after { content: ""; position: absolute; inset: -7px -5px; }
  .int-search .crew-field { font-size: 16px; }
}
@media (max-width: 480px) {
  .int-modal .crew-dialog__actions { flex-direction: column-reverse; }
  .int-modal .crew-dialog__actions .crew-btn { width: 100%; }
}
/* 設定, as Crew's (Jayce settings.css): cards at the control radius, label-left/value-right rows, an editable field
   with its save button under it, and a read-only value with a lock line (.s-locked). Scoped to .s-settings. */
.s-settings .card [hidden] { display: none !important; }
.s-settings .card h2 { margin-bottom: var(--crew-space-4); }
.s-settings .card > .crew-form-field + *, .s-settings .s-edit > .crew-form-field + * { margin-top: var(--crew-space-4); }
.s-settings .s-select { max-width: 240px; }
.s-settings .crew-select select { width: 100%; }
.s-settings .crew-form-field__hint { line-height: var(--crew-leading-body); }
.s-settings .crew-form-field .crew-form-field__label { margin: 0; }
.s-settings #s-website { font-size: 16px; padding: 0 14px; }
.s-settings .s-edit > .crew-btn--primary { width: auto; min-width: 120px; margin-top: var(--crew-space-4); font-weight: 650; }
.s-settings .s-edit > .error:empty { display: none; }
.s-settings .s-edit > .error:not(:empty) { margin: var(--crew-space-3) 0 0; }
.s-settings .s-saved:empty { display: none; }
.s-settings .s-saved:not(:empty) { margin: var(--crew-space-4) 0 0; }
.s-settings .s-read > .s-setting-row:first-child { margin-top: 0; }
.s-settings .s-read > .s-setting-row:last-child, .s-settings .s-read > .s-setting-row:has(+ .s-locked) { margin-bottom: var(--crew-space-4); }
.s-locked { display: flex; align-items: center; gap: var(--crew-space-2); margin: 0; font-size: var(--crew-type-body); line-height: var(--crew-leading-body); color: var(--crew-text-secondary); }
.s-locked svg { flex-shrink: 0; }
.s-settings .card > .success, .s-settings .card > .error { margin: var(--crew-space-3) 0 0; }
.s-settings .card > .s-setting-row:first-of-type { margin-top: 0; }
.s-settings .card > .s-setting-row:last-child { margin-bottom: 0; }
.s-settings .card > .s-setting-row + .crew-form-field__hint { margin: calc(var(--crew-space-2) * -1) 0 0; }
.s-settings .card > .row { margin-top: var(--crew-space-4); }
.s-settings .card > .row .crew-btn { width: auto; margin: 0; }
.s-settings .s-card-lead { margin: 0 0 var(--crew-space-4); }
.s-platform-name { display: inline-flex; align-items: center; gap: 8px; }
.s-platform-logo { width: 20px; height: 20px; object-fit: contain; }
.s-pending { color: var(--crew-link); font-size: var(--crew-type-meta); flex-shrink: 0; }
.s-disconnected { color: var(--crew-text-secondary); font-size: var(--crew-type-meta); flex-shrink: 0; }
.s-setting-row .s-pending, .s-setting-row .s-disconnected { font-weight: 500; }
.s-login > span > small { display: block; margin-top: 2px; font-size: var(--crew-type-meta); }
.s-login { margin: var(--crew-space-3) 0; padding-top: var(--crew-space-3); border-top: 1px solid var(--crew-border-default); }
.s-login .crew-btn { width: auto; margin: 0; flex: none; }
@media (max-width: 700px) {
  .s-settings .s-select { max-width: none; }
  .s-settings .s-edit > .crew-btn--primary { min-height: 44px; }
  .s-locked { align-items: flex-start; }
  .s-locked svg { margin-top: 3px; }
  .s-login { flex-direction: row; align-items: center; }
}
.s-dialog .row { margin-top: 20px; }
.s-dialog .row .primary { margin-top: 0; width: auto; flex: 1; }
.s-content-wide { max-width: none; }

/* ---- 工作總覽 ---- */
/* 工作平台: a Crew card per platform, its head an Integration row (a 40px logo cell, name, line, Status pill); Teams greyed. */
.s-content .card.p-card { padding: var(--crew-space-6); }
.p-head { display: flex; align-items: center; gap: var(--crew-space-3); }
.p-logo { display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; border-radius: var(--crew-radius-icon-cell); background: var(--crew-neutral-100); }
.p-logo .logo { width: 28px; height: 28px; margin: 0; }
.p-text { flex: 1; min-width: 0; }
.s-content .p-text h2 { margin: 0; font-size: var(--crew-type-section); }
.p-text p { margin: 2px 0 0; font-size: var(--crew-type-meta); color: var(--crew-text-secondary); overflow-wrap: anywhere; }
.p-head > .crew-status, .p-head > .crew-tag { flex: none; }
.p-body { margin-top: var(--crew-space-4); padding-top: var(--crew-space-4); border-top: 1px solid var(--crew-border-default); }
.p-body > .s-setting-row:first-child { margin-top: 0; }
.p-body > .s-setting-row:last-child { margin-bottom: 0; }
.p-body > p:last-child { margin-bottom: 0; }
.p-state { display: inline-flex; align-items: center; gap: var(--crew-space-2); }
.p-link { margin: var(--crew-space-3) 0 0; }
.p-soon { background: var(--crew-neutral-50); cursor: default; }
.p-soon h2, .p-soon .p-text p { color: var(--crew-text-secondary); }
/* 即將推出 as Crew onboarding's development badge (status-muted). */
.p-soon .crew-tag { background: var(--crew-status-muted-surface); color: var(--crew-status-muted); }
.p-mark { color: var(--crew-icon-muted); font-size: var(--crew-type-section); font-weight: var(--crew-weight-semibold); background: var(--crew-neutral-200); }
@media (max-width: 700px) {
  /* 設定's 工作平台 card: the platform and each agent keep name and state on one line on a phone (a long name wraps itself) */
  .s-setting-row.s-platform-row, .s-setting-row.s-agent-row { flex-direction: row; align-items: center; }
  .s-content .card.p-card { padding: var(--crew-space-4); }
  .p-head { flex-wrap: wrap; }
  .p-head > .crew-status, .p-head > .crew-tag { margin-left: calc(40px + var(--crew-space-3)); }
  .p-body .s-setting-row { flex-direction: row; align-items: center; }
}
.d-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 20px 0 16px; background: var(--crew-surface-card); border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-control); overflow: hidden; }
.d-stat { padding: 16px 20px; min-width: 0; border-left: 1px solid var(--crew-border-default); }
.d-stat:first-child { border-left: 0; }
.d-stat > span { color: var(--crew-text-secondary); font-size: var(--crew-type-meta); }
.d-stat strong { display: block; font-size: var(--crew-type-title); font-weight: var(--crew-weight-semibold); line-height: var(--crew-leading-title); margin-top: 4px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.d-stat small { display: block; font-size: var(--crew-type-meta); color: var(--crew-text-secondary); margin: 2px 0 0; }
.d-panel { background: var(--crew-surface-card); border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-control); padding: 20px 24px; margin-bottom: 16px; min-width: 0; }
.d-chip { font-size: var(--crew-type-meta); padding: 2px 8px; border-radius: var(--crew-radius-tag); background: var(--crew-surface-subtle); color: var(--crew-text-secondary); }
.d-muted { color: var(--crew-text-secondary); }
/* A state word as Crew's Status pill (text only here; the word carries the meaning). */
.d-badge { display: inline-flex; align-items: center; white-space: nowrap; padding: 2px 10px; border: 1px solid var(--crew-status-muted-surface); border-radius: var(--crew-radius-pill); background: var(--crew-status-muted-surface); color: var(--crew-status-muted); font-size: var(--crew-type-meta); font-weight: var(--crew-weight-regular); line-height: var(--crew-leading-ui); }
.d-badge.green { background: var(--crew-status-success-surface); border-color: var(--crew-status-success-border); color: var(--crew-status-success); }
.d-badge.red { background: var(--crew-status-error-surface); border-color: var(--crew-status-error-border); color: var(--crew-status-error); }
.d-badge.amber { background: var(--crew-status-warning-surface); border-color: var(--crew-status-warning-border); color: var(--crew-status-warning); }
.d-badge.blue { background: var(--crew-status-info-surface); border-color: var(--crew-status-info-border); color: var(--crew-status-info); }
.d-sub { font-size: var(--crew-type-body); font-weight: var(--crew-weight-semibold); margin: 22px 0 0; }
/* Tables in Crew's Table look: a subtle 40px header, 1px row lines. */
.d-table-wrap { overflow-x: auto; }
.d-table { width: 100%; border-collapse: collapse; font-size: var(--crew-type-body); line-height: var(--crew-leading-ui); }
.d-table th { height: 40px; padding: 0 12px; background: var(--crew-surface-subtle); color: var(--crew-text-secondary); font-size: var(--crew-type-meta); font-weight: var(--crew-weight-semibold); text-align: left; white-space: nowrap; }
.d-table td { padding: 12px; border-bottom: 1px solid var(--crew-border-default); overflow-wrap: anywhere; }
.d-table tr:last-child td { border-bottom: 0; }
.d-table .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.d-empty strong { display: block; color: var(--crew-text-primary); font-weight: var(--crew-weight-semibold); }
.d-empty p { margin: 6px 0 0; max-width: 36em; }
.d-employee { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.d-employee h2 { margin: 0 !important; }
.d-employee span { font-size: var(--crew-type-meta); color: var(--crew-text-secondary); }
.d-avatar { width: 40px; height: 40px; flex-shrink: 0; border-radius: var(--crew-radius-icon-cell); background: var(--crew-brand-700); color: var(--crew-neutral-0); display: grid; place-items: center; font-size: var(--crew-type-card-title); font-weight: var(--crew-weight-semibold); }
.d-panel .s-setting-row { margin: 0; padding: 11px 0; border-bottom: 1px solid var(--crew-border-default); }
.d-panel .s-setting-row:last-child { border-bottom: 0; }
.d-panel .s-setting-row .link { min-height: 0; padding: 2px 0; }
.d-open { display: inline-block; margin-top: 12px; }
@media (max-width: 1100px) { .d-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .d-stat:nth-child(3) { border-left: 0; } .d-stat:nth-child(n+3) { border-top: 1px solid var(--crew-border-default); } .d-columns { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) { .d-stat { padding: 12px 14px; } .d-stat strong { font-size: var(--crew-type-card-title); } .d-panel { padding: 16px; } .d-panel .s-setting-row { flex-direction: row; align-items: center; } }
/* mk2's own pages (總覽, 看板, 網站, 工作平台, 外部 Agent) in Crew's components (app.js crewPill, crewEmpty, loadFailed,
   copyField, cellName). Crew has no design for these pages; DESIGN.md "mk2's own pages". */
.s-content .mo-empty { max-width: none; }
/* On the page (not in a panel) the Empty state sits on the page colour, so it takes the card's. */
.s-content > .mo-empty { border: 1px solid var(--crew-border-default); background: var(--crew-surface-card); }
/* Result pages (the column): Crew's 48px icon cell above the title, in the outcome's status colours. */
.mo-result-icon { display: grid; place-items: center; width: 48px; height: 48px; margin: var(--crew-space-2) 0 var(--crew-space-4); border-radius: 50%; background: var(--crew-status-info-surface); color: var(--crew-status-info); }
.mo-result-icon--success { background: var(--crew-status-success-surface); color: var(--crew-status-success); }
.mo-result-icon--warning { background: var(--crew-status-warning-surface); color: var(--crew-status-warning); }
.mo-result-acts { margin-top: var(--crew-space-6); }
/* connect-return.html is Crew's standalone card (crew/standalone.css); the column's main height does not apply. */
main.login-main { min-height: 0; }
/* components.css gives every button a 40px min-height; Crew's 32px controls set only their height. */
.crew-btn--32, .crew-btn--icon-text, .crew-filter-chip { min-height: 0; }
.mo-failed { margin: 0; }
.mo-retry { margin: var(--crew-space-3) 0 0; }
.mo-loading { margin: 0; }
.mo-copy { display: flex; align-items: center; gap: var(--crew-space-2); flex-wrap: wrap; margin: var(--crew-space-2) 0 var(--crew-space-3); }
.mo-copy code { min-width: 0; max-width: 100%; padding: 6px var(--crew-space-3); border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-menu); background: var(--crew-surface-subtle); font-size: var(--crew-type-body); color: var(--crew-text-primary); overflow-wrap: anywhere; user-select: all; }
/* Crew's Table; under 700px each row is a Table summary card (Crew org.css .o-invite-table), its cells named by .mo-cell-name. */
.mo-table-wrap { overflow-x: auto; }
.mo-table th { white-space: nowrap; }
.mo-table td { height: auto; min-height: 56px; padding-top: var(--crew-space-3); padding-bottom: var(--crew-space-3); }
.mo-table tbody tr:last-child { border-bottom: 0; }
.mo-table .n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mo-table .mo-main { width: 100%; min-width: 200px; }
.mo-when { white-space: nowrap; color: var(--crew-text-secondary); font-variant-numeric: tabular-nums; }
.mo-when strong { display: block; color: var(--crew-text-primary); font-weight: var(--crew-weight-semibold); }
.mo-when small { display: block; }
.mo-req { margin: 0; color: var(--crew-text-primary); overflow-wrap: anywhere; }
.mo-tags { display: flex; flex-wrap: wrap; align-items: center; gap: var(--crew-space-1); margin-top: var(--crew-space-1); font-weight: var(--crew-weight-regular); }
.mo-where { margin-right: var(--crew-space-1); font-size: var(--crew-type-meta); color: var(--crew-text-secondary); white-space: nowrap; }
/* 排程: the zone of a schedule that is not Asia/Taipei's, under its next run (as the repeat is under the time). */
.mo-zone { display: block; font-size: var(--crew-type-meta); color: var(--crew-text-secondary); white-space: nowrap; }
.mo-cell-name { display: none; }
@media (max-width: 700px) {
  .mo-table, .mo-table tbody { display: block; }
  .mo-table thead { display: none; }
  .mo-table tbody { display: flex; flex-direction: column; gap: var(--crew-space-3); }
  .mo-table tbody tr, .mo-table tbody tr:last-child { display: flex; flex-direction: column; gap: var(--crew-space-2); padding: var(--crew-space-4); border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-card); background: var(--crew-surface-card); }
  .mo-table tbody tr:hover { background: var(--crew-surface-card); }
  .mo-table td, .mo-table .n { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: var(--crew-space-3); height: auto; min-height: 0; padding: 0; text-align: left; white-space: normal; }
  .mo-table td.mo-main { display: block; order: -2; min-width: 0; font-size: var(--crew-type-section); font-weight: var(--crew-weight-semibold); }
  .mo-table td.mo-state { display: flex; order: -1; }
  .mo-cell-name { display: block; color: var(--crew-text-secondary); font-weight: var(--crew-weight-regular); }
}
/* 總覽: the state (Crew Integration row: a 40px icon cell, the sentence, the action), Crew Cards for the numbers,
   Crew Tabs over the lists, the company's setup at the side. */
.s-content .card.mo-status { max-width: none; margin-top: 0; display: flex; align-items: center; gap: var(--crew-space-4); padding: var(--crew-space-5) var(--crew-space-6); }
.mo-status--warn { border-color: var(--crew-status-warning-border); }
.mo-status-icon { flex: 0 0 40px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--crew-radius-icon-cell); background: var(--crew-status-success-surface); color: var(--crew-status-success); }
.mo-status--warn .mo-status-icon { background: var(--crew-status-warning-surface); color: var(--crew-status-warning); }
.mo-status-text { flex: 1; min-width: 0; }
.mo-status-text strong { display: block; font-size: var(--crew-type-card-title); font-weight: var(--crew-weight-semibold); line-height: var(--crew-leading-title); }
.mo-status-text p { margin: var(--crew-space-1) 0 0; color: var(--crew-text-secondary); overflow-wrap: anywhere; }
.mo-status-text code { padding: 1px 6px; border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-tag); background: var(--crew-surface-subtle); color: var(--crew-text-primary); font-weight: var(--crew-weight-semibold); }
.mo-status-act { flex: none; }
.mo-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--crew-space-4); margin: var(--crew-space-4) 0; }
.mo-stat.crew-card { min-width: 0; gap: var(--crew-space-1); padding: var(--crew-space-5); border-radius: var(--crew-radius-control); box-shadow: none; }
.mo-stat .crew-card__value { font-size: var(--crew-type-title); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.mo-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 300px); gap: var(--crew-space-4); align-items: start; }
.s-content .card.mo-panel, .s-content .card.mo-side { max-width: none; margin-top: 0; min-width: 0; }
.s-content .card.mo-panel { padding: var(--crew-space-2) var(--crew-space-6) var(--crew-space-6); }
.mo-tabpanel { padding-top: var(--crew-space-4); }
.mo-more { margin: var(--crew-space-4) 0 0; text-align: center; }
.mo-rows .s-setting-row, .mo-side .s-setting-row { margin: 0; padding: var(--crew-space-3) 0; border-bottom: 1px solid var(--crew-border-default); }
.mo-side .s-setting-row:last-child { border-bottom: 0; padding-bottom: 0; }
.mo-rows .s-setting-row:first-child { padding-top: 0; }
.mo-side .link { min-height: 0; padding: 2px 0; }
.mo-sub { margin: var(--crew-space-6) 0 var(--crew-space-3); }
@media (max-width: 1100px) { .mo-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .mo-columns { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) {
  .s-content .card.mo-status { flex-wrap: wrap; padding: var(--crew-space-4); }
  .mo-status-act { flex: 1 1 100%; }
  .mo-status-act .crew-btn { width: 100%; }
  .mo-stats { gap: var(--crew-space-3); }
  .mo-stat.crew-card { padding: var(--crew-space-4); }
  .s-content .card.mo-panel { padding: 0; border: 0; background: none; }
  .mo-side .s-setting-row { flex-direction: row; align-items: center; }
}

/* ---- 成員 ---- */
.m-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.m-head-acts { flex: 0 1 auto; margin-top: 2px; gap: 8px; }
.m-head-acts button { min-height: var(--crew-control-height-sm); padding: 0 12px; }

/* ---- 看板: boards as Crew Template cards; a board's lists are columns on the page, its cards white on them;
   顯示已封存 is Crew's Filter chip, states are Crew Status pills, counts and sources Crew Tags ---- */
.k-head { align-items: flex-start; }
.k-head-acts { display: flex; align-items: center; gap: var(--crew-space-2); flex-wrap: wrap; margin-top: 2px; }
.k-banner { margin: 0 0 var(--crew-space-4); }
.k-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--crew-space-4); }
.k-tiles-first { margin-top: var(--crew-space-4); max-width: 300px; }
.k-tile-wrap { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-control); background: var(--crew-surface-card); transition: border-color var(--crew-motion-quick) ease, box-shadow var(--crew-motion-quick) ease; }
.k-tile-wrap:hover { border-color: var(--crew-border-control); box-shadow: 0 var(--crew-elevation-1-y) var(--crew-elevation-1-blur) var(--crew-shadow-1); }
.k-tile { display: flex; flex: 1; flex-direction: column; align-items: flex-start; gap: var(--crew-space-2); width: 100%; min-height: 128px; margin: 0; padding: var(--crew-space-5); border: 0; border-radius: var(--crew-radius-control); background: none; text-align: left; font-weight: var(--crew-weight-regular); }
.k-tile:hover { background: none; }
.k-tile strong { font-size: var(--crew-type-section); font-weight: var(--crew-weight-semibold); color: var(--crew-text-primary); overflow-wrap: anywhere; }
.k-tile-meta { font-size: var(--crew-type-meta); color: var(--crew-text-secondary); }
.k-tile-lists { display: flex; flex-wrap: wrap; gap: var(--crew-space-1); margin-top: auto; }
.k-tile-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--crew-space-2); padding: var(--crew-space-3) var(--crew-space-5); border-top: 1px solid var(--crew-border-default); }
.k-tile-wrap.archived { background: var(--crew-neutral-50); }
.k-tile-wrap.archived .k-tile strong { color: var(--crew-text-secondary); }
details.k-tile-new { display: block; min-height: 128px; border: 1px dashed var(--crew-border-control); border-radius: var(--crew-radius-control); background: transparent; padding: 0; }
.k-tile-new summary, .k-list-new summary, .k-add summary { list-style: none; cursor: pointer; color: var(--crew-text-secondary); border-radius: var(--crew-radius-menu); }
.k-tile-new summary::-webkit-details-marker, .k-list-new summary::-webkit-details-marker, .k-add summary::-webkit-details-marker { display: none; }
.k-tile-new summary { display: flex; align-items: center; justify-content: center; min-height: 126px; padding: var(--crew-space-4); font-weight: var(--crew-weight-semibold); }
details.k-tile-new[open] { border-style: solid; border-color: var(--crew-border-default); background: var(--crew-surface-card); padding: var(--crew-space-5); }
details.k-tile-new[open] summary { min-height: 0; padding: 0 0 var(--crew-space-3); justify-content: flex-start; color: var(--crew-text-primary); }
.k-add summary:hover, .k-list-new summary:hover, .k-tile-new summary:hover { color: var(--crew-text-primary); background: var(--crew-hover); }
.k-add form, .k-list-new form, .k-tile-new form { display: flex; flex-direction: column; gap: var(--crew-space-2); padding: var(--crew-space-1) 0 2px; }
.k-add input, .k-list-new input, .k-tile-new input { width: 100%; font-size: var(--crew-type-body); }
.k-add .row, .k-list-new .row, .k-tile-new .row { gap: var(--crew-space-2); }
.k-add .error, .k-list-new .error, .k-tile-new .error { margin: 0; font-size: var(--crew-type-meta); }
.k-board { display: flex; gap: var(--crew-space-3); overflow-x: auto; padding: 4px 2px 18px; align-items: flex-start; scroll-snap-type: x proximity; scrollbar-width: thin; }
.k-board::-webkit-scrollbar { height: 8px; }
.k-board::-webkit-scrollbar-thumb { background: var(--crew-neutral-300); border-radius: 4px; }
.k-board::-webkit-scrollbar-track { background: transparent; }
.k-list { flex: 0 0 min(272px, 84vw); scroll-snap-align: start; display: flex; flex-direction: column; gap: var(--crew-space-2); max-height: calc(100dvh - 200px); padding: var(--crew-space-3); border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-control); background: var(--crew-neutral-50); }
.k-list-head { display: flex; align-items: center; gap: var(--crew-space-2); min-height: 32px; padding: 0 2px 0 var(--crew-space-1); }
.k-list-head h2 { flex: 1; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--crew-type-body); font-weight: var(--crew-weight-semibold); }
.k-list-act { opacity: 0; transition: opacity var(--crew-motion-quick); }
.k-list:hover .k-list-act, .k-list:focus-within .k-list-act, .k-list-restore { opacity: 1; }
.k-list.k-dragover { background: var(--crew-brand-50); outline: 2px solid var(--crew-brand-500); }
.k-cards { display: flex; flex-direction: column; gap: var(--crew-space-2); min-height: 8px; overflow-y: auto; padding: 0 1px; }
.k-card { padding: var(--crew-space-3); border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-menu); background: var(--crew-surface-card); cursor: grab; transition: border-color var(--crew-motion-quick), box-shadow var(--crew-motion-quick), transform var(--crew-motion-quick); }
.k-card:hover { border-color: var(--crew-border-control); box-shadow: 0 var(--crew-elevation-1-y) var(--crew-elevation-1-blur) var(--crew-shadow-1); }
.k-card:focus-visible { outline: 2px solid var(--crew-focus); outline-offset: 2px; }
.k-card.dragging { opacity: .4; transform: rotate(1.5deg); }
.k-card-title { color: var(--crew-text-primary); line-height: var(--crew-leading-ui); overflow-wrap: anywhere; }
.k-card.done .k-card-title { color: var(--crew-text-secondary); text-decoration: line-through; }
.k-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px var(--crew-space-2); margin-top: var(--crew-space-2); font-size: var(--crew-type-meta); color: var(--crew-text-secondary); }
.k-who { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.k-avatar.crew-avatar { width: 20px; height: 20px; font-size: 11px; }
.k-via { margin-left: auto; }
.k-add summary { padding: var(--crew-space-2) var(--crew-space-1); }
.k-list-new { flex-basis: min(240px, 84vw); padding: var(--crew-space-1); border: 1px dashed var(--crew-border-control); background: transparent; }
.k-list-new summary { padding: var(--crew-space-3) 10px; }
details.k-list-new[open] { padding: var(--crew-space-3); border-style: solid; border-color: var(--crew-border-default); background: var(--crew-neutral-50); }
details.k-list-new[open] summary { padding: 0 var(--crew-space-1) 6px; color: var(--crew-text-primary); font-weight: var(--crew-weight-semibold); }
.k-list.archived { border-style: dashed; border-color: var(--crew-border-control); background: var(--crew-surface-page); }
.k-list.archived .k-list-head h2 { color: var(--crew-text-secondary); }
.k-card.archived { border-style: dashed; background: var(--crew-neutral-50); cursor: default; }
.k-card.archived .k-card-title { color: var(--crew-text-secondary); }
/* The card dialog (Crew's shell dialog, its fields Crew's form fields). */
.k-dialog { max-width: 640px; }
.k-form label { display: block; margin: var(--crew-space-4) 0 6px; }
.k-form input:not([type=checkbox]), .k-form textarea { width: 100%; font-size: var(--crew-type-body); }
.k-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--crew-space-3); }
.k-form .k-check { display: flex; align-items: center; margin: var(--crew-space-4) 0 var(--crew-space-1); font-weight: var(--crew-weight-regular); color: var(--crew-text-primary); }
.k-check input { width: 20px; min-height: 0; padding: 0; }
.k-form .hint { margin: var(--crew-space-1) 0 0; font-size: var(--crew-type-meta); }
.k-form .row { margin-top: var(--crew-space-4); gap: var(--crew-space-3); }
.k-comments-title { margin: var(--crew-space-6) 0 var(--crew-space-2); font-size: var(--crew-type-section); font-weight: var(--crew-weight-semibold); }
.k-comments { list-style: none; padding: 0; margin: 0 0 var(--crew-space-2); }
.k-comments li { padding: 10px 0; border-top: 1px solid var(--crew-border-default); white-space: pre-wrap; overflow-wrap: anywhere; }
.k-comments li.hint { border-top: 0; }
.k-comments small { display: block; margin: 3px 0 0; font-size: var(--crew-type-meta); color: var(--crew-text-secondary); }
@media (max-width: 700px) { .k-list { max-height: none; } .k-head-acts { margin-top: 0; } .k-list-act { opacity: 1; } }

/* ---- 網站 (spec 2026-10-23 static sites §4.4): one list of Crew Publish rows (an icon cell, the name with its reach,
   the line about it, 開啟 and the quieter actions); a version waiting for its card is a Warning notice under its row ---- */
.w-sites { list-style: none; margin: 0; padding: 0; border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-control); background: var(--crew-surface-card); overflow: hidden; }
.w-site + .w-site { border-top: 1px solid var(--crew-border-default); }
.w-site .crew-publish-row { flex-wrap: wrap; gap: var(--crew-space-3) var(--crew-space-4); }
.w-icon { display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; border-radius: var(--crew-radius-icon-cell); background: var(--crew-neutral-100); color: var(--crew-icon-default); }
.w-site .crew-publish-row__text { flex: 1 1 320px; }
.w-site-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--crew-space-2); color: var(--crew-text-primary); overflow-wrap: anywhere; }
.w-site-meta { font-size: var(--crew-type-meta); overflow-wrap: anywhere; }
.w-site-acts { display: flex; align-items: center; gap: var(--crew-space-1); flex-wrap: wrap; }
.w-site-acts .w-open { margin-right: var(--crew-space-2); }
.w-danger.crew-btn { --_fg: var(--crew-status-error); --_fg-h: var(--crew-status-error); }
.w-pending { margin: 0 var(--crew-space-5) var(--crew-space-4) calc(var(--crew-space-5) + 40px + var(--crew-space-4)); }
.w-pending > div { display: flex; flex-direction: column; gap: var(--crew-space-2); min-width: 0; }
.w-pending p { margin: 0; color: var(--crew-text-primary); overflow-wrap: anywhere; }
.w-pending .row { gap: var(--crew-space-2); }
.w-rename { display: flex; flex-direction: column; gap: var(--crew-space-2); }
.w-rename input { font-size: var(--crew-type-body); }
.w-rename .row { gap: var(--crew-space-2); }
.w-rename .error { margin: 0; font-size: var(--crew-type-meta); }
.w-notice { margin: 0 0 var(--crew-space-4); }
/* ---- 自訂 MCP on 工作平台 (JAYCE-104 JT-352): the 網站 list's Crew Publish rows, a connection per row; its state
   is a Status pill, the reason under the row, the add and API key forms Crew form fields ---- */
.rm-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--crew-space-3); flex-wrap: wrap; }
.rm-top h2 { margin: 0 0 var(--crew-space-1); }
.rm-top p { margin: 0; }
.rm-add { flex: none; }
.rm-who, .rm-notice { margin: var(--crew-space-3) 0 0; }
.rm-card > .crew-notice, .rm-card > .mo-failed, .rm-card > .crew-empty, .rm-card > .mo-loading { margin-top: var(--crew-space-4); }
.rm-list { list-style: none; margin: var(--crew-space-4) 0 0; padding: 0; border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-control); background: var(--crew-surface-card); overflow: hidden; }
.rm-conn + .rm-conn { border-top: 1px solid var(--crew-border-default); }
.rm-conn .crew-publish-row { flex-wrap: wrap; gap: var(--crew-space-3) var(--crew-space-4); }
.rm-conn .crew-publish-row__text { flex: 1 1 320px; min-width: 0; }
.rm-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--crew-space-2); color: var(--crew-text-primary); overflow-wrap: anywhere; }
.rm-meta { font-size: var(--crew-type-meta); overflow-wrap: anywhere; }
.rm-meta code { font-size: var(--crew-type-meta); }
.rm-acts { display: flex; align-items: center; gap: var(--crew-space-1); flex-wrap: wrap; }
.rm-busy { margin: 0; }
.rm-reason, .rm-hint, .rm-oauth, .rm-conn .rm-form { margin: 0 var(--crew-space-5) var(--crew-space-4) calc(var(--crew-space-5) + 40px + var(--crew-space-4)); }
.rm-reason { display: flex; gap: var(--crew-space-2); color: var(--crew-status-error); font-size: var(--crew-type-meta); overflow-wrap: anywhere; }
.rm-reason__icon { flex: 0 0 16px; margin-top: 2px; }
.rm-form { display: flex; flex-direction: column; gap: var(--crew-space-3); max-width: 680px; }
.rm-card > .rm-form { margin-top: var(--crew-space-4); }
.rm-form .crew-form-field .hint { margin: var(--crew-space-1) 0 0; }
.rm-form .row { gap: var(--crew-space-2); }
.rm-form .error { margin: 0; font-size: var(--crew-type-meta); }
/* OAuth (JT-354): where the admin is about to sign in, with the link; the redirect URI to register for an own OAuth app. */
.rm-oauth { display: flex; flex-direction: column; gap: var(--crew-space-3); max-width: 680px; color: var(--crew-text-primary); overflow-wrap: anywhere; }
.rm-oauth p, .rm-form > .hint, .rm-redirect { margin: 0; }
.rm-oauth .row { gap: var(--crew-space-2); }
.rm-oauth a.crew-btn { text-decoration: none; }
.rm-oauth__warn { display: flex; gap: var(--crew-space-2); color: var(--crew-status-warning); font-size: var(--crew-type-meta); }
.rm-oauth__scopes { font-size: var(--crew-type-meta); color: var(--crew-text-secondary); }
.rm-oauth__scopes code { font-size: var(--crew-type-meta); }
.rm-redirect code { font-size: var(--crew-type-meta); overflow-wrap: anywhere; user-select: all; }
/* 自訂 MCP 工具審核 (JT-353): the panel under a connection's row */
.rm-tools { display: flex; flex-direction: column; gap: var(--crew-space-3); margin: 0 var(--crew-space-5) var(--crew-space-4) calc(var(--crew-space-5) + 40px + var(--crew-space-4)); }
.rm-tools .row { gap: var(--crew-space-2); }
.rm-tools .hint, .rm-tools .error, .rm-tools .crew-notice { margin: 0; }
.rm-tools .error { font-size: var(--crew-type-meta); }
.rm-tool-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-control); }
.rm-tool { padding: var(--crew-space-3) var(--crew-space-4); }
.rm-tool + .rm-tool { border-top: 1px solid var(--crew-border-default); }
.rm-tool__head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--crew-space-2); }
.rm-tool__name { font-size: var(--crew-type-meta); color: var(--crew-text-primary); overflow-wrap: anywhere; }
.rm-tool__body { display: flex; flex-direction: column; gap: var(--crew-space-2); margin: var(--crew-space-2) 0 0 calc(var(--crew-space-5) + var(--crew-space-1)); }
.rm-tool__desc { margin: 0; font-size: var(--crew-type-meta); color: var(--crew-text-secondary); overflow-wrap: anywhere; white-space: pre-line; }
.rm-tool__schema summary { cursor: pointer; font-size: var(--crew-type-meta); color: var(--crew-text-secondary); min-height: 32px; display: flex; align-items: center; }
.rm-tool__schema pre { margin: var(--crew-space-1) 0 0; max-height: 240px; overflow: auto; font-size: var(--crew-type-meta); background: var(--crew-surface-subtle); border-radius: var(--crew-radius-control); padding: var(--crew-space-2); }
.rm-tool__kind { max-width: 320px; }
@media (max-width: 700px) {
  .rm-conn .crew-publish-row { padding: var(--crew-space-4); }
  .rm-conn .w-icon { display: none; }
  .rm-conn .crew-publish-row__text { flex-basis: 100%; }
  .rm-reason, .rm-hint, .rm-oauth, .rm-conn .rm-form, .rm-tools { margin: 0 var(--crew-space-4) var(--crew-space-4); }
  .rm-tool__body { margin-left: 0; }
}
@media (max-width: 700px) {
  .w-site .crew-publish-row { padding: var(--crew-space-4); }
  .w-icon { display: none; }
  .w-site .crew-publish-row__text { flex-basis: 100%; }
  .w-pending { margin: 0 var(--crew-space-4) var(--crew-space-4); }
}

/* 外部 Agent: the address to copy and the steps per client (Crew Accordion items), grants and keys as Crew Tables, the key form */
.a-hows { display: flex; flex-direction: column; gap: var(--crew-space-2); margin-top: var(--crew-space-4); }
.a-how.crew-accordion { padding: var(--crew-space-3) var(--crew-space-4); border-radius: var(--crew-radius-control); }
.a-how .crew-accordion__head { font-size: var(--crew-type-body); list-style: none; }
.a-how .crew-accordion__head::-webkit-details-marker { display: none; }
.a-how[open] > .crew-accordion__head::after { transform: rotate(180deg); }
.a-how:has(.crew-accordion__head:focus-visible) { outline: 2px solid var(--crew-focus); outline-offset: 2px; }
.a-how .crew-accordion__head:focus-visible { outline: none; }
.a-how ol { margin: 0; padding-left: 20px; color: var(--crew-text-secondary); }
.a-how p { margin: 0; overflow-wrap: anywhere; }
.a-how code { font-size: var(--crew-type-meta); background: var(--crew-surface-subtle); padding: 1px 5px; border-radius: var(--crew-radius-small); overflow-wrap: anywhere; }
.a-acts { text-align: right; white-space: nowrap; }
.a-table .mo-main { font-weight: var(--crew-weight-semibold); }
.a-new { margin: 0 0 var(--crew-space-4); }
.a-new .mo-copy code { font-size: var(--crew-type-meta); word-break: break-all; }
.a-new p { margin: 0; }
.a-key-form { display: flex; flex-direction: column; gap: var(--crew-space-3); margin-top: var(--crew-space-4); max-width: 360px; }
.a-key-form input { font-size: var(--crew-type-body); }
.a-key-form .row { gap: var(--crew-space-2); }
.a-key-form .error { margin: 0; font-size: var(--crew-type-meta); }
.a-key-open { margin: var(--crew-space-4) 0 0; }
.a-notice { margin: 0 0 var(--crew-space-4); }
/* In a card on a phone the rows are the card's own divided rows, not cards in a card. */
@media (max-width: 700px) {
  .a-card .mo-table tbody { gap: 0; }
  .a-card .mo-table tbody tr, .a-card .mo-table tbody tr:last-child { padding: var(--crew-space-3) 0; border: 0; border-top: 1px solid var(--crew-border-default); border-radius: 0; background: none; }
  .a-card .mo-table tbody tr:first-child { border-top: 0; padding-top: 0; }
  .a-acts.a-acts { display: flex; order: 9; }
}
.a-rows { list-style: none; margin: 0; padding: 0; }
.a-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--crew-border-default); }
.a-row:first-child { border-top: 0; }
.a-row strong { display: block; font-weight: var(--crew-weight-semibold); overflow-wrap: anywhere; }
.a-row small { display: block; color: var(--crew-text-secondary); font-size: var(--crew-type-meta); }
.a-row .link { min-height: 0; padding: 4px 0; flex: none; }
.a-row .w-danger { color: var(--crew-status-error); }
.card > p .secondary { width: auto; margin: 0; }
/* The language switcher (i18n.js) in Crew's markup (.locale-switch > select.locale-switcher + .locale-error; Crew's
   components.css draws the select): in the account menu's language row, or alone in the top bar of the column pages. */
.locale-switch { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--crew-space-1); }
.locale-switch .locale-switcher { width: auto; }
.locale-switch .locale-error:empty { display: none; }
.s-account-menu--sheet .locale-switch .locale-switcher { width: 100%; }
.a-row small .link { font-size: inherit; min-height: 0; padding: 0; }

/* 技能 in an AI 員工's 能力 tab (JT-294): Crew's disclosure rows, opened with <details>; the body is plain text. */
.ac-skill > summary { cursor: pointer; list-style: none; }
.ac-skill > summary::-webkit-details-marker { display: none; }
.ac-skill > summary::after { content: ""; flex: none; width: 8px; height: 8px; border-right: 2px solid var(--crew-text-secondary); border-bottom: 2px solid var(--crew-text-secondary); transform: rotate(45deg); margin-left: auto; }
.ac-skill[open] > summary::after { transform: rotate(-135deg); }
.ac-skill__text { display: flex; flex-direction: column; gap: var(--crew-space-1); min-width: 0; flex: 1 1 auto; }
.ac-skill__name { font-weight: 600; overflow-wrap: anywhere; }
.ac-skill__desc { margin: 0; }
.ac-skill__body { padding: var(--crew-space-3) var(--crew-space-4) var(--crew-space-4); border-top: 1px solid var(--crew-border-default); color: var(--crew-text-primary); white-space: pre-wrap; overflow-wrap: anywhere; }

/* UI review M08: the sites count is labelled meta text, apart from the full notice and the list. */
.w-quota { margin: 0 0 var(--crew-space-2); }
.w-quota-full { margin: 0 0 var(--crew-space-4); }
/* Crew's toast (crew-components.css .crew-toast): its live region top centre, over dialogs
   and clear of their action rows, taking no clicks (what is under it stays usable); a long
   account name wraps inside it (44 high at least, as Crew's). */
.s-toast-region { position: fixed; left: 50%; top: var(--crew-space-4); transform: translateX(-50%); z-index: var(--crew-z-toast); width: max-content; max-width: calc(100vw - 2 * var(--crew-space-4)); pointer-events: none; }
.s-toast { height: auto; min-height: 44px; padding-top: var(--crew-space-2); padding-bottom: var(--crew-space-2); overflow-wrap: anywhere; }
@media (max-width: 700px) {
  /* A phone's account actions are 48 high, as .crew-btn--48 (UI review M08: 44px touch at least), and wrap. */
  .int-account__actions { flex-wrap: wrap; }
  .int-account__actions .crew-btn--32 { --_h: var(--crew-control-height-lg); }
  .int-modal .int-account__actions .crew-btn--32::after { content: none; }
}

/* 新增 AI 員工 (Google Chat): a role waiting for its Google setup keeps its two actions under its card. */
.ac-pending { display: flex; flex-wrap: wrap; align-items: center; gap: var(--crew-space-2); margin-top: var(--crew-space-2); }
.ac-pending .crew-btn { margin: 0; }
