/* 組織架構 (members page): a port of Crew's org.css (Jayce
   platform/control/public/console/css/org.css at 65d1a430) to mk2's markup in
   app.js members(). Kept as Crew writes it, values included; what differs from
   Crew is marked "mk2:". Not a verbatim copy (DESIGN.md "The files"): Crew's
   LINE WORKS invite and login-hint rules are left out (mk2 has neither), its
   listbox and menu triggers are a native select and a menu drawn in place, and
   its dialogs sit in mk2's #s-modal. */

.o-note { color: var(--crew-text-secondary); margin: 0; }
.o-note:empty { display: none; }
.o-note[role="status"] { margin-top: var(--crew-space-4); }
.o-note.error { color: var(--crew-status-error); }
.o-hint { display: block; margin-top: 4px; color: var(--crew-text-secondary); font-size: var(--crew-type-meta); }

/* ---- Page ---- */
.o-page { display: flex; flex-direction: column; gap: var(--crew-space-6); margin-top: var(--crew-space-4); }
.o-page > * { margin: 0; }
.o-batch-error { margin: var(--crew-space-4) 0 0; padding: 14px var(--crew-space-4); border-radius: var(--crew-radius-icon-cell); background: var(--crew-status-error-surface); color: var(--crew-status-error); font-size: var(--crew-type-body); line-height: var(--crew-leading-body); }
.o-batch-error p, .o-batch-error ul { margin: 0; }
.o-batch-error ul { padding-left: var(--crew-space-5); }
.o-sync { margin: var(--crew-space-4) 0 0; }

/* Text buttons in the export's link style (ref.css .link): green, underlined, no box. */
.o-link { display: inline-flex; align-items: center; min-height: var(--crew-control-height); margin: 0; padding: 0 var(--crew-space-2); border: 0; background: transparent; color: var(--crew-link); font: inherit; font-size: var(--crew-type-body); font-weight: var(--crew-weight-semibold); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.o-link:hover { color: var(--crew-link-hover); background: transparent; }
.o-link:focus-visible { outline: 2px solid var(--crew-focus); outline-offset: 2px; border-radius: var(--crew-radius-small); }
.o-link:disabled { color: var(--crew-action-disabled-text); background: transparent; border: 0; cursor: default; }
.o-link--danger { color: var(--crew-status-error); text-decoration: none; padding: 0 var(--crew-space-1); }
.o-link--danger:hover { color: var(--crew-status-error); background: transparent; }
/* mk2: a destructive text button (刪除 a department, 清除帶入的記憶). */
.crew-btn.o-danger { color: var(--crew-status-error); }

/* ---- Panel: toolbar, summary row, table (ref.css .o-panel 16 radius, no title) ---- */
.o-panel { border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-control); background: var(--crew-surface-card); overflow: hidden; }
.or-toolbar { display: flex; gap: var(--crew-space-3); align-items: center; padding: var(--crew-space-4) var(--crew-space-5); }
.or-toolbar > .o-search { flex: 1 1 240px; min-width: 0; width: auto; margin: 0; }
.or-toolbar > .crew-btn { flex: none; white-space: nowrap; padding: 0 var(--crew-space-5); margin: 0; }
.o-add-menu { gap: 6px; padding: 0 14px 0 18px !important; margin: 0; }
.o-add-chevron { flex: none; }
.o-summaryrow { display: flex; align-items: center; justify-content: space-between; gap: var(--crew-space-3); padding: 0 var(--crew-space-5) var(--crew-space-3); }
.o-count { margin: 0; font-size: var(--crew-type-body); font-weight: var(--crew-weight-semibold); color: var(--crew-text-primary); }
.o-summary-actions { display: flex; align-items: center; gap: var(--crew-space-3); flex-wrap: wrap; justify-content: flex-end; }
.o-summary-actions .o-link { text-decoration: none; color: var(--crew-text-secondary); font-weight: var(--crew-weight-regular); }
.o-export { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: var(--crew-control-height); margin: 0; padding: 0 var(--crew-space-1); border: 0; background: transparent; font: inherit; font-size: var(--crew-type-body); font-weight: var(--crew-weight-semibold); color: var(--crew-text-primary); cursor: pointer; border-radius: var(--crew-radius-control); }
.o-export:hover { background: var(--crew-surface-subtle); }
.o-export:focus-visible { outline: 2px solid var(--crew-focus); outline-offset: 2px; }

/* Select (ref.css .c-select). mk2: a native select, drawn by components.css's select rule (its chevron is the background image, so only the colour is set here). */
.o-select { min-height: var(--crew-control-height); margin: 0; padding: 0 40px 0 var(--crew-space-3); border: 1px solid var(--crew-border-control); border-radius: var(--crew-radius-control); background-color: var(--crew-surface-card); color: var(--crew-text-primary); font-size: var(--crew-type-body); white-space: nowrap; text-overflow: ellipsis; }
.o-select:disabled { color: var(--crew-action-disabled-text); background-color: var(--crew-surface-subtle); border-color: var(--crew-border-default); cursor: default; }
.o-dept-select { flex: 0 0 auto; width: auto; min-width: 150px; max-width: 240px; }
.o-role-select { min-height: var(--crew-control-height-sm); width: auto; min-width: 112px; }

/* Floating layer (ref.css .c-pop): menu items, one or two lines. mk2: drawn in place under its button, not fixed. */
.o-menu-wrap { position: relative; flex: none; display: inline-flex; }
.o-pop { position: absolute; top: calc(100% + 4px); right: 0; z-index: calc(var(--crew-z-nav) + 1); box-sizing: border-box; width: 280px; overflow: auto; padding: var(--crew-space-2); border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-icon-cell); background: var(--crew-surface-card); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08); }
.o-pop__item { min-height: 0; display: flex; align-items: flex-start; gap: var(--crew-space-3); width: 100%; margin: 0; padding: 10px var(--crew-space-3); border: 0; border-radius: var(--crew-radius-menu); background: transparent; text-align: left; color: var(--crew-text-primary); font: inherit; font-size: var(--crew-type-body); cursor: pointer; }
.o-pop__item:hover, .o-pop__item:focus { background: var(--crew-surface-subtle); outline: none; }
.o-pop__item:focus-visible { box-shadow: inset 0 0 0 2px var(--crew-focus); }
.o-pop__item > svg { flex: none; margin-top: 2px; color: var(--crew-icon-default); }
.o-pop__text { flex: 1; min-width: 0; }
.o-pop__text strong { display: block; font-weight: var(--crew-weight-semibold); overflow-wrap: anywhere; }
.o-pop__text small { display: block; margin: 2px 0 0; font-size: var(--crew-type-meta); line-height: 1.6; color: var(--crew-text-secondary); }

/* Table (ref.css .o-row / .o-head): head 44 high, 12 regular; rows padding 14 20; middle columns centred. */
.or-scroll { overflow-x: auto; }
.or-table { table-layout: auto; }
.or-table th { height: 44px; padding: var(--crew-space-3) var(--crew-space-3); font-weight: 400; white-space: nowrap; }
.or-table td { box-sizing: border-box; height: 60px; padding: 14px var(--crew-space-3); }
.or-table tr > :first-child { padding-left: var(--crew-space-5); }
.or-table tr > :last-child { padding-right: var(--crew-space-5); }
.or-table thead tr { border-top: 1px solid var(--crew-border-default); }
.or-table tbody tr:last-child { border-bottom: 0; }
.or-table .o-c { text-align: center; }
.or-table .o-name { min-width: 84px; overflow-wrap: anywhere; }
.or-table .o-email { min-width: 156px; overflow-wrap: anywhere; }
.or-table .o-role { min-width: 112px; }
.or-table .o-pick { width: 28px; padding-right: 0; }
.or-table .o-pick .crew-checkbox { display: inline-flex; min-height: 0; margin: 0; vertical-align: middle; }
.or-table .o-pick input { flex: none; box-sizing: border-box; width: 20px; height: 20px; min-width: 20px; min-height: 0; margin: 0; padding: 0; }
.or-table tbody tr.is-picked, .or-table tbody tr.is-picked:hover { background: var(--crew-brand-50); }
.o-tags { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.o-tag { padding: 3px var(--crew-space-2); border-radius: var(--crew-radius-tag); background: var(--crew-surface-subtle); font-size: var(--crew-type-meta); white-space: nowrap; }
.o-role-text { font-size: var(--crew-type-body); }
/* mk2: the signed-in person's own row. */
.o-you { color: var(--crew-text-secondary); font-size: var(--crew-type-meta); }
.o-badge { display: inline-flex; align-items: center; padding: var(--crew-space-1) 10px; border-radius: var(--crew-radius-tag); background: var(--crew-surface-subtle); color: var(--crew-text-secondary); font-size: var(--crew-type-meta); font-weight: 400; white-space: nowrap; }
.o-badge--success { background: var(--crew-status-success-surface); color: var(--crew-status-success); }
.o-badge--warning { background: var(--crew-status-warning-surface); color: var(--crew-status-warning); }
/* mk2: 更新 in the import preview. */
.o-badge--info { background: var(--crew-status-info-surface); color: var(--crew-status-info); }
.o-ops { white-space: nowrap; text-align: right; }
.o-ops > * { vertical-align: middle; }
.o-ops > * + * { margin-left: var(--crew-space-1); }
.o-icon { position: relative; display: inline-grid; place-items: center; width: 32px; height: var(--crew-control-height-sm); min-height: var(--crew-control-height-sm); min-width: 0; margin: 0; padding: 0; border: 0; border-radius: var(--crew-radius-control); background: transparent; color: var(--crew-icon-default); cursor: pointer; }
.o-icon:hover, .o-icon:focus-visible { background: var(--crew-surface-subtle); }
.o-icon:focus-visible, .o-icontext:focus-visible { outline: 2px solid var(--crew-focus); outline-offset: 1px; }
.o-tip { position: absolute; bottom: calc(100% + 6px); right: 0; display: none; padding: var(--crew-space-1) var(--crew-space-2); border-radius: var(--crew-radius-tag); background: var(--crew-tooltip); color: var(--crew-tooltip-text); font-size: var(--crew-type-meta); font-weight: 500; line-height: var(--crew-leading-ui); white-space: nowrap; pointer-events: none; z-index: 5; }
.o-icon:hover .o-tip, .o-icon:focus-visible .o-tip { display: block; }
.o-icontext { position: relative; display: inline-flex; align-items: center; gap: 6px; height: var(--crew-control-height-sm); min-height: var(--crew-control-height-sm); margin: 0; padding: 0 var(--crew-space-2); border: 0; border-radius: var(--crew-radius-control); background: transparent; color: var(--crew-text-primary); font: inherit; font-size: var(--crew-type-body); font-weight: var(--crew-weight-semibold); white-space: nowrap; cursor: pointer; }
.o-icontext svg { flex: none; color: var(--crew-icon-default); }
.o-icontext:hover { background: var(--crew-surface-subtle); }
.o-toggle { display: none; }
.o-no-match { margin: 0 var(--crew-space-5) var(--crew-space-5); }

/* Selection mode bar (ref.css .o-removebar). */
.o-removebar { display: flex; align-items: center; justify-content: space-between; gap: var(--crew-space-4); flex-wrap: wrap; padding: var(--crew-space-4) var(--crew-space-5); border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-control); background: var(--crew-surface-card); }
.o-removebar__text strong { display: block; font-size: var(--crew-type-body); }
.o-removebar__text small { display: block; margin: 2px 0 0; font-size: var(--crew-type-meta); color: var(--crew-text-secondary); }
.o-removebar__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.o-removebar__actions .crew-btn { margin: 0; }

/* Foot note (ref.css .o-foot). */
.o-foot { display: flex; gap: var(--crew-space-2); align-items: flex-start; margin: 0; font-size: var(--crew-type-body); line-height: var(--crew-leading-body); color: var(--crew-text-secondary); }
.o-foot svg { flex: none; margin-top: 3px; }

/* Empty roster (ref.css .o-empty). */
.or-empty { display: flex; flex-direction: column; align-items: center; padding: 72px var(--crew-space-6); text-align: center; }
.or-empty__icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--crew-surface-subtle); color: var(--crew-icon-default); }
.s-content .or-empty h2 { margin: var(--crew-space-5) 0 10px; font-size: 20px; font-weight: 700; }
.or-empty p { margin: 0 0 var(--crew-space-6); max-width: 520px; color: var(--crew-text-secondary); line-height: var(--crew-leading-body); }
.or-empty__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: var(--crew-space-3); }
.or-empty__actions .crew-btn { margin: 0; }
.o-signed-in { display: flex; flex-direction: column; gap: var(--crew-space-3); }
.o-signed-in .crew-section-heading__desc { margin: var(--crew-space-1) 0 0; }

/* ---- Dialogs: the add / edit form, link, departments, transfer, the CSV import (ref.css .f-dialog, .o-dialog) ---- */
.o-dialog { --crew-dialog-pad: 28px; display: flex; flex-direction: column; width: 560px; max-width: calc(100vw - var(--crew-space-8)); max-height: calc(100dvh - var(--crew-space-8)); overflow: hidden; box-sizing: border-box; border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-control); background: var(--crew-surface-card); }
.o-dialog--import { width: 880px; }
.o-dialog--small { width: 480px; }
.o-dialog > .crew-dialog__header, .o-dialog > .crew-dialog__actions { flex: none; }
.o-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); }
.o-dialog > .crew-dialog__content > * { flex-shrink: 0; margin: 0; }
.o-dialog .crew-dialog__title { font-size: 20px; font-weight: 700; overflow-wrap: anywhere; }
.o-dialog .crew-dialog__title:focus { outline: none; }
.o-dialog .crew-btn--icon-only { min-height: var(--crew-control-height-sm); padding: 0; border: 0; }
.o-dialog .crew-dialog__actions { align-items: center; flex-wrap: wrap; }
.o-dialog .crew-dialog__actions .crew-btn { margin: 0; }
.o-dialog .crew-dialog__actions .crew-btn--40 { min-height: var(--crew-control-height); padding-top: 0; padding-bottom: 0; }
.o-dialog .crew-dialog__actions > :first-child:is(.o-links, .o-form-remove) { margin-right: auto; }
.o-dialog .o-hint { margin: var(--crew-space-2) 0 0; font-size: var(--crew-type-body); line-height: 1.6; }
.o-dialog p { line-height: var(--crew-leading-body); margin: 0; }
.o-dialog .error:empty { display: none; }
.o-links { display: inline-flex; flex-wrap: wrap; gap: var(--crew-space-2); align-items: center; }

/* Member form. */
.o-form { display: flex; flex-direction: column; gap: 18px; }
.o-field { display: flex; flex-direction: column; min-width: 0; }
.o-field > label { display: block; margin: 0 0 var(--crew-space-2); font-size: var(--crew-type-body); font-weight: var(--crew-weight-semibold); }
.o-field .crew-field, .o-field select { width: 100%; box-sizing: border-box; margin: 0; }
.o-field .error, .o-form > .error { margin: 6px 0 0; }
.o-field .crew-field[aria-invalid="true"], .o-chipbox:has([aria-invalid="true"]) { border-color: var(--crew-status-error); }
.o-opt { margin-left: var(--crew-space-1); font-size: var(--crew-type-meta); font-weight: var(--crew-weight-regular); color: var(--crew-text-secondary); }
.o-chipbox { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 46px; padding: 6px 10px; box-sizing: border-box; border: 1px solid var(--crew-border-control); border-radius: var(--crew-radius-control); background: var(--crew-surface-card); cursor: text; }
.o-chipbox:focus-within { border-color: var(--crew-focus); box-shadow: inset 0 0 0 1px var(--crew-focus); }
.o-chips { display: contents; }
.o-chip { display: inline-flex; align-items: center; gap: 2px; padding: 2px var(--crew-space-1) 2px 10px; border-radius: var(--crew-radius-tag); background: var(--crew-surface-subtle); font-size: var(--crew-type-body); }
.o-chip:not(:has(button)) { padding-right: 10px; }
.o-chip button { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; min-height: 24px; margin: 0; padding: 0; border: 0; border-radius: var(--crew-radius-tag); background: transparent; color: var(--crew-text-secondary); cursor: pointer; }
.o-chip button:hover { background: var(--crew-border-default); }
.o-chip-input, .o-chipbox .o-chip-input { flex: 1 1 120px; width: auto; min-width: 0; min-height: var(--crew-control-height-sm); margin: 0; padding: var(--crew-space-1); border: 0; outline: 0; background: transparent; box-shadow: none; font: inherit; font-size: var(--crew-type-body); color: var(--crew-text-primary); }
.o-chip-input:focus { box-shadow: none; }
.o-chip-input::placeholder { color: var(--crew-text-placeholder); }

/* mk2: 部門, the departments dialog (Crew has no such page; tree rows from crew-components.css). */
.o-dept-new label { display: block; margin: 0 0 var(--crew-space-2); font-weight: var(--crew-weight-semibold); }
.o-dept-new .ai-row { display: flex; gap: var(--crew-space-3); }
.o-dept-new .crew-field { flex: 1 1 auto; min-width: 0; margin: 0; }
.o-dept-new .crew-btn { flex: none; margin: 0; }
.o-dept-tree { list-style: none; margin: 0; padding: var(--crew-space-2) 0; border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-card); }
.o-dept-row { display: flex; align-items: center; gap: var(--crew-space-2); min-height: var(--crew-control-height); padding: 0 var(--crew-space-3) 0 calc(var(--crew-space-3) + var(--o-depth, 0) * var(--crew-tree-indent)); }
.o-dept-name { flex: 1 1 auto; min-width: 0; display: inline-flex; align-items: center; gap: var(--crew-space-2); overflow-wrap: anywhere; }
.o-dept-name svg { flex: none; color: var(--crew-icon-muted); }
.o-dept-ops { display: inline-flex; flex: none; align-items: center; gap: var(--crew-space-1); }
.o-dept-ops .crew-btn { margin: 0; }
/* components.css gives every button 40 of height; a 32 button keeps its 32 (as agents-catalog.css does for .ac-access). */
.o-page .crew-btn--32, .o-dialog .crew-btn--32 { min-height: var(--crew-control-height-sm); }
.o-dept-src { color: var(--crew-text-secondary); font-size: var(--crew-type-meta); }

/* CSV import. */
.o-drop { position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--crew-space-2); padding: var(--crew-space-12) 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; cursor: pointer; font-weight: var(--crew-weight-regular); }
.o-drop input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.o-drop:focus-within, .o-drop.is-over { outline: 2px solid var(--crew-focus); outline-offset: 2px; }
.o-drop__icon { color: var(--crew-icon-default); line-height: 0; }
.o-drop strong { font-size: 15px; }
.o-drop__hint { font-size: var(--crew-type-body); color: var(--crew-text-secondary); }
.o-dialog h3 { margin: var(--crew-space-2) 0 0; font-size: 15px; font-weight: 700; }
.oi-hint { color: var(--crew-text-secondary); font-size: var(--crew-type-body); }
.oi-counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--crew-space-3); margin: 0; padding: 0; list-style: none; }
.oi-counts li { padding: 14px var(--crew-space-4); border-radius: var(--crew-radius-icon-cell); background: var(--crew-surface-subtle); }
.oi-counts span { display: block; font-size: var(--crew-type-body); color: var(--crew-text-secondary); }
.oi-counts strong { display: block; margin-top: 6px; font-size: 22px; font-weight: var(--crew-weight-semibold); }
.oi-counts strong small { font-size: var(--crew-type-meta); font-weight: var(--crew-weight-regular); }
.oi-count--create strong { color: var(--crew-status-success); }
.oi-count--skip strong { color: var(--crew-status-warning); }
.oi-scroll { overflow-x: auto; border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-icon-cell); }
.oi-table th { height: 40px; font-weight: 400; }
.oi-table td { height: auto; padding-top: 10px; padding-bottom: 10px; vertical-align: top; overflow-wrap: anywhere; }
.oi-table tbody tr:last-child { border-bottom: 0; }
.oi-table tr.oi-skip td:last-child { color: var(--crew-status-warning); }
.oi-table .o-tags { justify-content: flex-start; }
/* mk2: the import's short columns (row, result, 工號) stay on one line; Crew's table has fewer columns. */
.oi-table td:nth-child(-n+3) { white-space: nowrap; overflow-wrap: normal; }
.oi-mapping { display: flex; flex-direction: column; gap: var(--crew-space-3); }
.oi-mapping h3, .oi-mapping p { margin: 0; }
.oi-map-row { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: var(--crew-space-3); align-items: center; }
.oi-map-row label { margin: 0; font-weight: var(--crew-weight-semibold); }
.oi-map-row select { width: 100%; min-height: var(--crew-control-height); }
.oi-map-actions { display: flex; }

/* ---- 860 and below: the toolbar wraps and each row is a summary card (ref.css 組織架構 below 861px) ---- */
@media (max-width: 860px) {
  .o-panel:not(.or-empty) { display: flex; flex-wrap: wrap; align-items: center; gap: var(--crew-space-3) var(--crew-space-2); border: 0; border-radius: 0; background: none; overflow: visible; }
  .o-panel:not(.or-empty) .or-toolbar, .o-panel:not(.or-empty) .o-results, .o-summaryrow, .o-summary-actions { display: contents; }
  .or-toolbar > .o-search { order: 1; flex: 0 0 100%; }
  .or-toolbar > .o-dept-select { order: 2; flex: 1 1 0; min-width: 0; max-width: none; }
  .or-toolbar > .o-menu-wrap { order: 3; flex: 0 0 auto; }
  .o-count { order: 4; flex: 0 0 100%; font-size: 13px; font-weight: var(--crew-weight-regular); color: var(--crew-text-secondary); }
  .or-toolbar > .o-remove-start, .or-toolbar > .o-remove-done, .or-toolbar > .o-depts-open, .o-export, .o-summary-actions .o-link { order: 5; flex: 0 0 auto; height: var(--crew-control-height-sm); min-height: var(--crew-control-height-sm) !important; padding: 0 10px !important; border: 1px solid var(--crew-border-control); border-radius: var(--crew-radius-control); background: var(--crew-surface-card); font-size: var(--crew-type-body); font-weight: var(--crew-weight-semibold); color: var(--crew-text-primary); }
  .o-export svg { display: none; }
  .o-panel:not(.or-empty) > .o-results > .or-scroll, .o-no-match { order: 7; flex: 0 0 100%; }
  .o-no-match { margin: 0; }
  .or-scroll { overflow: visible; }
  .or-table, .or-table tbody { display: block; min-width: 0; }
  .or-table thead { display: none; }
  .or-table tbody { display: flex; flex-direction: column; gap: var(--crew-space-3); }
  .or-table tbody tr, .or-table tbody tr:last-child { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name ops" "status status"; gap: var(--crew-space-3) var(--crew-space-2); align-items: center; padding: var(--crew-space-4); border: 1px solid var(--crew-border-default); border-radius: var(--crew-radius-card); background: var(--crew-surface-card); }
  .or-table tbody tr:hover { background: var(--crew-surface-card); }
  .or-table.o-selecting tbody tr { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "pick name ops" ". status status"; }
  .or-table tbody tr[data-open] { grid-template-areas: "name ops" "status status" "dept dept" "email email" "role role"; }
  .or-table.o-selecting tbody tr[data-open] { grid-template-areas: "pick name ops" ". status status" ". dept dept" ". email email" ". role role"; }
  .or-table td, .or-table tr > :first-child, .or-table tr > :last-child { display: block; height: auto; padding: 0; text-align: left; }
  .or-table td.o-pick { grid-area: pick; display: flex; align-items: center; min-height: var(--crew-control-height-sm); }
  .or-table td.o-name { grid-area: name; font-size: var(--crew-type-section); font-weight: var(--crew-weight-semibold); min-width: 0; }
  .or-table td.o-ops { grid-area: ops; display: flex; align-items: center; justify-content: flex-end; gap: var(--crew-space-1); }
  .or-table td.o-ops > * + * { margin-left: 0; }
  .or-table td.o-status { grid-area: status; }
  .or-table td.o-detail { display: none; }
  .or-table tr[data-open] td.o-detail { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: var(--crew-space-3); min-height: var(--crew-control-height-sm); min-width: 0; }
  .or-table tr[data-open] td.o-depts-cell { grid-area: dept; padding-top: var(--crew-space-3); border-top: 1px solid var(--crew-border-default); }
  .or-table tr[data-open] td.o-email { grid-area: email; }
  .or-table tr[data-open] td.o-role { grid-area: role; }
  .or-table tr[data-open] td.o-detail::before { content: attr(data-label); color: var(--crew-text-secondary); }
  .or-table .o-tags { justify-content: flex-start; }
  .or-table .o-role-select { justify-self: start; }
  .o-toggle { display: inline-grid; }
  .o-tip { display: none !important; }
  .or-table td.o-c { text-align: left; }
  /* Touch areas 44 around the 32 controls. */
  .o-icon::before, .o-icontext::before, .o-export::before, .or-toolbar > .o-remove-start::before, .or-toolbar > .o-remove-done::before, .or-toolbar > .o-depts-open::before { content: ""; position: absolute; inset: -6px; }
  .or-toolbar > .o-remove-start, .or-toolbar > .o-remove-done, .or-toolbar > .o-depts-open { position: relative; }
  .o-removebar { flex-direction: column; align-items: stretch; padding: var(--crew-space-4); }
}

@media (max-width: 700px) {
  .or-toolbar > .o-search, .o-field .crew-field, .o-chip-input { font-size: 16px; }
  .o-panel.or-empty { padding: var(--crew-space-12) var(--crew-space-5); }
  .or-empty__actions .crew-btn { min-height: 44px; }
  /* Form dialogs are full screen on a phone (DESIGN.md R4, as the integrations dialogs). mk2: the backdrop is #s-modal's. */
  .crew-dialog-backdrop:has(.o-dialog:not(.o-dialog--small)) { padding: 0; align-items: stretch; }
  .o-dialog:not(.o-dialog--small) { width: 100%; max-width: none; height: 100dvh; max-height: none; border: 0; border-radius: 0; --crew-dialog-pad: var(--crew-space-5); }
  .o-dialog--small { --crew-dialog-pad: var(--crew-space-5); }
  .o-dialog .crew-dialog__actions .crew-btn--40, .o-dialog .o-link { min-height: 44px; }
  .o-dialog .crew-dialog__actions > :first-child:is(.o-links, .o-form-remove) { flex: 0 0 100%; margin-right: 0; }
  .oi-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .oi-map-row { grid-template-columns: minmax(0, 1fr); gap: var(--crew-space-2); }
  .oi-table { min-width: 560px; }
  .o-removebar__actions .crew-btn { flex: 1 1 0; min-height: 44px; }
  .o-pop { width: min(280px, calc(100vw - 2 * var(--crew-space-4))); }
}
