/*
 * Forma look for the existing dialogs (People to add / Members, Import from a
 * file, Copy from another project). Loaded after the dialogs' own styles;
 * rules are prefixed with body.fm so they also win over the <style> blocks
 * the dialog scripts inject at runtime.
 */

/* ---------- Product checkboxes (the old toggle switches) ---------- */
body.fm .toggle-switch { width: 16px !important; height: 16px !important; transform: none !important; vertical-align: middle; display: inline-block; }
body.fm .toggle-slider { border: 1px solid var(--fm-border); background: #fff; border-radius: 2px; transition: none; }
body.fm .toggle-slider:before { display: none; }
body.fm .toggle-switch input:checked + .toggle-slider {
    background: var(--fm-blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5'%3E%3Cpath d='M5 12l5 5 9-10' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat;
    border-color: var(--fm-blue);
}
body.fm .toggle-switch input:disabled + .toggle-slider { opacity: 0.5; cursor: not-allowed; }
body.fm .toggle-switch input:focus-visible + .toggle-slider { outline: 2px solid var(--fm-blue); outline-offset: 2px; }

/* ---------- People to add / Members (full-screen) ---------- */
body.fm #userManagementModal { background: rgba(60, 60, 60, 0.5); }
body.fm #userManagementModal .user-modal-content { border: 0; background: #fff; }
body.fm #userManagementModal .user-modal-header {
    padding: 16px 32px; background: #fff; border-bottom: 1px solid var(--fm-divider); border-radius: 0;
    display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
body.fm #userManagementModal .fm-dlg-titles { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
body.fm #userManagementModal .fm-dlg-title-row { display: flex; align-items: center; gap: 16px; min-width: 0; }
body.fm #userManagementModal .user-modal-header h3 { margin: 0; font-size: 30px; font-weight: 400; line-height: 42px; color: var(--fm-text); }
body.fm #userManagementModal .fm-stepper { margin: 0; }
body.fm #userManagementModal.modal-manage-mode .fm-stepper { display: none; }
body.fm .fm-dlg-close {
    width: 36px; height: 36px; border: 0; background: transparent; border-radius: 2px;
    font-size: 28px; line-height: 1; color: var(--fm-text); cursor: pointer; font-weight: 400;
    display: inline-flex; align-items: center; justify-content: center;
}
body.fm .fm-dlg-close:hover { background: var(--fm-panel); color: var(--fm-text); }

body.fm #userManagementModal #modalHubInfo {
    padding: 0 !important; background: transparent !important; border: 0 !important;
    font-size: 14px !important; color: var(--fm-text-2) !important;
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px;
}
body.fm #userManagementModal #modalHubInfo strong { font-weight: 400; color: var(--fm-text-2); }
body.fm .fm-chipset { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
body.fm .fm-project-chip {
    display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 14px;
    background: #EEEEEE; color: var(--fm-text); font-size: 13px; max-width: 280px;
}
body.fm .fm-project-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

body.fm #userManagementModal .user-modal-body { padding: 16px 32px 24px; display: flex; flex-direction: column; gap: 12px; }
body.fm #userManagementModal .modal-table-actions { margin: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
body.fm #userManagementModal .modal-table-actions > div { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
body.fm #userManagementModal .modal-tip-banner {
    margin: 0; padding: 0; background: transparent; border: 0; font-size: 13px; line-height: 20px; color: var(--fm-text-2);
    display: flex; flex-wrap: wrap; gap: 4px 24px;
}
body.fm #userManagementModal .modal-table-summary {
    margin: 0; padding: 0; background: transparent; border: 0; font-size: 14px; color: var(--fm-text-2);
}
body.fm #duplicateEmailAlert {
    margin: 0 !important; padding: 12px 12px 12px 15px !important; border: 0 !important; border-radius: 2px !important;
    background: var(--fm-error-bg) !important; box-shadow: inset 3px 0 0 var(--fm-error); color: var(--fm-text) !important;
}

/* Table: Forma rows, bold header, no grid lines */
body.fm #userManagementModal .modal-table th,
body.fm #userManagementModal .modal-table td { border: 0; border-bottom: 1px solid var(--fm-row-line); padding: 0 8px; height: 48px; }
body.fm #userManagementModal .modal-table th {
    background: #fff; font-size: 13px; font-weight: 700; text-transform: none; letter-spacing: 0; color: var(--fm-text);
    border-bottom: 1px solid var(--fm-divider); line-height: 16px; height: 52px;
    overflow-wrap: normal; word-break: normal; hyphens: auto; -webkit-hyphens: auto; z-index: 3;
}
body.fm #userManagementModal .modal-table tr:nth-child(even) { background: transparent; }
body.fm #userManagementModal .modal-table tbody tr:hover td { background: #FAFAFA; }
body.fm #userManagementModal td.modal-editable:hover { background: #fff; box-shadow: inset 0 0 0 1px var(--fm-border); }
body.fm #userManagementModal .modal-access-cell { text-align: center; padding: 0; background: transparent; }
body.fm #userManagementModal .modal-access-cell.administrator { background: transparent; }
body.fm #userManagementModal .modal-access-cell.selected,
body.fm #userManagementModal td.selected { background: var(--fm-selected) !important; box-shadow: inset 0 0 0 1px var(--fm-blue); border-color: var(--fm-row-line); }
body.fm #userManagementModal .modal-access-cell.selecting { background: var(--fm-selected); }
body.fm #userManagementModal .modal-access-cell.error,
body.fm .modal-error-cell { background: var(--fm-warning-bg) !important; box-shadow: inset 0 0 0 1px #E8A317; color: var(--fm-warning); }
body.fm #userManagementModal .modal-table input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--fm-blue); }
body.fm .modal-col-resizer:hover, body.fm .modal-col-resizer.resizing,
body.fm .import-col-resizer:hover, body.fm .import-col-resizer.resizing { background: rgba(6, 150, 215, 0.35); }
body.fm .modal-tooltip { border: 0; border-radius: 4px; box-shadow: var(--fm-shadow); color: var(--fm-text); padding: 8px 12px; }

/* ---------- Import people from a file ---------- */
body.fm #csvImportModal { background: rgba(60, 60, 60, 0.5) !important; }
body.fm .fm-drop {
    width: 100%; padding: 20px 12px; border: 1px dashed var(--fm-blue); border-radius: 2px; background: #fff;
    display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; cursor: pointer; color: var(--fm-text);
}
body.fm .fm-drop:hover, body.fm .fm-drop.is-over { background: var(--fm-selected); }
body.fm .fm-drop.has-file { border-style: solid; background: var(--fm-selected); }
body.fm .fm-format { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--fm-divider); border-radius: 2px; font-size: 13px; }
body.fm .fm-format > div { padding: 8px 12px; }
body.fm .fm-format > div:not(:nth-child(3n+1)) { box-shadow: inset 1px 0 0 var(--fm-divider); }
body.fm .fm-format .fm-format-head { background: var(--fm-panel); font-weight: 700; }
body.fm .fm-format .fm-format-row { border-top: 1px solid var(--fm-divider); }

/* ---------- Copy people from another project (full-screen) ---------- */
body.fm .import-project-modal { background: rgba(60, 60, 60, 0.5); }
body.fm .import-project-modal-content { background: #fff; }
body.fm .import-project-modal-header { padding: 16px 32px; background: #fff; border-bottom: 1px solid var(--fm-divider); gap: 24px; }
body.fm .import-project-modal-header h3 { font-size: 30px; font-weight: 400; line-height: 42px; color: var(--fm-text); }
body.fm .import-project-modal-close { font-size: 28px; font-weight: 400; color: var(--fm-text); }
body.fm .import-project-modal-body { padding: 0; }
body.fm .import-project-split { gap: 0; }
body.fm .import-project-left { width: 320px; flex: none; background: var(--fm-panel); border-right: 1px solid var(--fm-divider); padding: 16px; gap: 16px; }
body.fm .import-hubs-section h4,
body.fm .import-projects-section h4,
body.fm .import-users-header h4 {
    font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--fm-text); font-weight: 700; margin: 0 0 6px;
}
body.fm .import-filter-input { height: 36px; padding: 0 12px; border: 1px solid var(--fm-border); border-radius: 2px; font-size: 14px; margin-bottom: 8px; background: #fff; }
body.fm .import-filter-input:focus { border-color: var(--fm-blue); box-shadow: 0 0 0 1px var(--fm-blue); }
body.fm .import-list { border: 0; border-radius: 0; background: transparent; }
body.fm .import-list-item { min-height: 36px; padding: 8px 10px; border: 0; font-size: 14px; }
body.fm .import-list-item:hover { background: #fff; }
body.fm .import-list-item.selected { background: #fff; color: var(--fm-text); font-weight: 700; box-shadow: inset 2px 0 0 var(--fm-blue); }
body.fm .import-project-right { flex: 1; width: auto; padding: 16px 32px; min-width: 0; }
body.fm .import-users-header { margin-bottom: 8px; gap: 12px; flex-wrap: wrap; }
body.fm .import-users-actions span { font-style: normal !important; font-size: 13px !important; color: var(--fm-text-2) !important; }
body.fm .import-btn-small,
body.fm .import-btn-primary {
    height: 36px !important; padding: 0 16px !important; font-size: 14px !important; font-weight: 600 !important;
    border-radius: 2px !important; background-color: #fff !important; color: var(--fm-text) !important; border: 1px solid var(--fm-border) !important;
}
body.fm .import-btn-small:hover { border-color: #808080 !important; background-color: #fff !important; }
body.fm .import-btn-primary { background-color: var(--fm-blue) !important; border-color: var(--fm-blue) !important; color: #fff !important; }
body.fm .import-btn-primary:hover { background-color: var(--fm-blue-hover) !important; border-color: var(--fm-blue-hover) !important; }
body.fm .import-users-table-container { border: 0; border-radius: 0; }
body.fm .import-users-table { font-size: 14px; }
body.fm .import-users-table th {
    background: #fff; height: 48px; padding: 0 8px; font-size: 13px; font-weight: 700; text-transform: none; letter-spacing: 0;
    color: var(--fm-text); border-bottom: 1px solid var(--fm-divider);
}
body.fm .import-users-table td { height: 44px; padding: 0 8px; border-bottom: 1px solid var(--fm-row-line); }
body.fm .import-users-table tr:hover td { background: #FAFAFA; }
body.fm .import-user-checkbox { accent-color: var(--fm-blue); }

/* Shared bits used by the dialogs above */
body.fm .fm-btn-danger { color: var(--fm-error); }
body.fm .fm-stepper li.is-done { color: var(--fm-text); }
body.fm .fm-stepper li.is-done .fm-step-dot { background: var(--fm-blue); border-color: var(--fm-blue); }

/* ---------- Review before sync, sync progress, results, role warnings ---------- */
body.fm .fm-review { max-width: 880px; max-height: 86vh; }
body.fm .fm-review-body { overflow-y: auto; }
body.fm .fm-review-summary { display: flex; flex-wrap: wrap; gap: 12px 32px; padding: 12px 0; border-top: 1px solid var(--fm-divider); border-bottom: 1px solid var(--fm-divider); }
body.fm .fm-review-stat { display: flex; align-items: center; gap: 8px; }
body.fm .fm-review-stat-value { font-size: 20px; font-weight: 600; }
body.fm .fm-mark {
    width: 20px; height: 20px; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; line-height: 1;
}
body.fm .fm-mark-added { background: #E3F3E6; color: var(--fm-success); }
body.fm .fm-mark-same { background: #EEEEEE; color: var(--fm-text-2); }
body.fm .fm-mark-removed { background: var(--fm-error-bg); color: var(--fm-error); }
body.fm .fm-mark-changed { border-radius: 0; width: 20px; height: 18px; background: none; position: relative; }
body.fm .fm-mark-changed::before {
    content: ''; position: absolute; inset: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 26'%3E%3Cpath d='M14 2l12 22H2z' fill='%23FFF6E0' stroke='%23E8A317' stroke-width='2.2' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
body.fm .fm-review-projects { display: flex; flex-direction: column; }
body.fm .fm-review-project-head {
    width: 100%; min-height: 44px; padding: 0 8px; border: 0; background: var(--fm-panel); cursor: pointer; color: var(--fm-text);
    display: flex; align-items: center; gap: 10px; text-align: left; font-size: 14px; box-shadow: inset 0 -1px 0 var(--fm-divider);
}
body.fm .fm-review-project-name { font-weight: 700; flex: 1; min-width: 0; }
body.fm .fm-chev { width: 8px; height: 8px; border-right: 2px solid var(--fm-text); border-bottom: 2px solid var(--fm-text); transform: rotate(-45deg); margin: 0 4px; flex: none; }
body.fm .fm-review-project-head[aria-expanded="true"] .fm-chev { transform: rotate(45deg); margin-top: -4px; }
body.fm .fm-review-row {
    display: grid; grid-template-columns: 36px minmax(0, 280px) minmax(0, 1fr); align-items: center; gap: 8px;
    min-height: 44px; padding: 4px 8px 4px 0; box-shadow: inset 0 -1px 0 var(--fm-row-line);
}
body.fm .fm-review-row .fm-mark { justify-self: center; }
body.fm .fm-review-row.is-changed { background: #FFFBF0; }
body.fm .fm-review-row.is-removed { background: #FDF5F4; }
body.fm .fm-review-who { display: flex; align-items: center; gap: 8px; min-width: 0; }
body.fm .fm-review-note { color: var(--fm-text-2); }
body.fm .fm-review-foot-note { margin: 0; font-size: 13px; }

body.fm .fm-progress { height: 8px; border-radius: 16px; background: #EEEEEE; overflow: hidden; }
body.fm .fm-progress-bar { height: 100%; background: var(--fm-blue); border-radius: 16px; transition: width 0.3s; }
@media (prefers-reduced-motion: reduce) { body.fm .fm-progress-bar { transition: none; } }

body.fm .fm-result-table { display: flex; flex-direction: column; }
body.fm .fm-result-row { display: grid; grid-template-columns: minmax(0, 1fr) 80px 80px 80px 130px; align-items: center; min-height: 44px; box-shadow: inset 0 -1px 0 var(--fm-row-line); }
body.fm .fm-result-head { font-weight: 700; box-shadow: inset 0 -1px 0 var(--fm-divider); }
body.fm .fm-result-ok { color: var(--fm-success); }
body.fm .fm-result-bad { color: var(--fm-error); font-weight: 600; }
body.fm .fm-result-errors { margin: 0; padding: 8px 12px 8px 32px; background: var(--fm-error-bg); font-size: 13px; line-height: 20px; }

body.fm #invalidRolesBackdrop .fm-warn-title { font-weight: 700; margin-bottom: 8px; }
body.fm #invalidRolesBackdrop .fm-warn-item { margin: 8px 0; padding: 10px 12px 10px 15px; background: var(--fm-warning-bg); box-shadow: inset 3px 0 0 #E8A317; border-radius: 2px; }
body.fm #invalidRolesBackdrop .fm-warn-list { margin: 6px 0 0; padding-left: 20px; }

/* Review: "N people with no changes" line */
body.fm .fm-review-same-toggle { width: 100%; border: 0; background: transparent; cursor: pointer; text-align: left; font: inherit; color: var(--fm-text-2); }
body.fm .fm-review-same-toggle:hover { background: #FAFAFA; }
body.fm .fm-link-text { color: var(--fm-link); }
body.fm .fm-review-chev-cell { display: flex; align-items: center; justify-content: center; }
body.fm .fm-review-same-toggle[aria-expanded="true"] .fm-chev { transform: rotate(45deg); margin-top: -4px; }

/* ---------- Folder access (folders-indented-tree.js) ---------- */
body.fm .it-overlay { background: rgba(60, 60, 60, 0.5); }
body.fm .it-modal { font-family: var(--fm-font); color: var(--fm-text); }
body.fm .it-modal-header { padding: 16px 32px; background: #fff; border-bottom: 1px solid var(--fm-divider); gap: 16px; }
body.fm .it-modal-header h3 { font-size: 30px; font-weight: 400; line-height: 42px; color: var(--fm-text); }
body.fm .it-modal-header h3 .it-proj { color: var(--fm-text-2); font-weight: 400; font-size: 16px; }
body.fm .it-mode-subtitle { font-size: 12px; color: var(--fm-text-2); }
/* View switch as Forma tabs */
body.fm .it-modal-header .it-segmented { background: transparent !important; border: 0 !important; border-radius: 0 !important; padding: 0 !important; gap: 20px; }
body.fm .it-modal-header .it-seg-btn {
    background: transparent !important; color: var(--fm-text) !important; border-radius: 0 !important;
    padding: 0 4px !important; height: 36px !important; font-size: 14px !important; font-weight: 400 !important;
}
body.fm .it-modal-header .it-seg-btn.active { background: transparent !important; color: var(--fm-text) !important; font-weight: 700 !important; box-shadow: inset 0 -2px 0 var(--fm-blue); }
body.fm .it-modal-header .it-seg-btn:not(.active):hover { background: transparent !important; color: var(--fm-text) !important; box-shadow: inset 0 -2px 0 var(--fm-divider); }
/* Search and buttons */
body.fm .it-search { height: 36px; padding: 0 26px 0 32px; font-size: 14px; border: 1px solid var(--fm-border); border-radius: 2px; width: 240px; }
body.fm .it-search:focus { border-color: var(--fm-blue); box-shadow: 0 0 0 1px var(--fm-blue); }
body.fm .it-search-match-count { background: var(--fm-selected); color: var(--fm-link); font-size: 12px; }
body.fm .it-small-btn {
    height: 36px !important; padding: 0 16px !important; font-size: 14px !important; font-weight: 600 !important;
    border-radius: 2px !important; border: 1px solid var(--fm-border) !important; background: #fff !important; color: var(--fm-text) !important;
}
body.fm .it-small-btn:hover { background: #fff !important; border-color: #808080 !important; color: var(--fm-text) !important; }
body.fm .it-danger-btn { background: #fff !important; color: var(--fm-error) !important; border-color: var(--fm-border) !important; }
body.fm .it-danger-btn:hover { background: #fff !important; color: var(--fm-error) !important; border-color: var(--fm-error) !important; }
body.fm .it-sync-btn { background: var(--fm-blue) !important; border-color: var(--fm-blue) !important; color: #fff !important; }
body.fm .it-sync-btn:hover { background: var(--fm-blue-hover) !important; border-color: var(--fm-blue-hover) !important; color: #fff !important; }
body.fm .it-close { color: var(--fm-text); font-weight: 400; }
body.fm .it-close:hover { color: var(--fm-text); transform: none; }
body.fm .it-error-message { margin: 16px 32px; padding: 12px 12px 12px 15px; border: 0; border-radius: 2px; background: var(--fm-warning-bg); box-shadow: inset 3px 0 0 #E8A317; color: var(--fm-text); text-align: left; }
/* Column header like a Forma table header */
body.fm .it-col-header { background: #fff; border-bottom: 1px solid var(--fm-divider); font-size: 14px; font-weight: 700; letter-spacing: 0; color: var(--fm-text); }
body.fm .it-col-cell { padding: 0 8px; height: 48px; display: flex; align-items: center; border-right: 0; }
/* Column resize handles: a short divider at each boundary, blue and full height while hovered or dragged */
body.fm .it-col-resizer { right: 0; width: 9px; background: transparent; }
body.fm .it-col-resizer::after { content: ''; position: absolute; top: 14px; bottom: 14px; right: 4px; width: 1px; background: var(--fm-divider); }
body.fm .it-col-resizer:hover, body.fm .it-col-resizer.it-col-resizing { background: transparent; }
body.fm .it-col-resizer:hover::after, body.fm .it-col-resizer.it-col-resizing::after { top: 0; bottom: 0; right: 3px; width: 3px; background: var(--fm-blue); }
body.fm .it-help-dot { background: #BBBBBB; }
body.fm .it-help-tooltip { background: #fff; color: var(--fm-text); box-shadow: var(--fm-shadow); border-radius: 4px; font-size: 13px; line-height: 1.6; width: 260px; }
body.fm .it-modal-body { padding: 4px 0 24px; }
/* Permission pills */
/* No position/transform/opacity here: Safari draws positioned HTML inside an SVG
   foreignObject at the wrong place (every pill piled up at the top of the column). */
body.fm .it-level { width: 100px; height: 30px; display: flex; align-items: center; justify-content: center; font-family: var(--fm-font); border-radius: 2px; }
body.fm .it-level-view { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 100px; }
/* Forma: four bars, 21x8, fully round; on = blue, outlined = first level of its group */
body.fm .it-pills { display: flex; gap: 4px; }
body.fm .it-pill { box-sizing: border-box; width: 21px; height: 8px; border-radius: 16px; background: #EEEEEE; }
body.fm .it-pill.is-on { background: var(--fm-blue); }
body.fm .it-pill.is-part { background: transparent; border: 1px solid #7CC3E6; }
body.fm .it-level.is-inherited .it-pill.is-on { background: #9FD4EE; }
body.fm .it-level.is-inherited .it-pill.is-part { border-color: #C3E3F3; }
body.fm .it-level-label { font-size: 12px; line-height: 14px; color: var(--fm-text); white-space: nowrap; }
body.fm .it-level.is-inherited .it-level-label { color: var(--fm-text-3); }
body.fm .it-level-chev { width: 7px; height: 7px; border-right: 1.6px solid var(--fm-text); border-bottom: 1.6px solid var(--fm-text); transform: rotate(45deg); margin-top: -4px; }

body.fm .it-level.is-editable:hover { background: var(--fm-panel); border-radius: 2px; }

/* Status bar, context menu, delete toast */
body.fm #itStatusBar { padding: 8px 32px; font-size: 13px; color: var(--fm-text-2); background: #fff; border-top: 1px solid var(--fm-divider); }
body.fm .it-status-sel { color: var(--fm-link); }
body.fm .it-ctx-menu { border: 0; border-radius: 4px; box-shadow: var(--fm-shadow); padding: 8px 0; width: 220px; }
body.fm .it-ctx-item { padding: 0 16px; min-height: 36px; font-size: 14px; border-radius: 0; color: var(--fm-text); }
body.fm .it-ctx-item:hover { background: var(--fm-panel); }
body.fm .it-ctx-item.it-ctx-danger { color: var(--fm-error); }
body.fm .it-ctx-item.it-ctx-danger:hover { background: var(--fm-error-bg); }
body.fm .it-ctx-sep { background: var(--fm-divider); margin: 4px 0; }
body.fm .it-ctx-levels button { border-radius: 2px !important; border-color: var(--fm-border) !important; color: var(--fm-text) !important; }
body.fm .it-confirm-toast { background: #fff; color: var(--fm-text); border-radius: 4px; box-shadow: var(--fm-shadow); font-size: 14px; padding: 10px 12px 10px 16px; }
body.fm .it-confirm-toast .it-confirm-cancel { color: var(--fm-text) !important; border: 1px solid var(--fm-border) !important; border-radius: 2px !important; height: 32px !important; padding: 0 12px !important; font-size: 14px !important; font-weight: 600 !important; }
body.fm .it-confirm-toast .it-confirm-delete { background: var(--fm-error) !important; border-radius: 2px !important; height: 32px !important; padding: 0 12px !important; font-size: 14px !important; font-weight: 600 !important; }
body.fm .it-drag-ghost { background: var(--fm-text); border-radius: 2px; font-size: 13px; }
/* Left "Project users" panel (drag source) */
body.fm .folders-user-list { background: var(--fm-panel); }
body.fm .it-userlist-resizer { border-right: 1px solid var(--fm-divider); }
body.fm .user-list-header { background: var(--fm-panel); border-bottom: 1px solid var(--fm-divider); padding: 16px; }
body.fm .user-list-header .pu-title { font-size: 16px; color: var(--fm-text); }
body.fm .pu-controls .it-segmented { background: transparent !important; border: 0 !important; border-radius: 0 !important; padding: 0 !important; gap: 16px; box-shadow: inset 0 -1px 0 var(--fm-divider); }
body.fm .pu-controls .it-seg-btn { flex: none !important; background: transparent !important; color: var(--fm-text) !important; border-radius: 0 !important; padding: 0 4px !important; height: 36px !important; font-size: 14px !important; font-weight: 400 !important; }
body.fm .pu-controls .it-seg-btn.active { background: transparent !important; color: var(--fm-text) !important; font-weight: 700 !important; box-shadow: inset 0 -2px 0 var(--fm-blue); }
body.fm .pu-controls .it-seg-btn:not(.active):hover { background: transparent !important; color: var(--fm-text) !important; }
body.fm .pu-icon-btn { border-radius: 2px !important; border-color: var(--fm-border) !important; width: 36px !important; height: 36px !important; }
body.fm .pu-help { background: var(--fm-panel); border-bottom: 1px solid var(--fm-divider); }
body.fm .pu-help summary { color: var(--fm-link); font-size: 14px; font-weight: 400; }
body.fm .pu-help-body { font-size: 13px; color: var(--fm-text-2); }
body.fm .pu-chip { border-radius: 14px; font-size: 12px; font-weight: 600; background: #EEEEEE; color: var(--fm-text); }
body.fm .user-list-items { padding: 4px 0; gap: 0; }
body.fm .user-list-item { border: 0; border-radius: 0; padding: 0 16px; min-height: 48px; font-size: 14px; color: var(--fm-text); }
body.fm .user-list-item:hover { background: #fff; border-color: transparent; }
body.fm .user-list-item.user-selected { background: var(--fm-selected); color: var(--fm-text); box-shadow: inset 2px 0 0 var(--fm-blue); border-color: transparent; }
body.fm .user-list-item.user-selected .pu-item-email { color: var(--fm-text-2); }
body.fm .user-list-item.user-selected .pu-avatar { filter: none; }
body.fm .pu-avatar { font-size: 11px; font-weight: 600; }
body.fm .pu-item-name { font-weight: 400; }
body.fm .pu-item-email { font-size: 12px; color: var(--fm-text-2); }

/* Folder access: level bars are a focusable slider (arrow keys) */
body.fm .it-level.is-editable { cursor: pointer; }
/* Focus ring for keyboard use only (a mouse click shows none); drawn inside
   the control because the table cell clips anything outside it. */
body.fm .it-level.is-editable:focus { outline: none; }
body.fm .it-level.is-editable:focus-visible,
body.fm .it-level.is-editable:has(:focus-visible) { outline: 2px solid var(--fm-blue); outline-offset: -2px; }

/* Folder access: search in the Project Users panel */
body.fm .pu-search { position: relative; }
body.fm .pu-search svg { position: absolute; left: 10px; top: 10px; pointer-events: none; }
body.fm .pu-search .fm-input { padding-left: 34px; padding-right: 30px; background: #fff; }
body.fm .pu-search-clear {
    position: absolute; right: 4px; top: 4px; width: 28px; height: 28px; border: 0; border-radius: 2px;
    background: transparent; color: var(--fm-text-2); font-size: 18px; line-height: 1; cursor: pointer;
}
body.fm .pu-search-clear:hover { background: var(--fm-panel); color: var(--fm-text); }
body.fm .pu-search-status { font-size: 13px; color: var(--fm-text-2); min-height: 0; }
body.fm .pu-search-status:empty { display: none; }
body.fm .user-list-item[hidden] { display: none !important; }

/* Folder access: level picker for touch screens (tap a level) */
body.fm .it-level-picker {
    position: fixed; z-index: 20000; width: 300px; max-width: calc(100vw - 16px); padding: 6px 0;
    background: #fff; border-radius: 4px; box-shadow: var(--fm-shadow); display: flex; flex-direction: column;
}
body.fm .it-level-option {
    min-height: 48px; padding: 6px 12px; border: 0; background: transparent; cursor: pointer;
    display: flex; align-items: center; gap: 12px; text-align: left; font: inherit; font-size: 13px; color: var(--fm-text);
}
body.fm .it-level-option:hover, body.fm .it-level-option:focus-visible { background: var(--fm-panel); }
body.fm .it-level-option.is-current { background: var(--fm-selected); box-shadow: inset 2px 0 0 var(--fm-blue); }
body.fm .it-level-option .it-level-view { width: 100px; flex: none; }
body.fm .it-level-option-name { line-height: 18px; }

/* Folder access: tooltip on editable levels (how to change them) */
body.fm .it-level-tip {
    position: fixed; z-index: 20000; max-width: 260px; padding: 8px 12px;
    display: flex; flex-direction: column; gap: 2px;
    background: #fff; color: var(--fm-text); border-radius: 4px; box-shadow: var(--fm-shadow);
    font-size: 13px; line-height: 18px; pointer-events: none;
}

/* Modify people: filter row under the column headers (shares their widths) */
body.fm #userManagementModal .modal-table thead { position: sticky; top: 0; z-index: 4; background: #fff; }
body.fm #userManagementModal .modal-table thead th { position: relative; top: auto; }
body.fm #userManagementModal .modal-filter-row td { height: 48px; padding: 0 8px; background: #fff; border-bottom: 1px solid var(--fm-divider); overflow: visible; }
body.fm #userManagementModal .modal-filter { position: relative; display: block; }
body.fm #userManagementModal .modal-filter svg { position: absolute; left: 9px; top: 8px; pointer-events: none; }
body.fm #userManagementModal .modal-filter .fm-input { height: 32px; padding: 0 8px 0 31px; font-size: 13px; background: #fff; text-overflow: ellipsis; }
/* Modify people: Data Management and Insight come with every invite, so instead of two
   always-ticked columns there's one note under the product headers */
body.fm #userManagementModal .modal-filter-row td.modal-auto-note { padding: 6px 12px; white-space: normal; }
body.fm #userManagementModal .modal-auto-note-inner { display: flex; align-items: center; gap: 10px; font-size: 13px; line-height: 18px; color: var(--fm-text-2); }
body.fm #userManagementModal .modal-auto-note-inner svg { flex: none; }
body.fm #userManagementModal .modal-auto-note b { font-weight: 700; color: var(--fm-text); }
body.fm #userManagementModal .modal-filter-status { display: flex; align-items: center; gap: 8px; min-height: 36px; }
body.fm #userManagementModal .modal-col-resizer { right: -4px; width: 9px; }
body.fm #userManagementModal .modal-col-resizer::after { content: ''; position: absolute; top: 14px; bottom: 14px; left: 4px; width: 1px; background: var(--fm-divider); }
body.fm #userManagementModal .modal-col-resizer:hover, body.fm #userManagementModal .modal-col-resizer.resizing { background: transparent; }
body.fm #userManagementModal .modal-col-resizer:hover::after, body.fm #userManagementModal .modal-col-resizer.resizing::after { top: 0; bottom: 0; left: 3px; width: 3px; background: var(--fm-blue); }

/* Account users dialog (get_account_users.js) */
body.fm .au-overlay { z-index: 1001; }
body.fm .au-dialog { max-width: 1000px; width: 100%; height: min(85vh, 900px); }
body.fm .au-sub { color: var(--fm-text-2); margin-top: 2px; }
body.fm .au-status { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 8px 24px 0; color: var(--fm-text-2); }
body.fm .au-loading { display: flex; align-items: center; gap: 10px; padding: 24px; color: var(--fm-text-2); }
body.fm .au-error { margin: 16px 24px; }
body.fm .au-table-wrap { flex: 1; min-height: 0; overflow-y: auto; padding: 0 24px 16px; }
body.fm .au-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 14px; }
body.fm .au-table thead { position: sticky; top: 0; z-index: 2; background: #fff; }
body.fm .au-table th { height: 48px; padding: 0 8px; text-align: left; font-weight: 700; background: #fff; }
body.fm .au-filter-row td { height: 48px; padding: 0 8px; background: #fff; border-bottom: 1px solid var(--fm-divider); }
body.fm .au-table tbody td { height: 48px; padding: 0 8px; border-bottom: 1px solid var(--fm-row-line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.fm .au-table tbody tr:hover td { background: #FAFAFA; }
body.fm .au-table td.au-unset { color: var(--fm-text-3); }
body.fm .au-filter { position: relative; display: block; }
body.fm .au-filter svg { position: absolute; left: 9px; top: 8px; pointer-events: none; }
body.fm .au-filter .fm-input { height: 32px; padding: 0 8px 0 31px; font-size: 13px; text-overflow: ellipsis; }
body.fm .au-empty { margin: 0; padding: 24px 8px; color: var(--fm-text-2); }
@media (max-width: 700px) { body.fm .au-table-wrap, body.fm .au-status { padding-left: 12px; padding-right: 12px; } }
/* Access columns: header label centred over its centred tick boxes, at any column width */
body.fm #userManagementModal .modal-table thead th.modal-resizable-th:not(.modal-editable) { text-align: center; }

/* Access level help (?): Forma's grouped list of levels */
body.fm .it-help-tooltip.it-schema { width: 380px; padding: 8px 0; line-height: 20px; font-weight: 400; }
body.fm .it-schema-title { display: block; padding: 4px 16px 8px; }
body.fm .it-schema-group { display: block; padding: 6px 0; border-top: 1px solid var(--fm-divider); }
body.fm .it-schema-head { display: flex; align-items: center; gap: 12px; padding: 4px 16px; }
body.fm .it-schema-level { display: block; padding: 4px 16px; color: var(--fm-text-2); }
body.fm .it-schema-note { display: block; padding: 8px 16px 4px; border-top: 1px solid var(--fm-divider); color: var(--fm-text-2); }
body.fm .it-schema-note .it-schema-head { padding: 0 0 6px; align-items: flex-start; }
body.fm .it-schema-note .it-pills { margin-top: 6px; flex: none; }

/* Folder access: selection bar (shown while people, roles or companies are selected) */
body.fm .it-selbar { display: flex; align-items: center; gap: 12px; margin: -8px -32px 0; padding: 8px 32px; background: var(--fm-selected); border-bottom: 1px solid var(--fm-divider); font-size: 14px; color: var(--fm-text); }
body.fm .it-selbar .fm-btn { height: 32px; }
body.fm .it-selbar-remove { color: var(--fm-error); }
body.fm .it-selbar-remove:hover { border-color: var(--fm-error); }
body.fm .it-selbar-hint { color: var(--fm-text-2); font-size: 13px; }
body.fm .it-selbar-clear { margin-left: auto; }
body.fm .it-selbar .it-selbar-clear { border-color: transparent !important; background: transparent !important; color: var(--fm-link) !important; }
body.fm .it-selbar .it-selbar-clear:hover { text-decoration: underline; }

/* Folder access: Sync to Forma dialog (update_folder_permission.js) */
body.fm .fs-overlay { z-index: 10200; }
body.fm .fs-dialog { max-width: 640px; max-height: 85vh; }
body.fm .fs-body { padding: 20px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
body.fm .fs-progress { display: flex; flex-direction: column; gap: 10px; }
body.fm .fs-progress[hidden], body.fm #folderSyncResults[hidden] { display: none; }
body.fm .fs-status { color: var(--fm-text-2); overflow-wrap: anywhere; }
body.fm .fs-status.is-error { color: var(--fm-error); }
body.fm .fs-track { height: 4px; border-radius: 4px; background: #EEEEEE; overflow: hidden; }
body.fm .fs-bar { height: 100%; width: 0; background: var(--fm-blue); transition: width .3s; }
@media (prefers-reduced-motion: reduce) { body.fm .fs-bar { transition: none; } }
body.fm #folderSyncResultsContent { display: flex; flex-direction: column; gap: 16px; }
body.fm .fs-counts { display: flex; flex-wrap: wrap; border: 1px solid var(--fm-divider); border-radius: 4px; }
body.fm .fs-count { flex: 1 1 110px; padding: 10px 16px; display: flex; flex-direction: column; box-shadow: inset -1px 0 0 var(--fm-row-line); }
body.fm .fs-count-value { font-size: 24px; line-height: 32px; font-weight: 600; font-variant-numeric: tabular-nums; }
body.fm .fs-count-label { font-size: 13px; color: var(--fm-text-2); }
body.fm .fs-count.is-zero .fs-count-value { color: var(--fm-text-3); font-weight: 400; }
body.fm .fs-section h3 { margin: 0 0 4px; font-size: 14px; font-weight: 700; }
body.fm .fs-hint { margin: 0 0 6px; color: var(--fm-text-2); font-size: 13px; }
body.fm .fs-list { list-style: none; margin: 0; padding: 0; max-height: 200px; overflow-y: auto; }
body.fm .fs-list li { display: flex; gap: 12px; min-height: 36px; align-items: center; border-bottom: 1px solid var(--fm-row-line); font-size: 14px; }
body.fm .fm-alert .fs-list li { border-bottom-color: rgba(0, 0, 0, 0.06); }
body.fm .fs-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.fm .fs-folder { color: var(--fm-text-2); white-space: nowrap; max-width: 45%; overflow: hidden; text-overflow: ellipsis; }
body.fm .fm-dialog-foot[hidden] { display: none; }

/* Copy from the hub (import-from-hub.js): reuses the Account users table (.au-*) */
body.fm .hi-overlay { z-index: 4000; }
body.fm .hi-table tbody tr { cursor: pointer; }
body.fm .hi-table tbody tr.is-selected td { background: var(--fm-selected); }
body.fm .hi-table th:first-child, body.fm .hi-table td:first-child { text-align: center; padding: 0; }
body.fm .hi-table input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--fm-blue); cursor: pointer; }
body.fm .hi-foot-note { margin-right: auto; align-self: center; color: var(--fm-text-2); font-size: 13px; }
body.fm .hi-result { padding: 20px 24px; display: flex; flex-direction: column; gap: 12px; }
body.fm .hi-result p { margin: 0; }
body.fm .hi-skipped { margin: 6px 0 0; padding-left: 20px; max-height: 160px; overflow-y: auto; }
body.fm .au-status .fm-btn-text { border-color: transparent !important; background: transparent !important; color: var(--fm-link) !important; height: 32px; padding: 0 8px; }
body.fm .au-status .fm-btn-text:hover { text-decoration: underline; }
body.fm .au-dialog.hi-done { height: auto; }
body.fm .hi-head { display: flex; flex-direction: column; gap: 8px; }
body.fm .hi-hub-field { display: flex; align-items: center; gap: 8px; color: var(--fm-text-2); }
body.fm .hi-hub { width: 280px; height: 32px; padding: 0 8px; }
body.fm .hi-other-hub { margin: 12px 24px 0; }

/* Copy people from another project: filters under the headers, sortable Email / Company / Role */
body.fm .import-users-table thead { position: sticky; top: 0; z-index: 10; background: #fff; }
body.fm .import-users-table thead th { position: relative; top: auto; }
body.fm .import-filter-row td { height: 48px; padding: 0 6px; background: #fff; border-bottom: 1px solid var(--fm-divider); overflow: visible; }
body.fm .import-users-table th.import-sortable { cursor: pointer; user-select: none; }
body.fm .import-users-table th.import-sortable:hover { color: var(--fm-blue); }
body.fm .import-sort-ind { margin-left: 4px; font-size: 10px; color: var(--fm-blue); }
body.fm .import-users-count { font-weight: 400; color: var(--fm-text-2); margin-left: 6px; }

/* ---------- Account users: access matrix (access-dashboard.js) ---------- */
body.fm .ad-overlay { z-index: 1001; }
body.fm .ad-overlay.fm-overlay { padding: 0; }
body.fm .ad-dialog { width: 100vw; max-width: none; height: 100vh; border-radius: 0; }
body.fm .ad-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px 24px; padding: 18px 24px 14px; box-shadow: inset 0 -1px 0 var(--fm-divider); }
body.fm .ad-head-text { display: flex; flex-direction: column; gap: 2px; flex: 1 1 320px; min-width: 0; }
body.fm .ad-title-row { display: flex; align-items: center; gap: 12px; }
body.fm .ad-head-actions { display: flex; align-items: center; gap: 8px; }
body.fm .ad-head-actions .fm-dialog-close { margin-left: 8px; }
body.fm .ad-muted { color: var(--fm-text-2); }
body.fm .ad-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding: 10px 24px; border-bottom: 1px solid var(--fm-row-line); }
body.fm .ad-tabs { display: flex; gap: 20px; box-shadow: inset 0 -1px 0 var(--fm-divider); }
body.fm .ad-tabs button { height: 36px; padding: 0 2px; border: 0; background: none; font: 400 14px var(--fm-font); color: var(--fm-text); cursor: pointer; }
body.fm .ad-tabs button.is-active { font-weight: 700; box-shadow: inset 0 -2px 0 var(--fm-blue); }
body.fm .ad-search { position: relative; display: block; flex: 0 1 280px; }
body.fm .ad-search svg { position: absolute; left: 10px; top: 10px; pointer-events: none; }
body.fm .ad-search .fm-input { padding-left: 34px; }
body.fm .ad-zoom { display: inline-flex; align-items: center; border: 1px solid var(--fm-border); border-radius: 2px; }
body.fm .ad-zoom button { width: 32px; height: 30px; border: 0; background: #fff; font: 600 16px var(--fm-font); color: var(--fm-text); cursor: pointer; }
body.fm .ad-zoom button:hover { background: var(--fm-panel); }
body.fm .ad-zoom span { min-width: 48px; text-align: center; line-height: 30px; border-left: 1px solid var(--fm-divider); border-right: 1px solid var(--fm-divider); font-variant-numeric: tabular-nums; }
body.fm .ad-zoom-hint { font-size: 13px; margin-left: -12px; }
body.fm .ad-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-left: auto; font-size: 13px; color: var(--fm-text-2); }
body.fm .ad-legend strong { color: var(--fm-text); }
body.fm .ad-legend > span { display: inline-flex; align-items: center; gap: 6px; }
body.fm .ad-progress { display: flex; flex-direction: column; gap: 6px; padding: 8px 24px; color: var(--fm-text-2); font-size: 13px; border-bottom: 1px solid var(--fm-row-line); }
body.fm .ad-progress[hidden] { display: none; }
body.fm .ad-progress-track { height: 4px; border-radius: 4px; background: #EEEEEE; overflow: hidden; }
body.fm .ad-progress-bar { height: 100%; width: 0; background: var(--fm-blue); transition: width .3s; }
@media (prefers-reduced-motion: reduce) { body.fm .ad-progress-bar { transition: none; } }
body.fm .ad-body { flex: 1; min-height: 0; display: flex; }
body.fm .ad-matrix-wrap { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; }
body.fm .ad-loading { display: flex; align-items: center; gap: 10px; padding: 24px; color: var(--fm-text-2); }
body.fm .ad-loading[hidden], body.fm .ad-matrix[hidden] { display: none; }
body.fm .ad-matrix { flex: 1; min-height: 0; overflow: auto; }
body.fm .ad-table { border-collapse: separate; border-spacing: 0; table-layout: fixed; width: max-content; min-width: 100%; font-size: 14px; }
body.fm .ad-table th { position: sticky; top: 0; z-index: 3; height: 52px; padding: 0 8px; background: #fff; border-bottom: 1px solid var(--fm-divider); font-weight: 700; text-align: left; white-space: nowrap; }
body.fm .ad-table td { height: 48px; padding: 0 8px; border-bottom: 1px solid var(--fm-row-line); background: #fff; }
body.fm .ad-table .ad-name { position: sticky; left: 0; z-index: 2; box-shadow: inset -1px 0 0 var(--fm-divider); }
body.fm .ad-table th.ad-name { z-index: 4; }
body.fm .ad-table .ad-gear-col { position: sticky; right: 0; z-index: 2; padding: 0; text-align: center; box-shadow: inset 1px 0 0 var(--fm-row-line); }
body.fm .ad-table th.ad-gear-col { z-index: 4; }
body.fm .ad-table th.ad-proj { text-align: center; }
body.fm .ad-table th.ad-sortable { cursor: pointer; user-select: none; }
body.fm .ad-table th.ad-sortable:hover { color: var(--fm-blue); }
body.fm .ad-sort { margin-left: 4px; font-size: 10px; color: var(--fm-blue); }
body.fm .ad-proj .ad-ell { display: block; }
body.fm .ad-proj-sub { display: block; font-weight: 400; font-size: 12px; line-height: 16px; color: var(--fm-text-2); }
body.fm .ad-ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
body.fm .ad-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.fm .ad-unset { color: var(--fm-text-3); }
body.fm .ad-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
body.fm .ad-name.is-indented { padding-left: 42px; }
body.fm .ad-avatar { width: 24px; height: 24px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: var(--fm-text); }
body.fm .ad-group-row td { background: var(--fm-panel); border-bottom-color: var(--fm-divider); }
body.fm .ad-group-name { padding: 0 !important; overflow: hidden; }
body.fm .ad-group-toggle { width: 100%; height: 44px; padding: 0 8px; border: 0; background: transparent; display: flex; align-items: center; gap: 10px; font: inherit; color: var(--fm-text); cursor: pointer; text-align: left; white-space: nowrap; }
body.fm .ad-group-toggle strong { overflow: hidden; text-overflow: ellipsis; }
body.fm .ad-group-toggle strong.is-none { color: var(--fm-text-2); }
body.fm .ad-chev { width: 7px; height: 7px; border-right: 1.8px solid var(--fm-text); border-bottom: 1.8px solid var(--fm-text); transform: rotate(45deg); margin: -4px 4px 0 2px; flex: none; }
body.fm .ad-group-toggle[aria-expanded="false"] .ad-chev { transform: rotate(-45deg); margin-top: 0; }
body.fm .ad-group-icon { width: 24px; height: 24px; border-radius: 50%; background: #E6E6E6; flex: none; display: inline-flex; align-items: center; justify-content: center; }
body.fm .ad-group-icon.is-none { background: transparent; border: 1.5px dashed #BBBBBB; box-sizing: border-box; }
body.fm .ad-group-cell { text-align: center; color: var(--fm-text-2); font-size: 13px; }
body.fm .ad-cell { text-align: center; cursor: pointer; }
body.fm .ad-cell:hover { background: #FAFAFA; }
body.fm .ad-cell.is-selected { background: var(--fm-selected); box-shadow: inset 0 0 0 2px var(--fm-blue); }
body.fm .ad-cell:focus { outline: none; }
body.fm .ad-cell:focus-visible { box-shadow: inset 0 0 0 2px var(--fm-blue); }
body.fm .ad-bars { display: flex; justify-content: center; gap: 3px; }
body.fm .ad-legend .ad-bars, body.fm .ad-panel-level .ad-bars { display: inline-flex; }
body.fm .ad-bar { width: 14px; height: 6px; border-radius: 8px; background: #E6E6E6; box-sizing: border-box; }
body.fm .ad-bars.is-small .ad-bar { width: 10px; height: 5px; }
body.fm .ad-bar.is-on { background: var(--fm-blue); }
body.fm .ad-bar.is-part { background: #fff; border: 1px solid #7CC3E6; }
body.fm .ad-cell-label { display: block; margin-top: 3px; font-size: 12px; line-height: 14px; }
body.fm .ad-cell-note { display: block; margin-top: 3px; font-size: 12px; line-height: 14px; color: var(--fm-text-3); }
body.fm .ad-cell-note.is-out { color: #ABABAB; }
body.fm .ad-empty { padding: 32px 16px !important; color: var(--fm-text-2); }
body.fm .ad-gear { width: 32px; height: 32px; border: 1px solid transparent; border-radius: 2px; background: transparent; color: var(--fm-text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
body.fm .ad-gear:hover, body.fm .ad-gear[aria-expanded="true"] { border-color: var(--fm-blue); background: var(--fm-selected); }
body.fm .ad-gear-pop { position: absolute; z-index: 10; top: 50px; right: 8px; width: 340px; max-width: calc(100% - 16px); background: #fff; border-radius: 4px; box-shadow: var(--fm-shadow); display: flex; flex-direction: column; }
body.fm .ad-gear-search { position: relative; display: block; margin: 10px 10px 6px; }
body.fm .ad-gear-search svg { position: absolute; left: 10px; top: 10px; pointer-events: none; }
body.fm .ad-gear-search .fm-input { padding-left: 34px; }
body.fm .ad-gear-list { max-height: 340px; overflow-y: auto; padding-bottom: 6px; }
body.fm .ad-gear-item { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 16px; cursor: pointer; }
body.fm .ad-gear-item:hover { background: var(--fm-panel); }
body.fm .ad-gear-item input { width: 16px; height: 16px; accent-color: var(--fm-blue); flex: none; }
body.fm .ad-gear-actions { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--fm-divider); }
body.fm .ad-gear-actions button { border: 0; background: none; padding: 0; color: var(--fm-link); font: 700 14px var(--fm-font); cursor: pointer; }
body.fm .ad-gear-reset { border: 0; border-top: 1px solid var(--fm-divider); background: none; text-align: left; padding: 10px 16px; color: var(--fm-text-3); font: 400 14px var(--fm-font); cursor: pointer; }
body.fm .ad-panel { width: 460px; flex: none; border-left: 1px solid var(--fm-divider); display: flex; flex-direction: column; min-height: 0; }
body.fm .ad-panel[hidden] { display: none; }
body.fm .ad-panel-head { display: flex; gap: 8px; align-items: flex-start; padding: 16px 20px 14px; border-bottom: 1px solid var(--fm-divider); }
body.fm .ad-panel-head > div { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
body.fm .ad-panel-head strong { font-size: 18px; line-height: 24px; font-weight: 400; overflow-wrap: anywhere; }
body.fm .ad-panel-head .ad-muted { font-size: 13px; }
body.fm .ad-panel-body { flex: 1; overflow-y: auto; padding: 0 20px 16px; }
body.fm .ad-panel-grid { display: grid; grid-template-columns: minmax(0, 1fr) 84px 130px; column-gap: 8px; align-items: center; }
body.fm .ad-panel-h { height: 40px; display: flex; align-items: center; font-weight: 700; font-size: 13px; border-bottom: 1px solid var(--fm-divider); }
body.fm .ad-panel-folder { display: flex; align-items: center; gap: 8px; min-height: 44px; min-width: 0; overflow: hidden; box-sizing: border-box; padding-right: 8px; border-bottom: 1px solid var(--fm-row-line); }
body.fm .ad-panel-fname { display: flex; flex-direction: column; min-width: 0; padding: 4px 0; }
body.fm .ad-panel-parent { font-size: 12px; line-height: 16px; color: var(--fm-text-2); }
body.fm .ad-panel-folder svg { flex: none; }
body.fm .ad-panel-level { display: flex; flex-direction: column; justify-content: center; gap: 3px; min-height: 44px; font-size: 12px; border-bottom: 1px solid var(--fm-row-line); }
body.fm .ad-panel-src { display: flex; align-items: center; min-height: 44px; font-size: 13px; color: var(--fm-text-2); border-bottom: 1px solid var(--fm-row-line); }
body.fm .ad-panel-note { margin: 16px 0 0; color: var(--fm-text-2); }
@media (max-width: 900px) {
    body.fm .ad-body { flex-direction: column; }
    body.fm .ad-panel { width: auto; border-left: 0; border-top: 1px solid var(--fm-divider); max-height: 45vh; }
    body.fm .ad-legend { margin-left: 0; }
}

/* ---------- Phones and small tablets ---------- */
@media (max-width: 760px) {
    /* People to add / Members: the grid keeps readable columns and scrolls
       sideways instead of squeezing 12 columns into the screen */
    body.fm #userManagementModal .user-modal-header { padding: 12px 16px; gap: 8px; align-items: flex-start; }
    body.fm #userManagementModal .user-modal-header h3 { font-size: 24px; line-height: 32px; }
    body.fm #userManagementModal .user-modal-body { padding: 12px 16px 16px; }
    body.fm #userManagementModal .modal-table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    body.fm #userManagementModal .modal-table { min-width: 880px; }

    /* Folder access: folder tree on top, the people to drag below it */
    body.fm .it-modal { height: 100dvh; }
    body.fm .it-modal-header { padding: 12px 16px; gap: 8px; position: relative; }
    body.fm .it-modal-header h3 { font-size: 24px; line-height: 32px; padding-right: 40px; }
    body.fm .it-modal-header .it-close { position: absolute; top: 12px; right: 12px; padding: 0 8px; }
    body.fm .it-mode-wrap { width: 100%; overflow-x: auto; }
    body.fm .it-mode-subtitle { position: static; margin-top: 4px; white-space: normal; }
    body.fm .it-search-wrap, body.fm .it-search { width: 100%; }
    body.fm .it-small-btn { padding: 0 12px !important; }
    body.fm .it-content-row { flex-direction: column; }
    body.fm .it-modal-body-wrap { order: 1; min-height: 0; }
    body.fm .it-userlist-resizer { display: none; }
    body.fm #foldersUserList {
        order: 2; width: auto !important; max-height: 38%; flex-shrink: 0;
        border-top: 1px solid var(--fm-divider);
    }
    body.fm .user-list-header { padding: 12px 16px; position: static; }
    body.fm #itStatusBar { padding: 8px 16px; }

    /* Account users: full screen, table scrolls sideways */
    body.fm .account-users-modal-content { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; border: 0; border-radius: 0; }
    body.fm .account-users-modal-header { border-radius: 0; padding: 12px 16px; }
    body.fm .account-users-modal-body { padding: 12px 16px; overflow-x: auto; }
}
@media (max-width: 760px) {
    body.fm #accountUsersTable th, body.fm #accountUsersTable td { padding: 8px 10px; }
}
@media (max-width: 900px) {
    body.fm #userManagementModal .modal-table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    body.fm #userManagementModal .modal-table { min-width: 880px; }
}

/* ---------- Phones: follow-on dialogs ---------- */
@media (max-width: 760px) {
    /* Generic Forma dialogs (Import from a file, review, results): tighter, footer wraps */
    body.fm .fm-dialog-head { padding: 16px; }
    body.fm .fm-dialog-body { padding: 16px; }
    body.fm .fm-dialog-foot { padding: 12px 16px; flex-wrap: wrap; }
    body.fm .fm-format { font-size: 12px; overflow-wrap: anywhere; }
    body.fm .fm-format > div { padding: 6px 8px; }

    /* Review: what changes goes under the person instead of off-screen */
    body.fm .fm-review-row { grid-template-columns: 36px minmax(0, 1fr); padding: 6px 8px 6px 0; }
    body.fm .fm-review-row > :nth-child(n+3) { grid-column: 2; }
    body.fm .fm-review-project-head { flex-wrap: wrap; padding: 8px; }

    /* Results: project name on its own line, numbers below */
    body.fm .fm-result-row { grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 6px 0; }
    body.fm .fm-result-row > :first-child { grid-column: 1 / -1; font-weight: 600; }

    /* Copy people from another project: hub and project pickers on top, members below */
    body.fm .import-project-modal-header { padding: 12px 16px; gap: 8px; }
    body.fm .import-project-modal-header h3 { font-size: 24px; line-height: 32px; }
    body.fm .import-project-modal-body { overflow-y: auto; }
    body.fm .import-project-split { flex-direction: column; height: auto; }
    body.fm .import-project-left { width: auto; border-right: 0; border-bottom: 1px solid var(--fm-divider); }
    body.fm .import-hubs-section, body.fm .import-projects-section { height: auto; }
    body.fm .import-hubs-section .import-list { max-height: 120px; }
    body.fm .import-projects-section .import-list { max-height: 240px; }
    body.fm .import-project-right { padding: 16px; }
    body.fm .import-users-table-container { overflow-x: auto; }

    /* Folder access sync progress/results (inline-styled dialog) */
    body.fm #folderSyncModal > div { width: calc(100% - 24px) !important; max-height: 90vh !important; }
    body.fm #folderSyncModal h2 { font-size: 20px; }
    body.fm #folderSyncResultsContent { overflow-wrap: anywhere; }
}
@media (max-width: 900px) {
    body.fm .import-users-table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    body.fm .import-users-table { min-width: 880px; }
    body.fm .import-users-table th { word-break: normal; overflow-wrap: normal; }
}

/* ---------- Phone bottom sheet and action menu (shared/phone-ui.js) ---------- */
body.fm .fm-sheet-backdrop {
    position: fixed; inset: 0; z-index: 20000; background: rgba(60, 60, 60, 0);
    display: flex; align-items: flex-end; transition: background 160ms ease-out;
}
body.fm .fm-sheet-backdrop.is-open { background: rgba(60, 60, 60, 0.5); }
body.fm .fm-sheet {
    width: 100%; max-height: 88dvh; display: flex; flex-direction: column; outline: none;
    background: #fff; border-radius: 8px 8px 0 0; box-shadow: var(--fm-shadow);
    transform: translateY(24px); opacity: 0; transition: transform 180ms ease-out, opacity 120ms ease-out;
}
body.fm .fm-sheet-backdrop.is-open .fm-sheet { transform: none; opacity: 1; }
body.fm .fm-sheet-grab { width: 36px; height: 4px; border-radius: 2px; background: var(--fm-divider); margin: 8px auto 0; flex: none; }
body.fm .fm-sheet-head { display: flex; align-items: flex-start; gap: 8px; padding: 8px 8px 8px 16px; flex: none; }
body.fm .fm-sheet-title { margin: 0; flex: 1; min-width: 0; padding-top: 6px; font-size: 16px; line-height: 24px; font-weight: 700; color: var(--fm-text); overflow-wrap: break-word; }
body.fm .fm-sheet-close {
    width: 40px; height: 40px; flex: none; border: 0; background: transparent; border-radius: 2px;
    font-size: 26px; line-height: 1; color: var(--fm-text); cursor: pointer;
}
body.fm .fm-sheet-body { padding: 0 16px 12px; overflow-y: auto; min-height: 0; flex: 1; }
body.fm .fm-sheet-foot {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; flex: none;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--fm-divider);
}
body.fm .fm-sheet-foot .fm-btn-primary { margin-left: auto; min-width: 96px; height: 40px; }
body.fm .fm-action-list { display: flex; flex-direction: column; margin: 0 -16px; padding-bottom: env(safe-area-inset-bottom); }
body.fm .fm-action-item {
    min-height: 48px; padding: 0 16px; border: 0; border-top: 1px solid var(--fm-row-line); background: transparent;
    text-align: left; font: inherit; font-size: 15px; color: var(--fm-text); cursor: pointer;
}
body.fm .fm-action-item:active { background: var(--fm-panel); }
body.fm .fm-action-item.is-danger { color: var(--fm-error); }
body.fm .fm-sheet button:focus-visible, body.fm .fm-sheet input:focus-visible, body.fm .fm-sheet select:focus-visible {
    outline: 2px solid var(--fm-blue); outline-offset: 1px;
}
@media (prefers-reduced-motion: reduce) {
    body.fm .fm-sheet-backdrop, body.fm .fm-sheet { transition: none; }
}

/* ---------- Phones: People to add / Modify people as a list (phone-people.js) ---------- */
body.fm .pp, body.fm .pp-foot, body.fm .pp-more { display: none; }
body.fm .pp-add-tools { display: flex; gap: 8px; margin-bottom: 12px; }
body.fm .pp-add-tools[hidden] { display: none; }
body.fm .pp-add-tools .fm-btn { flex: 1; height: 40px; justify-content: center; gap: 8px; }
body.fm .pp-icon { display: inline-flex; }
body.fm .pp-search { margin-bottom: 4px; }
body.fm .pp-search .fm-input { width: 100%; height: 40px; font-size: 16px; }
body.fm .pp-list { list-style: none; margin: 0 -16px; padding: 0; }
body.fm .pp-row {
    width: 100%; display: flex; align-items: flex-start; gap: 12px; padding: 12px 12px 12px 16px;
    border: 0; border-bottom: 1px solid var(--fm-row-line); background: transparent;
    text-align: left; font: inherit; color: var(--fm-text); cursor: pointer;
}
body.fm .pp-row:active { background: var(--fm-selected); }
body.fm .pp-row:focus-visible { outline: 2px solid var(--fm-blue); outline-offset: -2px; }
body.fm .pp-row > svg { flex: none; align-self: center; color: var(--fm-text-3); }
body.fm .pp-avatar {
    width: 32px; height: 32px; flex: none; border-radius: 50%; margin-top: 2px;
    display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600;
}
body.fm .pp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
body.fm .pp-email { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.fm .pp-meta { font-size: 13px; line-height: 18px; color: var(--fm-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.fm .pp-meta.is-error { color: var(--fm-error); white-space: normal; }
body.fm .pp-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
body.fm .pp-tag {
    height: 22px; padding: 0 8px; border-radius: 11px; display: inline-flex; align-items: center;
    background: #EEEEEE; color: var(--fm-text); font-size: 12px; white-space: nowrap;
}
body.fm .pp-tag.is-admin { background: var(--fm-selected); color: var(--fm-link); box-shadow: inset 0 0 0 1px #9BD3EE; font-weight: 600; }
body.fm .pp-empty { margin: 24px 0; color: var(--fm-text-2); text-align: center; }
body.fm .pp-empty[hidden] { display: none; }
body.fm .pp-foot {
    align-items: center; gap: 12px; flex: none;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--fm-divider); background: #fff;
}
body.fm .pp-count { color: var(--fm-text-2); }
body.fm .pp-foot .fm-btn-primary { margin-left: auto; height: 40px; padding: 0 20px; }

/* The person sheet; 16px inputs so iOS Safari does not zoom in on focus */
body.fm .pp-form { display: flex; flex-direction: column; gap: 12px; }
body.fm .pp-field { display: flex; flex-direction: column; gap: 4px; }
body.fm .pp-field-label { font-size: 13px; color: var(--fm-text-2); }
body.fm .pp-field .fm-input { width: 100%; height: 40px; font-size: 16px; }
body.fm .pp-field-error { font-size: 13px; color: var(--fm-error); }
body.fm .pp-field-error:empty { display: none; }
body.fm .pp-switches { display: flex; flex-direction: column; margin-top: 4px; }
body.fm .pp-switch {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    min-height: 48px; border-top: 1px solid var(--fm-row-line); cursor: pointer;
}
body.fm .pp-switch.is-admin { font-weight: 600; border-top: 0; }
body.fm .pp-switch-input {
    appearance: none; -webkit-appearance: none; flex: none; margin: 0; cursor: pointer;
    width: 40px; height: 22px; border-radius: 11px; background: #BBBBBB; position: relative; transition: background 120ms;
}
body.fm .pp-switch-input::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
    background: #fff; transition: transform 120ms;
}
body.fm .pp-switch-input:checked { background: var(--fm-blue); }
body.fm .pp-switch-input:checked::after { transform: translateX(18px); }
body.fm .pp-switch-input:disabled { opacity: 0.5; cursor: not-allowed; }
body.fm .pp-switch-input:focus-visible { outline: 2px solid var(--fm-blue); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
    body.fm .pp-switch-input, body.fm .pp-switch-input::after { transition: none; }
}

/* Phones and touch tablets: the list and person sheet instead of the grid */
@media (max-width: 600px), (pointer: coarse) {
    body.fm #userManagementModal .modal-table-actions,
    body.fm #userManagementModal .modal-filter-status,
    body.fm #userManagementModal .modal-table-container,
    body.fm #userManagementModal .fm-stepper { display: none; }
    body.fm #userManagementModal .user-modal-header { flex-wrap: nowrap; padding: 12px 8px 12px 16px; gap: 4px; }
    body.fm #userManagementModal .user-modal-body { gap: 0; padding-bottom: 0; }
    body.fm .pp { display: block; }
    body.fm .pp-foot { display: flex; }
    body.fm .pp-more:not([hidden]) { display: inline-flex; }
}

/* ---------- Folder access: phone pieces (folders-indented-tree.js) ---------- */
/* Touch tablets: people are added with + Add on a folder, so the drag panel goes */
@media (pointer: coarse) {
    body.fm #foldersUserList, body.fm .it-userlist-resizer, body.fm .it-zoom-hint { display: none !important; }
}
/* Bottom sheets on wider screens (tablets): a readable width, centred */
@media (min-width: 601px) {
    body.fm .fm-sheet-backdrop { justify-content: center; }
    body.fm .fm-sheet { max-width: 560px; }
}
body.fm .it-more-btn, body.fm .it-phone-foot { display: none; }
body.fm .it-level-option.it-level-remove { color: var(--fm-error); border-top: 1px solid var(--fm-row-line); margin-top: 6px; padding-left: 124px; }
body.fm .it-add-btn {
    height: 28px; padding: 0 12px; border: 1px solid var(--fm-border); border-radius: 2px; background: #fff;
    font: inherit; font-size: 13px; font-weight: 600; color: var(--fm-text); cursor: pointer; white-space: nowrap;
}
body.fm .it-add-btn:active { background: var(--fm-panel); }
body.fm .it-add-sheet { display: flex; flex-direction: column; gap: 12px; }
/* Forma tabs, over the tree's own pill-style .it-segmented (injected, hence !important) */
body.fm .it-add-sheet .it-segmented { display: flex; gap: 20px; border: 0 !important; border-bottom: 1px solid var(--fm-divider) !important; background: transparent !important; padding: 0 !important; border-radius: 0 !important; }
body.fm .it-add-sheet .it-seg-btn {
    height: 40px; padding: 0 4px !important; border: 0; border-radius: 0 !important; background: transparent !important;
    font: inherit; font-size: 14px !important; color: var(--fm-text-2) !important; cursor: pointer; box-shadow: none;
}
body.fm .it-add-sheet .it-seg-btn.active { color: var(--fm-text) !important; font-weight: 700 !important; box-shadow: inset 0 -2px 0 var(--fm-blue); }
body.fm .it-add-sheet .fm-input { width: 100%; height: 40px; font-size: 16px; }
body.fm .it-add-list { list-style: none; margin: 0 -16px; padding: 0; }
body.fm .it-add-item {
    display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 16px;
    border-bottom: 1px solid var(--fm-row-line); cursor: pointer;
}
body.fm .it-add-item .fm-cb { width: 20px; height: 20px; flex: none; }
body.fm .it-add-item .pu-avatar { flex: none; }
body.fm .it-add-item.is-disabled { cursor: default; }
body.fm .it-add-item.is-disabled .it-add-text { color: var(--fm-text-3); }
body.fm .it-add-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
body.fm .it-add-name, body.fm .it-add-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.fm .it-add-sub { font-size: 13px; color: var(--fm-text-2); }
body.fm .it-add-has { font-size: 12px; color: var(--fm-text-3); flex: none; }
body.fm .it-add-none { padding: 16px; color: var(--fm-text-2); }
body.fm .it-add-error { flex-basis: 100%; }
body.fm .it-add-level-wrap { display: flex; align-items: center; gap: 8px; color: var(--fm-text-2); min-width: 0; flex: 1; }
body.fm .it-add-level { flex: 1; min-width: 0; height: 40px; font-size: 16px; }

@media (max-width: 600px), (pointer: coarse) and (max-height: 500px) {
    body.fm #itExpandAllBtn, body.fm #itCollapseAllBtn, body.fm #itCleanBtn, body.fm #itSyncBtn,
    body.fm #foldersUserList, body.fm .it-userlist-resizer { display: none !important; }
    body.fm .it-more-btn {
        display: inline-flex; align-items: center; justify-content: center; position: absolute; top: 12px; right: 52px;
        width: 36px; height: 36px; border: 0; background: transparent; font-size: 22px; color: var(--fm-text); cursor: pointer;
    }
    body.fm .it-modal-header h3 { padding-right: 88px; }
    body.fm .it-phone-foot {
        display: flex; flex: none; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--fm-divider); background: #fff;
    }
    body.fm .it-phone-foot .fm-btn-primary { flex: 1; height: 40px; }
    body.fm #itStatusBar:not(:has(.it-progress-wrap)) { display: none; }
}

/* ---------- Account users on phones: people list and person sheet (access-dashboard.js) ---------- */
body.fm .adp-list, body.fm .ad-more { display: none; }
body.fm .adp-list { list-style: none; margin: 0; padding: 0; flex: 1; min-height: 0; overflow-y: auto; }
body.fm .adp-group {
    width: 100%; min-height: 52px; padding: 0 16px; display: flex; align-items: center; gap: 10px;
    border: 0; border-bottom: 1px solid var(--fm-row-line); background: var(--fm-panel);
    font: inherit; color: var(--fm-text); text-align: left; cursor: pointer;
}
body.fm .adp-group strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.fm .adp-group strong.is-none { font-weight: 400; font-style: italic; color: var(--fm-text-2); }
body.fm .adp-group .ad-muted { margin-left: auto; flex: none; }
body.fm .adp-group[aria-expanded="false"] .ad-chev { transform: rotate(-45deg); margin-top: 0; }
body.fm .adp-person {
    width: 100%; display: flex; align-items: flex-start; gap: 12px; padding: 12px 12px 12px 16px;
    border: 0; border-bottom: 1px solid var(--fm-row-line); background: #fff;
    font: inherit; color: var(--fm-text); text-align: left; cursor: pointer;
}
body.fm .adp-list.is-grouped .adp-person { padding-left: 40px; }
body.fm .adp-person:active { background: var(--fm-selected); }
body.fm .adp-person:focus-visible, body.fm .adp-group:focus-visible { outline: 2px solid var(--fm-blue); outline-offset: -2px; }
body.fm .adp-person .ad-avatar { width: 32px; height: 32px; font-size: 12px; margin-top: 2px; }
body.fm .adp-chevron { flex: none; align-self: center; color: var(--fm-text-3); }
body.fm .adp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
body.fm .adp-email { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.fm .adp-meta { font-size: 13px; line-height: 18px; color: var(--fm-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.fm .adp-empty { padding: 24px 16px; text-align: center; color: var(--fm-text-2); }

/* Person sheet: projects with their highest access, unfolding into folders */
body.fm .adp-sheet-meta { margin: 0 0 8px; color: var(--fm-text-2); }
body.fm .adp-projects, body.fm .adp-folders { list-style: none; margin: 0; padding: 0; }
body.fm .adp-projects { margin: 0 -16px; border-top: 1px solid var(--fm-row-line); }
body.fm .adp-proj { border-bottom: 1px solid var(--fm-row-line); }
body.fm .adp-proj-head { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 16px; }
body.fm summary.adp-proj-head { cursor: pointer; list-style: none; }
body.fm summary.adp-proj-head::-webkit-details-marker { display: none; }
body.fm summary.adp-proj-head::before {
    content: ""; flex: none; width: 7px; height: 7px; margin: 0 2px 0 -2px;
    border-right: 1.8px solid var(--fm-text); border-bottom: 1.8px solid var(--fm-text); transform: rotate(-45deg);
}
body.fm details[open] > summary.adp-proj-head::before { transform: rotate(45deg); margin-top: -4px; }
body.fm div.adp-proj-head { padding-left: 33px; }
body.fm summary.adp-proj-head:focus-visible { outline: 2px solid var(--fm-blue); outline-offset: -2px; }
body.fm .adp-proj-name { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
body.fm .adp-level { display: inline-flex; align-items: center; gap: 6px; flex: none; font-size: 13px; }
body.fm .adp-level .ad-bars { display: inline-flex; }
body.fm .adp-folders { background: var(--fm-panel); }
body.fm .adp-folder { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 16px; border-top: 1px solid var(--fm-row-line); }
body.fm .adp-folder-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
body.fm .adp-folder-name { overflow-wrap: anywhere; }
body.fm .adp-choose { display: flex; flex-direction: column; margin: 0 -16px; }
body.fm .adp-choose-item { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 16px; border-bottom: 1px solid var(--fm-row-line); cursor: pointer; }
body.fm .adp-choose-item .fm-cb { width: 20px; height: 20px; flex: none; }

/* Phones and touch tablets: the people list instead of the matrix */
@media (max-width: 600px), (pointer: coarse) {
    body.fm #adRefresh, body.fm #adExport, body.fm #adCount, body.fm .ad-zoom, body.fm .ad-zoom-hint,
    body.fm .ad-legend, body.fm #adMatrix, body.fm #adPanel, body.fm #adSub,
    body.fm .ad-progress > span { display: none !important; }
    /* dvh: the visible screen, not the taller 100vh of iPhone Safari; the people
       area may shrink below its content, so the list scrolls instead of overflowing */
    body.fm .ad-dialog { height: 100dvh; }
    body.fm .ad-matrix-wrap { min-height: 0; }
    body.fm .ad-head { align-items: center; }
    body.fm .ad-progress { padding: 0 16px 8px; border-bottom: 0; }
    body.fm .ad-head { padding: 12px 8px 12px 16px; flex-wrap: nowrap; gap: 8px; }
    body.fm .ad-head-text { flex: 1 1 auto; }
    body.fm .ad-head .fm-dialog-title { font-size: 24px; line-height: 32px; }
    body.fm .ad-head-actions { gap: 0; }
    body.fm .ad-head-actions .fm-dialog-close { margin-left: 0; }
    body.fm .ad-more { display: inline-flex; font-size: 22px; }
    body.fm .ad-toolbar { padding: 4px 16px 12px; gap: 8px; }
    body.fm .ad-tabs { width: 100%; }
    body.fm .ad-search { flex: 1 1 100%; }
    body.fm .ad-search .fm-input { width: 100%; height: 40px; font-size: 16px; }
    body.fm .adp-list { display: block; }
}
/* Touch tablets: room for the tabs beside the search */
@media (pointer: coarse) and (min-width: 601px) {
    body.fm .ad-toolbar { flex-wrap: nowrap; gap: 24px; }
    body.fm .ad-tabs { width: auto; flex: none; }
    body.fm .ad-search { flex: 1 1 auto; max-width: 480px; }
}
/* Phone held sideways: little height, so a smaller title and the tabs beside the search */
@media (pointer: coarse) and (max-height: 500px) {
    body.fm .ad-head { padding: 4px 8px 4px 16px; }
    body.fm .ad-head .fm-dialog-title { font-size: 20px; line-height: 28px; }
    body.fm .ad-toolbar { flex-wrap: nowrap; padding: 4px 16px 8px; gap: 16px; }
    body.fm .ad-tabs { width: auto; flex: none; }
    body.fm .ad-search { flex: 1 1 auto; }
}
