.ms-workspace,.ms-settings{color:var(--text)}
.ms-workspace .section-heading h2,.ms-settings h2{margin:0}.ms-workspace .section-heading p{margin:5px 0 0}
.ms-tabs,.ms-filters,.ms-document-actions,.ms-connection,.ms-document-meta,.ms-pagination{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:16px 0}
.ms-tabs{border-bottom:1px solid var(--line);padding-bottom:12px}.ms-tabs select{margin-left:auto;max-width:260px}
.ms-tabs .tab{white-space:nowrap}.ms-filters input,.ms-filters select,.ms-tabs select,.ms-ref select,.ms-ref input{border:1px solid var(--line);border-radius:8px;padding:9px 11px;background:var(--input-bg);color:var(--text);max-width:100%;min-width:0}
.ms-filters input[type=search]{flex:1;min-width:190px}.ms-filters label{display:flex;gap:6px;align-items:center;font-size:13px}
.ms-note{padding:14px 16px;border:1px solid var(--line);background:var(--surface-soft);border-radius:10px;font-size:13px;line-height:1.6}
.ms-table-scroll{overflow:auto;border:1px solid var(--line);border-radius:10px}.ms-table-scroll table{width:100%;border-collapse:collapse;background:var(--surface);text-align:left}
.ms-table-scroll :is(th,td){padding:11px 14px;border-bottom:1px solid var(--line);vertical-align:top}.ms-table-scroll th{font-size:12px;color:var(--muted);font-weight:600}.ms-table-scroll tr:last-child td{border-bottom:0}
.ms-table-scroll .table-sub{max-width:320px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ms-status{display:inline-block;font-size:11px;font-weight:600;border-radius:6px;padding:5px 8px;background:var(--surface-soft);white-space:nowrap;color:var(--muted)}
.ms-synced{color:var(--green);background:var(--green-soft)}.ms-conflict .ms-status,.ms-status.ms-conflict{color:var(--amber)}.ms-status.ms-error,.ms-error{color:var(--red)}.ms-error{display:block;font-size:12px;max-width:300px;margin-top:6px}
.ms-pagination{justify-content:flex-end}.ms-pagination span{margin-right:auto;color:var(--muted);font-size:13px}
.ms-form-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:15px}.ms-form-grid .field{margin:0;min-width:0}.ms-form-grid textarea{min-height:75px}.ms-checkbox{display:flex;gap:8px;align-items:center;font-size:13px;min-height:40px}
.ms-document-meta{font-size:12px;color:var(--muted);margin-top:0}.ms-document-actions{padding-bottom:14px;border-bottom:1px solid var(--line)}
.ms-object{border:1px solid var(--line);border-radius:10px;padding:15px;margin:20px 0;min-width:0}.ms-object legend{padding:0 6px;font-size:13px;font-weight:600}
.ms-array{margin:22px 0}.ms-array h3{font-size:15px}.ms-array .field{font-size:12px;min-width:90px}.ms-array input{min-width:75px;width:100%;font-size:13px}.ms-array .ms-ref{min-width:200px}.ms-array .ms-ref input{font-size:12px}.ms-array td{padding:8px}.ms-ref{display:grid;gap:6px;min-width:0}.ms-ref select{width:100%;font-size:13px}.ms-ref input{font-size:12px;width:100%}
.ms-ref-options{min-width:0;max-width:100%;max-height:min(260px,40dvh);overflow:auto;overscroll-behavior:contain;border:1px solid var(--line);border-radius:8px;background:var(--surface)}
.ms-ref-options[hidden]{display:none}.ms-ref-option{display:grid;gap:3px;width:100%;min-width:0;min-height:44px;border:0;border-bottom:1px solid var(--line);padding:10px 12px;background:transparent;color:var(--text);text-align:left;white-space:normal;overflow-wrap:anywhere;cursor:pointer;font:inherit}
.ms-ref-option:last-child{border-bottom:0}.ms-ref-option[aria-selected=true],.ms-ref-option:not(:disabled):hover{background:var(--surface-soft)}.ms-ref-option:disabled{color:var(--muted);cursor:default}.ms-ref-option small,.ms-ref-status{color:var(--muted);font-size:11px;line-height:1.5;overflow-wrap:anywhere}.ms-ref-status:empty{display:none}.ms-ref input[aria-invalid=true]{border-color:var(--red)}
.ms-readonly{border:1px solid var(--line);border-radius:8px;padding:12px;margin:15px 0;font-size:12px;overflow-wrap:anywhere}.ms-readonly summary{font-weight:600;cursor:pointer;font-size:13px}.ms-readonly>div{margin:7px 0}.ms-readonly div>div{padding-left:12px}
.ms-conflict{background:var(--surface-soft);border:1px solid var(--amber);border-radius:10px;padding:18px;margin:15px 0}.ms-conflict .button{margin:12px 8px 0 0}
.ms-diff{font-size:12px}.ms-diff th{min-width:150px}.ms-diff td{min-width:200px;max-width:500px;overflow-wrap:anywhere;white-space:pre-wrap}
.ms-history{margin-top:25px;border-top:1px solid var(--line);padding-top:15px}.ms-history>details{margin:8px 0;padding:10px;border-bottom:1px solid var(--line)}.ms-history summary{font-size:13px;cursor:pointer}.ms-history .ms-table-scroll{margin-top:12px}
.ms-settings{max-width:1000px}.ms-settings form{display:grid;gap:14px;max-width:620px;margin:20px 0}.ms-settings form .button{justify-self:start}.ms-connection{justify-content:space-between;padding:15px 0;border-block:1px solid var(--line);font-size:13px}
.ms-report{background:var(--surface-soft);border:1px solid var(--line);border-radius:10px;padding:16px;margin:18px 0}.ms-report>summary{cursor:pointer;font-weight:600}.ms-report-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px}.ms-report-grid article{padding:15px;border:1px solid var(--line);border-radius:8px;background:var(--surface)}.ms-report-grid h3{font-size:14px;margin:0 0 12px}.ms-report-grid dl{display:grid;grid-template-columns:1fr auto;font-size:13px;gap:8px;margin:0}.ms-report-grid dd{margin:0;font-variant-numeric:tabular-nums}
@media(max-width:900px){.ms-form-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.ms-tabs{overflow:auto;flex-wrap:nowrap}.ms-table-scroll .button{font-size:11px;padding:6px 9px}.ms-settings .section-heading{align-items:flex-start}}
@media(max-width:560px){.ms-form-grid{grid-template-columns:1fr}.ms-filters{align-items:stretch}.ms-filters input[type=search]{flex-basis:100%}.ms-workspace>.section-heading{align-items:flex-start;gap:12px}.ms-workspace>.section-heading h2{font-size:20px}.ms-document-actions .button{font-size:12px}.ms-pagination{gap:7px}.ms-tabs select{flex-shrink:0}}

/* Catalogs and document forms share the workspace's theme tokens. */
.ms-workspace { width:100%; max-width:none; min-width:0; }
.ms-page-heading { align-items:flex-start; margin-bottom:20px; }
.ms-page-heading>div { min-width:0; }
.ms-workspace .ms-page-heading p { max-width:680px; color:var(--muted); line-height:1.65; }
.ms-workspace .ms-page-heading .ms-eyebrow { display:block; margin:0 0 7px; color:var(--muted); font-size:10px; font-weight:650; letter-spacing:1.1px; text-transform:uppercase; }
.ms-workspace .button,.ms-dialog .button,.ms-workspace .tab { min-height:44px; }
.ms-workspace .ms-tabs select { min-height:44px; }
.ms-list-card.card { background:var(--surface); border-radius:var(--radius); }
.ms-list-toolbar { display:flex; align-items:flex-end; flex-wrap:wrap; gap:12px; margin:0; padding:18px 20px; border-bottom:1px solid var(--line); background:var(--surface); }
.ms-list-toolbar .field { display:block; margin:0; min-width:0; color:var(--muted); font-size:12px; }
.ms-list-toolbar .ms-search { flex:1 1 260px; }
.ms-list-toolbar input,.ms-list-toolbar select { min-height:44px; max-width:100%; border:1px solid var(--line); border-radius:8px; padding:10px 12px; color:var(--text); background:var(--input-bg); font-size:13px; }
.ms-list-toolbar select { min-width:150px; }
.ms-list-count { padding:12px 20px; color:var(--muted); font-size:12px; font-variant-numeric:tabular-nums; }
.ms-list-card>.ms-table-scroll { max-width:100%; border:0; border-radius:0; }
.ms-list-card .ms-table-scroll :is(th,td) { vertical-align:middle; }
.ms-list-card .ms-table-scroll th { padding-block:13px; background:var(--surface-soft); white-space:nowrap; }
.ms-list-card .ms-table-scroll td { padding-block:14px; font-size:13px; }
.ms-list-card .ms-table-scroll tbody tr:hover { background:var(--surface-soft); }
.ms-list-name { display:flex; align-items:center; gap:11px; min-width:0; color:var(--text); text-align:left; line-height:1.5; }
.ms-list-name>div,.ms-list-name>span:not(.ms-kind-icon) { min-width:0; overflow-wrap:anywhere; }
.ms-list-name strong { display:block; font-size:13px; font-weight:600; }
.ms-list-name .text-btn { min-height:44px; padding-block:4px; font-size:13px; font-weight:600; text-align:left; white-space:normal; }
.ms-kind-icon { display:inline-flex; align-items:center; justify-content:center; flex:0 0 36px; width:36px; height:36px; border:1px solid var(--line); border-radius:10px; background:var(--surface-soft); color:var(--blue); font-size:16px; font-weight:600; }
.ms-cell-number { text-align:right; white-space:nowrap; font-variant-numeric:tabular-nums; }
.ms-empty { padding:44px 22px; text-align:center; color:var(--muted); line-height:1.7; }
.ms-empty strong { display:block; margin-bottom:7px; color:var(--text); font-size:15px; font-weight:600; }
.ms-empty h3 { color:var(--text); font-size:15px; }
.ms-empty p { max-width:440px; margin:0 auto; font-size:13px; }
.ms-empty .button { margin-top:16px; }
.ms-list-card .ms-pagination { margin:0; padding:15px 20px; border-top:1px solid var(--line); }
.ms-list-card .ms-table-scroll .button { min-height:44px; padding:9px 12px; font-size:12px; }

.ms-catalog-layout { display:grid; grid-template-columns:250px minmax(0,1fr); align-items:start; gap:20px; }
.ms-catalog-layout>.ms-list-card { min-width:0; }
.ms-folder-sidebar.card { min-width:0; margin:0; padding:18px 14px; background:var(--surface); border-radius:var(--radius); }
.ms-folder-heading { display:grid; gap:12px; padding:0 4px 16px; border-bottom:1px solid var(--line); }
.ms-folder-heading h3 { margin:0; color:var(--text); font-size:14px; font-weight:600; }
.ms-folder-heading .button { width:100%; font-size:12px; }
.ms-folder-sidebar nav { max-height:480px; margin:12px 0; overflow:auto; overscroll-behavior:contain; }
.ms-folder-tree,.ms-folder-tree ul { display:grid; gap:3px; margin:0; padding:0; list-style:none; }
.ms-folder-tree ul { margin-left:14px; padding-left:8px; border-left:1px solid var(--line); }
.ms-folder-tree li { min-width:0; }
.ms-folder-button { display:flex; align-items:center; gap:8px; width:100%; min-height:44px; border:1px solid transparent; border-radius:8px; padding:9px 10px; color:var(--text); background:transparent; font:inherit; font-size:12px; text-align:left; line-height:1.5; cursor:pointer; overflow-wrap:anywhere; }
.ms-folder-button>span:first-child { flex:0 0 17px; color:var(--muted); }
.ms-folder-button>span:last-child { min-width:0; }
.ms-folder-button svg { width:16px; height:16px; }
.ms-folder-button:hover { background:var(--surface-soft); }
.ms-folder-button.active { border-color:var(--line); background:var(--surface-soft); color:var(--blue); font-weight:600; }
.ms-folder-button.active>span:first-child { color:var(--blue); }
.ms-folder-tree ul[hidden] { display:none; }
.ms-folder-button .ms-folder-chevron { flex:0 0 12px; width:12px; font-size:20px; line-height:1; text-align:center; transition:transform .15s ease; }
.ms-folder-button .ms-folder-chevron.is-expanded { transform:rotate(90deg); }
.ms-folder-selection { display:grid; gap:12px; padding:16px 4px 0; border-top:1px solid var(--line); }
.ms-folder-selection>strong { overflow-wrap:anywhere; font-size:12px; line-height:1.6; }
.ms-folder-selection .toolbar-group { display:grid; gap:8px; }
.ms-folder-selection .button { font-size:12px; }
.ms-folder-selection>p,.ms-folder-hint { margin:0; font-size:11px; line-height:1.7; }
.ms-folder-hint { padding:16px 4px 0; }
.ms-list-toolbar .ms-deleted-filter { align-self:center; min-height:44px; color:var(--muted); font-size:12px; }
.ms-list-toolbar .ms-deleted-filter input { flex:0 0 17px; width:17px; min-height:17px; margin:0; padding:0; accent-color:var(--blue); }
.ms-dialog [data-ms=delete] { color:var(--red); }
.ms-dialog [data-ms=delete]:disabled { opacity:.55; cursor:wait; }

.modal.ms-dialog { width:min(1180px,calc(100vw - 32px)); max-height:92dvh; background:var(--surface); color:var(--text); border-color:var(--line); }
.modal.ms-dialog>.modal-body { overflow:visible; }
.ms-document-header { display:flex; align-items:flex-start; justify-content:space-between; flex-wrap:wrap; gap:16px; margin-bottom:18px; padding:16px 18px; border:1px solid var(--line); border-radius:var(--radius); background:var(--surface-soft); }
.ms-document-header .ms-document-meta { flex:1 1 240px; margin:0; align-self:center; line-height:1.7; }
.ms-document-total { display:grid; gap:4px; min-width:0; margin-left:auto; text-align:right; overflow-wrap:anywhere; font-variant-numeric:tabular-nums; }
.ms-document-total>span,.ms-document-total>small { color:var(--muted); font-size:12px; }
.ms-document-total strong { color:var(--text); font-size:25px; font-weight:650; letter-spacing:-.4px; line-height:1.25; }
.ms-derive { margin:0 0 20px; min-width:0; }
.ms-derive>summary { width:fit-content; max-width:100%; min-height:44px; padding:11px 14px; border:1px solid var(--line); border-radius:8px; background:var(--surface); color:var(--text); font-size:13px; font-weight:500; cursor:pointer; }
.ms-derive>summary:hover { background:var(--surface-soft); }
.ms-derive>p { margin-top:10px; font-size:12px; line-height:1.6; }
.ms-derive-options { display:flex; flex-wrap:wrap; gap:8px; padding-top:12px; }
.ms-document-form { display:grid; gap:20px; min-width:0; }
.ms-document-form>.error-message { margin:0; }
.ms-form-fields { display:grid; gap:20px; min-width:0; margin:0; padding:0; border:0; }
.ms-form-section { min-width:0; padding:20px; border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); }
.ms-form-section>h3 { margin:0; color:var(--text); font-size:16px; }
.ms-form-section>p.muted { margin:7px 0 18px; font-size:12px; line-height:1.6; }
.ms-form-section>.ms-form-grid { margin-top:18px; }
.ms-form-section>p.muted+.ms-form-grid { margin-top:0; }
.ms-document-form .ms-form-section>.field { margin-top:18px; }
.ms-document-form .field { margin:0; min-width:0; color:var(--muted); font-size:12px; font-weight:500; }
.ms-field-label { display:block; margin-bottom:7px; line-height:1.5; }
.ms-required { color:var(--red); }
.ms-document-form :is(input:not([type=checkbox]):not([type=radio]),select,textarea) { width:100%; min-width:0; max-width:100%; min-height:44px; margin-top:0; border:1px solid var(--line); border-radius:8px; padding:10px 11px; background:var(--input-bg); color:var(--text); font-size:13px; font-weight:400; }
.ms-document-form textarea { min-height:90px; line-height:1.6; resize:vertical; }
.ms-document-form :is(input,select,textarea):disabled,.ms-document-form input[readonly] { background:var(--surface-soft); color:var(--muted); }
.ms-document-form .ms-checkbox { display:flex; align-items:center; gap:9px; min-height:44px; color:var(--text); font-weight:400; }
.ms-document-form .ms-checkbox input { flex:0 0 18px; width:18px; min-width:18px; height:18px; min-height:18px; margin:0; padding:0; accent-color:var(--blue); }
.ms-document-form .ms-checkbox .ms-field-label { margin:0; }
.ms-document-form .ms-ref { gap:7px; min-width:0; }
.ms-document-form .ms-ref :is(input,select) { font-size:13px; }
.ms-document-form .ms-ref input::placeholder,.ms-list-toolbar input::placeholder { color:var(--muted); opacity:1; }
.ms-document-form .ms-object { margin:18px 0 0; background:var(--surface); }
.ms-document-form>.ms-object { margin:0; }
.ms-advanced { min-width:0; border:1px solid var(--line); border-radius:var(--radius); background:var(--surface-soft); }
.ms-advanced>summary { min-height:48px; padding:14px 18px; color:var(--text); font-size:13px; font-weight:600; cursor:pointer; }
.ms-advanced>p { padding:0 18px 16px; font-size:12px; line-height:1.6; }
.ms-advanced-content { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:18px; min-width:0; padding:18px; border-top:1px solid var(--line); }
.ms-advanced-content>.ms-object,.ms-advanced-content>.ms-array,.ms-advanced-content>.ms-readonly { grid-column:1/-1; margin:0; }
.ms-form-notes { min-width:0; }
.ms-form-notes textarea { min-height:110px; }
.ms-form-footer.modal-foot { position:sticky; bottom:0; z-index:2; display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:14px; margin:0; padding:16px 0; border-top:1px solid var(--line); background:var(--surface); }
.ms-form-footer>span { flex:1 1 230px; font-size:11px; line-height:1.6; }
.ms-form-footer>.toolbar-group { display:flex; flex-wrap:wrap; gap:8px; margin-left:auto; }
.ms-form-footer .button { min-width:100px; }
.ms-document-form :is(input,select,textarea,summary,button) { scroll-margin-block:16px 96px; }

.ms-document-form .ms-array { min-width:0; margin:0; }
.ms-document-form .ms-array>h3 { margin-bottom:12px; }
.ms-array>.ms-table-scroll { max-width:100%; margin-bottom:12px; overscroll-behavior-x:contain; }
.ms-array .ms-table-scroll table { min-width:560px; }
.ms-array .ms-table-scroll th { background:var(--surface-soft); }
.ms-array .ms-table-scroll td { padding:12px; }
.ms-array .button { min-height:44px; padding:9px 12px; font-size:12px; white-space:nowrap; }
.ms-array-empty { padding:18px; border:1px dashed var(--line); border-radius:9px; color:var(--muted); background:var(--surface-soft); font-size:13px; line-height:1.6; }
.ms-cell-field { position:relative; }
.ms-cell-field>.ms-field-label { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); clip-path:inset(50%); white-space:nowrap; border:0; }
.ms-positions .ms-table-scroll table { min-width:850px; }
.ms-positions .ms-table-scroll :is(th,td):first-child { width:34%; min-width:240px; }
.ms-positions .ms-table-scroll :is(th,td):nth-child(2),.ms-positions .ms-table-scroll :is(th,td):nth-child(3) { min-width:110px; }
.ms-positions .ms-table-scroll :is(th,td):last-child { width:1%; }
.ms-position-options { min-width:220px; }
.ms-position-options>summary { min-height:44px; padding:11px 10px; border:1px solid var(--line); border-radius:8px; color:var(--text); background:var(--surface-soft); cursor:pointer; font-size:12px; font-weight:500; }
.ms-position-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; width:clamp(260px,30vw,400px); margin-top:14px; padding:14px; border:1px solid var(--line); border-radius:9px; background:var(--surface); }
.ms-position-fields .field,.ms-position-fields .ms-ref { min-width:0; }
.ms-position-fields .ms-field-label { position:static; width:auto; height:auto; margin:0 0 7px; padding:0; overflow:visible; clip:auto; clip-path:none; white-space:normal; }
.ms-position-fields .ms-checkbox .ms-field-label { margin:0; }
.ms-technical { min-width:0; color:var(--muted); }
.ms-technical.ms-readonly { margin:0; background:var(--surface-soft); }
.ms-technical>summary { min-height:44px; padding-block:11px; }
details.ms-history { margin-top:22px; }
details.ms-history>summary { min-height:44px; padding-block:11px; color:var(--text); font-weight:600; }
.ms-history>p { margin:12px 0; }
.ms-workspace :is(button,input,select,textarea,summary):focus-visible,.ms-dialog :is(button,input,select,textarea,summary):focus-visible { outline:2px solid var(--blue); outline-offset:3px; box-shadow:none; }

@media(max-width:900px) {
  .ms-catalog-layout { grid-template-columns:210px minmax(0,1fr); gap:14px; }
  .ms-document-form .ms-form-grid,.ms-advanced-content { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .ms-page-heading { flex-wrap:wrap; }
  .ms-list-toolbar { padding:16px; }
  .ms-form-section { padding:18px; }
}
@media(max-width:600px) {
  .ms-catalog-layout { grid-template-columns:minmax(0,1fr); }
  .ms-folder-sidebar.card { padding:14px; }
  .ms-folder-heading { display:flex; align-items:center; justify-content:space-between; gap:10px; }
  .ms-folder-heading .button { width:auto; }
  .ms-folder-sidebar nav { max-height:240px; }
  .ms-folder-selection .toolbar-group { display:flex; flex-wrap:wrap; }
  .ms-workspace .ms-page-heading { align-items:stretch; gap:15px; }
  .ms-page-heading>.button { width:100%; }
  .ms-list-toolbar { align-items:stretch; gap:12px; padding:14px; }
  .ms-list-toolbar .ms-search { flex-basis:100%; }
  .ms-list-toolbar .field:not(.ms-search) { flex:1 1 140px; }
  .ms-list-toolbar select { min-width:0; width:100%; }
  .ms-list-count { padding:10px 14px; font-size:11px; }
  .ms-list-card .ms-table-scroll .responsive-records { min-width:0; }
  .ms-list-card .responsive-records tbody { padding-inline:14px; }
  .ms-list-card .responsive-records tbody td { padding:6px 0; }
  .ms-list-card .responsive-records td:first-child { padding-bottom:12px; }
  .ms-list-card .responsive-records .ms-cell-number { text-align:left; white-space:normal; }
  .ms-list-card .responsive-records .ms-list-name .table-sub { margin:4px 0 0; white-space:normal; }
  .ms-list-card .ms-pagination { padding:14px; }
  .ms-list-card .ms-pagination>span { flex-basis:100%; }
  .modal.ms-dialog { width:calc(100vw - 20px); max-height:calc(100dvh - 20px); }
  .ms-document-header { gap:14px; padding:14px; }
  .ms-document-header .ms-document-meta { flex-basis:100%; gap:8px; }
  .ms-document-total { margin-left:0; text-align:left; }
  .ms-document-total strong { font-size:23px; }
  .ms-document-form,.ms-form-fields { gap:16px; }
  .ms-document-form .ms-form-grid,.ms-advanced-content { grid-template-columns:minmax(0,1fr); gap:16px; }
  .ms-form-section { padding:16px; }
  .ms-advanced-content { padding:14px; }
  .ms-form-footer.modal-foot { padding-bottom:max(14px,env(safe-area-inset-bottom,0px)); }
  .ms-form-footer>span { flex-basis:100%; }
  .ms-form-footer>.toolbar-group { width:100%; margin-left:0; }
  .ms-form-footer .button { flex:1 1 auto; }
  .ms-derive>summary { width:100%; }
  .ms-derive-options>.button { flex:1 1 auto; }
  .ms-position-fields { grid-template-columns:minmax(0,1fr); width:260px; }
  .ms-empty { padding:32px 18px; }
}

/* Document views and linked CRM cards use the same controls as Leads. */
.ms-view-toolbar.page-toolbar { margin:0; padding:16px 20px; border-bottom:1px solid var(--line); justify-content:space-between; }
.ms-view-toolbar .deal-view-switch { background:var(--surface-soft); }
.ms-view-toolbar .segment { min-height:40px; color:var(--muted); }
.ms-view-toolbar .segment.active { color:var(--blue); background:var(--surface); border-color:var(--line); }
.ms-columns { position:relative; color:var(--text); font-size:12px; }
.ms-columns>summary { min-height:44px; padding:12px; border:1px solid var(--line); border-radius:8px; background:var(--surface); cursor:pointer; }
.ms-columns>fieldset { position:absolute; right:0; z-index:5; display:grid; gap:5px; width:240px; max-width:calc(100vw - 48px); margin:8px 0 0; padding:12px; border:1px solid var(--line); border-radius:10px; background:var(--surface); box-shadow:0 8px 30px #17263c20; }
.ms-columns legend { max-width:100%; padding:3px 6px; color:var(--muted); overflow-wrap:anywhere; }
.ms-columns label { display:flex; align-items:center; gap:10px; min-height:36px; }
.ms-columns input { width:17px; height:17px; accent-color:var(--blue); }
.ms-list-card>.kanplan-workspace { padding-top:16px; }
.ms-stage-summary { margin:0 18px; }
.ms-stage-summary .kanplan-stages { grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); max-width:100%; }
.ms-stage-summary .kanplan-stage { --stage-accent:var(--blue); --stage-tint:color-mix(in srgb,var(--blue) 7%,var(--surface)); --stage-ink:var(--text); }
.ms-stage-summary .kanplan-stage:nth-child(3n) { --stage-accent:var(--green); --stage-tint:color-mix(in srgb,var(--green) 7%,var(--surface)); }
.ms-stage-summary .kanplan-stage:nth-child(4n) { --stage-accent:#a27cda; --stage-tint:color-mix(in srgb,#a27cda 7%,var(--surface)); }
.ms-list-card .list-caption { margin:0 20px; }
.ms-list-card .list-caption h2 { margin:0; font-size:14px; }
.ms-list-card .list-caption>span { font-size:12px; }
.ms-list-card .kanplan-workspace>.ms-table-scroll { border:0; border-radius:0; }
.ms-board { display:grid; grid-auto-flow:column; grid-auto-columns:minmax(260px,310px); align-items:start; gap:14px; max-width:100%; min-width:0; padding:4px 20px 18px; overflow-x:auto; overscroll-behavior-x:contain; }
.ms-board-column { min-width:0; padding:12px; border:1px solid var(--line); border-top:3px solid var(--blue); border-radius:12px; background:var(--surface-soft); }
.ms-board-column>header { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:12px; }
.ms-board-column h3 { margin:0; font-size:13px; line-height:1.5; overflow-wrap:anywhere; }
.ms-board-column>header>span { padding:3px 7px; border-radius:6px; background:var(--surface); color:var(--muted); font-size:11px; font-variant-numeric:tabular-nums; }
.ms-board-cards { display:grid; gap:10px; }
.ms-board-card { display:grid; gap:10px; padding:14px; border:1px solid var(--line); border-radius:9px; background:var(--surface); font-size:12px; overflow-wrap:anywhere; }
.ms-board-card>.table-title { min-height:36px; font-size:13px; text-align:left; }
.ms-board-card>strong { font-size:17px; font-variant-numeric:tabular-nums; }
.ms-board-card .ms-status { white-space:normal; }
.ms-board-note { margin:0 20px 18px; }
.ms-reference-link { display:inline-flex; align-items:center; min-height:32px; max-width:100%; text-align:left; white-space:normal; overflow-wrap:anywhere; color:var(--blue); font-size:inherit; }
.ms-ref-card-link { margin-top:4px; font-size:12px; }
.ms-reference-popup.modal { width:min(650px,calc(100vw - 32px)); max-height:calc(100dvh - 40px); padding:0; border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); color:var(--text); box-shadow:0 24px 80px #17263c30; }
.ms-reference-popup::backdrop { background:#17263c4d; }
.ms-reference-popup .modal-head { position:sticky; top:0; z-index:1; align-items:flex-start; background:var(--surface); }
.ms-reference-popup .modal-head h2 { margin:0; font-size:19px; overflow-wrap:anywhere; }
.ms-reference-popup .ms-eyebrow { margin:0 0 5px; color:var(--muted); font-size:11px; }
.ms-reference-popup .modal-body { padding:20px; }
.ms-reference-popup .modal-body>p { margin-top:20px; font-size:12px; line-height:1.6; }
.ms-reference-popup [data-ms="reference-company"] { margin-top:16px; white-space:normal; }
.ms-reference-details { display:grid; gap:0; margin:0; font-size:13px; }
.ms-reference-details>div { display:grid; grid-template-columns:minmax(100px,1fr) minmax(0,2fr); gap:18px; padding:13px 0; border-bottom:1px solid var(--line); }
.ms-reference-details dt { color:var(--muted); }
.ms-reference-details dd { margin:0; line-height:1.6; overflow-wrap:anywhere; white-space:pre-wrap; }
.ms-reference-prices { margin-top:20px; font-size:13px; }
.ms-reference-prices h3 { font-size:14px; }
.ms-reference-prices>div { display:flex; justify-content:space-between; flex-wrap:wrap; gap:12px; padding:10px 0; }
.ms-print-panel { display:grid; gap:14px; margin-bottom:20px; padding:20px; border:1px solid var(--line); border-radius:var(--radius); background:var(--surface-soft); }
.ms-print-panel .section-heading { margin:0; align-items:flex-start; }
.ms-print-panel h3 { margin:0; font-size:16px; }
.ms-print-panel p { margin:0; font-size:12px; line-height:1.6; }
.ms-print-panel .section-heading p { margin-top:7px; }
.ms-print-panel .field { display:grid; gap:6px; flex:1 1 240px; min-width:0; margin:0; color:var(--muted); font-size:12px; }
.ms-print-panel select { min-height:44px; width:100%; min-width:0; padding:10px 12px; border:1px solid var(--line); border-radius:8px; background:var(--input-bg); color:var(--text); font-size:13px; }
.ms-print-controls { display:flex; align-items:flex-end; flex-wrap:wrap; gap:10px; }
.ms-print-list { display:grid; gap:12px; }
.ms-print-item { display:grid; gap:14px; padding:16px; border:1px solid var(--line); border-radius:10px; background:var(--surface); }
.ms-print-item>header { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; }
.ms-print-item>header>div { flex:1 1 200px; min-width:0; font-size:13px; overflow-wrap:anywhere; }
.ms-print-item .button { text-decoration:none; text-align:center; }
.ms-print-delivery { display:flex; flex-wrap:wrap; gap:5px; color:var(--muted); }
.ms-print-delivery .ms-error { flex-basis:100%; }
.ms-reference-popup :is(button,a):focus-visible { outline:2px solid var(--blue); outline-offset:3px; }
@media(max-width:600px) {
  .ms-view-toolbar.page-toolbar { padding:14px; align-items:stretch; }
  .ms-view-toolbar .segmented { width:100%; }
  .ms-view-toolbar .segment { flex:1; justify-content:center; padding-inline:9px; }
  .ms-columns>fieldset { left:0; right:auto; }
  .ms-stage-summary { margin-inline:12px; }
  .ms-stage-summary .kanplan-stages { grid-auto-flow:column; grid-auto-columns:152px; grid-template-columns:none; }
  .ms-list-card .list-caption { margin-inline:14px; flex-wrap:wrap; gap:6px; }
  .ms-board { grid-auto-columns:minmax(250px,85vw); padding-inline:14px; }
  .ms-reference-popup.modal { width:calc(100vw - 20px); max-height:calc(100dvh - 20px); }
  .ms-reference-details>div { grid-template-columns:minmax(0,1fr); gap:4px; }
  .ms-print-panel { padding:15px; }
  .ms-print-item { padding:13px; }
  .ms-print-controls>.button { width:100%; }
}

/* Document cards share the lead drawer, with document-specific working sections. */
.modal.ms-dialog.record-side-dialog { width:min(1180px,calc(100vw - 96px)); height:min(960px,calc(100dvh - 48px)); max-height:calc(100dvh - 48px); margin:24px 24px 24px auto; border:1px solid var(--line); border-radius:var(--radius); overflow:hidden; }
.modal.ms-dialog.record-side-dialog>.modal-body { height:100%; padding:0; overflow:auto; overscroll-behavior:contain; }
.ms-record-panel { min-width:0; }
.ms-card-top { position:sticky; top:0; z-index:4; background:var(--surface); border-bottom:1px solid var(--line); }
.ms-card-top .record-side-head { position:static; min-width:0; padding-right:64px; border-bottom:0; }
.ms-card-top .record-tabs { position:static; gap:22px; border-bottom:0; }
.ms-card-top .record-side-close { left:auto; right:16px; top:18px; width:32px; height:32px; box-shadow:none; }
.ms-record-panel .record-title-block { flex:1 1 240px; }
.ms-record-panel .record-title-block h2 { font-size:24px; }
.ms-record-panel .ms-document-meta { display:flex; flex-wrap:wrap; gap:6px; margin:8px 0 0; font-size:11px; }
.ms-record-panel .record-actions { flex:0 1 auto; min-width:0; }
.ms-record-panel .ms-derive { margin:0; max-width:320px; }
.ms-record-panel .ms-derive-options { gap:6px; }
.ms-record-panel .record-meta-grid { padding-top:20px; background:var(--surface-soft); }
.ms-record-panel .record-info strong { white-space:normal; overflow-wrap:anywhere; }
.ms-record-panel .record-info .ms-reference-link { max-width:100%; font-size:13px; text-align:left; }
.ms-card-form { display:flex; flex-direction:column; flex:1; gap:0; }
.ms-card-form>[data-ms-form-error]:not([hidden]) { margin:16px 24px 0; }
.ms-card-sections { flex:1; min-width:0; padding:24px 28px; }
.ms-card-section { display:grid; gap:20px; min-width:0; }
.ms-card-section[hidden] { display:none; }
.ms-card-section .ms-print-panel { margin:0; }
.ms-card-section .ms-history>details { margin-top:10px; padding:12px; border:1px solid var(--line); border-radius:8px; }
.ms-card-section .ms-history>details>summary { color:var(--text); font-size:12px; line-height:1.6; cursor:pointer; }
.ms-card-section .ms-history>button { margin-top:16px; }
.ms-card-form .ms-form-footer { z-index:3; margin:0; padding:16px 28px; border-radius:0; background:var(--surface); }
.ms-record-panel .record-tab { min-height:44px; }

/* A product's working tabs keep the full form mounted inside a spacious popup. */
.modal.ms-dialog.ms-catalog-dialog { width:min(1180px,calc(100vw - 48px)); height:min(860px,calc(100dvh - 48px)); max-height:calc(100dvh - 48px); padding:0; overflow:hidden; }
.modal.ms-dialog.ms-catalog-dialog[open] { display:flex; flex-direction:column; }
.modal.ms-catalog-dialog>.modal-head { padding:12px 24px; margin:0; border-bottom:1px solid var(--line); }
.modal.ms-catalog-dialog>.modal-head h2 { flex:1; min-width:0; overflow-wrap:anywhere; }
.modal.ms-catalog-dialog>.modal-head .modal-window-actions { flex:none; }
.modal.ms-catalog-dialog>.modal-body { flex:1; min-height:0; padding:0; overflow:auto; overscroll-behavior:contain; }
.ms-catalog-panel { display:flex; flex-direction:column; min-height:100%; }
.ms-catalog-panel .record-side-head { position:static; padding:24px 28px 18px; }
.ms-catalog-panel .record-tabs { position:static; padding-inline:28px; overflow-x:auto; flex-wrap:nowrap; }
.ms-catalog-panel .record-tab { flex:0 0 auto; white-space:nowrap; }
.ms-catalog-panel .ms-card-sections { background:var(--surface-soft); }
.ms-catalog-panel .ms-card-section>.ms-form-fields { gap:20px; }
.ms-catalog-panel .ms-card-section>.ms-form-fields>.ms-array { margin:0; padding:20px; border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); }
.ms-catalog-panel .ms-card-section>.ms-form-fields>.ms-object { margin:0; background:var(--surface); }
.ms-auto-code { display:block; min-height:44px; padding:12px; color:var(--muted); border:1px solid var(--line); border-radius:8px; background:var(--surface-soft); overflow-wrap:anywhere; }
.ms-panel-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:20px; }
.ms-panel-heading h3 { margin:0; font-size:18px; color:var(--text); }
.ms-panel-heading p { margin:7px 0 0; font-size:12px; }
.ms-stock-summary { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin-bottom:22px; }
.ms-stock-summary>div { display:grid; gap:12px; padding:18px; border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); }
.ms-stock-summary span { color:var(--muted); font-size:12px; }
.ms-stock-summary strong { color:var(--text); font-size:24px; font-weight:600; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.ms-panel-hint { margin:14px 0 0; font-size:12px; }
.ms-catalog-panel :is([data-ms-stock-panel],[data-ms-related-panel]) { min-width:0; }
.ms-catalog-panel .ms-table-scroll { border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); }
.ms-catalog-panel .data-table th { padding-block:14px; white-space:nowrap; }
.ms-catalog-panel .data-table td { padding-block:16px; font-size:13px; }
.ms-catalog-panel .ms-pagination { margin-top:18px; }
@media(max-width:900px) {
  .modal.ms-dialog.ms-catalog-dialog { width:calc(100vw - 32px); height:min(860px,calc(100dvh - 32px)); max-height:calc(100dvh - 32px); }
  .ms-stock-summary { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .modal.ms-dialog.record-side-dialog { width:calc(100vw - 32px); height:min(960px,calc(100dvh - 32px)); max-height:calc(100dvh - 32px); margin:16px 16px 16px auto; }
  .ms-card-sections { padding:20px 22px; }
  .ms-card-form .ms-form-footer { padding:14px 22px; }
  .ms-card-top .record-actions { width:100%; justify-content:flex-start; }
  .ms-record-panel .ms-derive { max-width:100%; }
}
@media(max-width:600px) {
  .modal.ms-dialog.ms-catalog-dialog { width:100vw; max-width:100vw; height:calc(100dvh - 70px - env(safe-area-inset-bottom,0px)); max-height:calc(100dvh - 70px - env(safe-area-inset-bottom,0px)); margin:0 0 calc(70px + env(safe-area-inset-bottom,0px)); border:0; border-radius:0; }
  .modal.ms-catalog-dialog>.modal-head { padding:12px 16px; }
  .ms-catalog-panel .record-side-head { padding:18px 16px 14px; }
  .ms-catalog-panel .record-tabs { padding-inline:16px; }
  .ms-catalog-panel .ms-card-section>.ms-form-fields>.ms-array { padding:14px; }
  .ms-stock-summary>div { padding:14px; gap:8px; }
  .ms-stock-summary strong { font-size:21px; }
  .modal.ms-dialog.record-side-dialog { width:100vw; max-width:100vw; height:calc(100dvh - 70px - env(safe-area-inset-bottom,0px)); max-height:calc(100dvh - 70px - env(safe-area-inset-bottom,0px)); margin:0 0 calc(70px + env(safe-area-inset-bottom,0px)) 0; border:0; border-radius:0; }
  .ms-card-top .record-side-head { padding:18px 52px 12px 16px; }
  .ms-card-top .record-tabs { padding:0 16px; gap:18px; }
  .ms-card-top .record-side-close { right:12px; top:14px; }
  .ms-record-panel .record-title-block h2 { font-size:20px; }
  .ms-record-panel .record-meta-grid { padding:16px; gap:16px; }
  .ms-card-sections { padding:16px; }
  .ms-card-form .ms-form-footer { padding:12px 16px; }
  .ms-card-form .ms-form-footer>.toolbar-group { width:100%; justify-content:flex-end; }
}

/* Documents use the available area for records, stages and totals. */
.ms-document-workspace { width:100%; max-width:none; }
.ms-document-workspace .ms-list-card { overflow:visible; }
.ms-document-workspace .ms-page-heading { align-items:center; gap:10px; margin-bottom:8px; }
.ms-document-workspace .ms-page-heading .ms-eyebrow { margin-bottom:3px; }
.ms-document-workspace .ms-page-heading p { margin-top:3px; line-height:1.4; font-size:12px; }
.ms-document-workspace .ms-tabs { gap:6px; margin:8px 0; padding-bottom:7px; }
.ms-document-workspace .ms-tabs .tab { min-height:36px; padding-block:7px; }
.ms-document-workspace .ms-note { margin:8px 0; padding:8px 12px; line-height:1.4; }
.ms-document-workspace .ms-report { margin:8px 0; padding:10px 12px; }
.ms-document-workspace .ms-list-toolbar { gap:8px; padding:10px 12px; }
.ms-document-workspace .ms-list-toolbar :is(input,select) { min-height:36px; padding:7px 9px; }
.ms-document-workspace .ms-list-toolbar .ms-deleted-filter { min-height:36px; }
.ms-document-workspace .ms-list-toolbar .ms-deleted-filter input { min-height:17px; }
.ms-document-workspace .ms-view-toolbar.page-toolbar { gap:8px; padding:8px 12px; }
.ms-document-workspace .ms-view-toolbar :is(.button,.segment),.ms-document-workspace .ms-columns>summary { min-height:36px; padding-block:7px; }
.ms-document-workspace .ms-list-count { padding:6px 12px; }
.ms-document-workspace .ms-list-card .ms-table-scroll :is(th,td) { padding:8px 12px; }
.ms-document-workspace .ms-list-card .ms-table-scroll .button,.ms-document-workspace .ms-list-name .text-btn { min-height:34px; padding-block:5px; }
.ms-document-workspace .ms-list-card .ms-pagination { padding:8px 12px; }
.ms-document-workspace .ms-list-card .list-caption { margin:0 12px; }
.ms-document-workspace .ms-list-card>.kanplan-workspace { gap:10px; padding-top:8px; }
.ms-document-workspace .ms-stage-summary { margin-inline:10px; }
.ms-document-workspace .ms-stage-summary .kanplan-stage { --stage-accent:var(--stage-color,var(--blue)); --stage-tint:color-mix(in srgb,var(--stage-color,var(--blue)) 8%,var(--surface)); gap:8px; min-height:92px; padding:10px 12px; }
.ms-document-workspace .stage-tile-total strong { font-size:23px; }
.ms-document-workspace .ms-board { gap:10px; padding:4px 12px 12px; }
.ms-document-workspace .ms-board-column { padding:10px; border-top-color:var(--stage-color,var(--blue)); }
.ms-document-workspace .ms-board-column>header { align-items:flex-start; flex-wrap:wrap; gap:5px 8px; margin-bottom:9px; }
.ms-document-workspace .ms-board-column>header h3 { flex:1; }
.ms-document-workspace .ms-board-cards { gap:8px; }
.ms-document-workspace .ms-board-card { gap:7px; padding:11px; }
.ms-document-workspace .ms-board-note { margin:0 12px 8px; }
.ms-stage-totals { display:grid; gap:3px; width:100%; color:var(--text); font-size:12px; line-height:1.4; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.ms-stage-totals:empty { display:none; }
.ms-view-tools { display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:7px; min-width:0; }
.ms-stage-filter { display:flex; align-items:center; flex-wrap:wrap; gap:7px; font-size:12px; }
.ms-stage-filter select { min-width:140px; max-width:100%; min-height:36px; padding:7px 9px; border:1px solid var(--line); border-radius:8px; background:var(--input-bg); color:var(--text); }
.ms-stage-filter input[type=checkbox] { width:16px; height:16px; accent-color:var(--blue); }
.ms-stage-settings { position:relative; font-size:12px; }
.ms-stage-settings>summary { min-height:36px; padding:8px 10px; border:1px solid var(--line); border-radius:8px; background:var(--surface); color:var(--text); cursor:pointer; }
.ms-stage-settings>div,.ms-stage-settings>fieldset { position:absolute; top:100%; right:0; z-index:8; width:min(620px,calc(100vw - 40px)); max-height:60dvh; overflow:auto; margin:6px 0 0; padding:12px; border:1px solid var(--line); border-radius:10px; background:var(--surface); box-shadow:0 8px 30px #17263c20; }
.ms-stage-settings p { margin:0 0 10px; color:var(--muted); line-height:1.5; }
.ms-stage-settings>fieldset { min-width:0; }
.ms-stage-settings:not([open])>:not(summary) { display:none; }
.ms-stage-settings-row { display:grid; grid-template-columns:minmax(100px,1fr) 38px minmax(110px,150px) auto; align-items:center; gap:8px; padding:7px 0; border-bottom:1px solid var(--line); }
.ms-stage-settings-row:last-child { border-bottom:0; }
.ms-stage-settings-row>span { min-width:0; overflow-wrap:anywhere; }
.ms-stage-settings-row input[type=color] { width:34px; height:32px; padding:3px; border:1px solid var(--line); border-radius:6px; background:var(--surface); cursor:pointer; }
.ms-stage-settings-row select { width:100%; min-width:0; padding:6px; border:1px solid var(--line); border-radius:6px; background:var(--input-bg); color:var(--text); }
.ms-stage-settings-row .button,.ms-stage-settings-row .icon-btn { min-width:30px; min-height:32px; padding:4px 7px; }
.ms-stage-settings-row .toolbar-group { flex-wrap:nowrap; gap:4px; }
.ms-workspace.ms-workspace-fullscreen { position:fixed; inset:0; z-index:60; display:flex; flex-direction:column; width:100%; max-width:none; height:100dvh; margin:0; padding:12px 16px; overflow:auto; background:var(--page-bg,var(--surface)); overscroll-behavior:contain; }
.ms-workspace-fullscreen>.ms-list-card { display:flex; flex:1; flex-direction:column; min-height:0; }
.ms-workspace-fullscreen .ms-board { flex:1; min-height:140px; align-items:stretch; overflow:auto; }
.ms-workspace-fullscreen .ms-board-column { display:flex; flex-direction:column; min-height:0; }
.ms-workspace-fullscreen .ms-board-cards { align-content:start; overflow-y:auto; overscroll-behavior:contain; }

/* One active stage, with the other steps kept neutral in every document card. */
.ms-stage-strip { display:flex; align-items:stretch; gap:6px; min-width:0; overflow-x:auto; overscroll-behavior-x:contain; scrollbar-width:thin; }
.ms-stage-step { display:flex; flex:1 0 130px; align-items:center; justify-content:center; min-height:44px; padding:9px 12px; border:1px solid var(--line); border-top:3px solid var(--line); border-radius:7px; background:var(--surface-soft); color:var(--muted); font:inherit; font-size:12px; line-height:1.4; text-align:center; overflow-wrap:anywhere; }
.ms-stage-step.active { border-color:color-mix(in srgb,var(--stage-color,var(--blue)) 55%,var(--line)); border-top-color:var(--stage-color,var(--blue)); background:color-mix(in srgb,var(--stage-color,var(--blue)) 17%,var(--surface)); color:var(--text); font-weight:650; }
.ms-stage-step:disabled { opacity:1; cursor:default; }
.ms-stage-step:not(:disabled) { cursor:pointer; }
.ms-stage-step:focus-visible { outline:2px solid var(--blue); outline-offset:2px; }
.ms-card-stage-strip { margin:0; padding:10px 20px; border-bottom:1px solid var(--line); }
.ms-card-stage-strip .ms-stage-strip { padding:2px; }
.ms-card-stage-strip .ms-ref { margin-top:8px; }
.ms-card-stage-strip .ms-ref select { min-height:36px; padding-block:7px; }
.ms-record-panel .record-side-head { gap:10px; padding:14px 108px 8px 20px; }
.ms-record-panel .record-title-block h2 { font-size:22px; }
.ms-record-panel .record-tabs { padding-inline:20px; gap:18px; }
.ms-record-panel .record-tab { min-height:38px; padding-block:9px; }
.ms-record-panel .record-meta-grid.ms-document-meta { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px; margin:0; padding:12px 20px; }
.ms-record-panel .record-meta-grid .record-info { min-width:0; }
.ms-record-panel .record-meta-grid .record-info small { font-size:10px; }
.ms-record-panel .record-meta-grid .record-info strong { font-size:12px; }
.ms-record-panel .ms-card-sections { padding:14px 20px; }
.ms-record-panel .ms-card-section,.ms-record-panel .ms-form-fields { gap:12px; }
.ms-record-panel .ms-form-section { padding:14px; }
.ms-record-panel .ms-form-section>.ms-form-grid { margin-top:12px; gap:12px; }
.ms-record-panel .ms-form-section>p.muted { margin:5px 0 12px; }
.ms-record-panel .ms-document-form .ms-form-section>.field { margin-top:12px; }
.ms-record-panel .ms-field-label { margin-bottom:5px; }
.ms-record-panel .ms-document-form textarea { min-height:74px; }
.ms-record-panel .ms-card-form .ms-form-footer { gap:8px; padding:10px 20px; }
.ms-record-panel .ms-document-total { margin:0; padding:12px 14px; text-align:left; border:1px solid var(--line); border-radius:8px; background:var(--surface-soft); }
.ms-record-panel .ms-document-total strong { font-size:22px; }
.ms-record-minimize { position:absolute; right:54px; top:18px; z-index:4; display:inline-flex; align-items:center; justify-content:center; width:32px; height:32px; border:1px solid var(--line); border-radius:7px; background:var(--surface); color:var(--muted); font-size:20px; cursor:pointer; }
.ms-record-minimize:hover { color:var(--blue); background:var(--surface-soft); }
.ms-record-panel .ms-derive { position:relative; }
.ms-record-panel .ms-derive>summary { min-height:36px; padding:8px 11px; list-style:none; }
.ms-record-panel .ms-derive>summary::-webkit-details-marker { display:none; }
.ms-record-panel .ms-derive>summary::after { content:' ▾'; margin-left:7px; color:var(--muted); }
.ms-record-panel .ms-derive>p { display:none; }
.ms-record-panel .ms-derive-options { position:absolute; top:calc(100% + 6px); right:0; z-index:8; display:grid; gap:4px; width:250px; max-width:calc(100vw - 40px); max-height:50dvh; overflow:auto; padding:7px; border:1px solid var(--line); border-radius:9px; background:var(--surface); box-shadow:0 8px 30px #17263c20; }
.ms-record-panel .ms-derive:not([open])>.ms-derive-options { display:none; }
.ms-record-panel .ms-derive-options .button { justify-content:flex-start; min-height:38px; padding:8px 10px; text-align:left; white-space:normal; }
@media(max-width:1050px) {
  .ms-record-panel .record-meta-grid.ms-document-meta { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
@media(max-width:600px) {
  .ms-workspace.ms-workspace-fullscreen { padding:8px; }
  .ms-document-workspace .ms-page-heading { flex-wrap:wrap; }
  .ms-document-workspace .ms-view-toolbar.page-toolbar { align-items:flex-start; }
  .ms-view-tools { justify-content:flex-start; width:100%; }
  .ms-stage-settings>div,.ms-stage-settings>fieldset { left:0; right:auto; width:calc(100vw - 40px); }
  .ms-stage-settings-row { grid-template-columns:minmax(80px,1fr) 34px minmax(85px,1fr) auto; gap:5px; }
  .ms-stage-settings-row .button,.ms-stage-settings-row .icon-btn { min-width:27px; padding-inline:5px; }
  .ms-stage-settings-row .toolbar-group { gap:2px; }
  .ms-record-panel .record-side-head { padding:14px 96px 8px 14px; }
  .ms-record-panel .record-title-block h2 { font-size:20px; }
  .ms-record-panel .record-tabs { padding-inline:14px; }
  .ms-record-panel .record-meta-grid.ms-document-meta { grid-template-columns:repeat(2,minmax(0,1fr)); padding:10px 14px; }
  .ms-card-stage-strip { padding:8px 12px; }
  .ms-stage-step { flex-basis:120px; }
  .ms-record-panel .ms-card-sections { padding:12px 14px; }
  .ms-record-panel .ms-card-form .ms-form-footer { padding:10px 14px; }
  .ms-record-panel .ms-derive-options { left:0; right:auto; }
  .ms-record-minimize { right:50px; top:14px; }
}

/* Document drafts remain close to the left navigation while work continues. */
.modal-dock-list.has-commerce { right:auto; left:calc(var(--nav-width,80px) + 14px); }
@media(max-width:600px) {
  .modal-dock-list.has-commerce { left:12px; bottom:calc(82px + env(safe-area-inset-bottom,0px)); width:calc(100vw - 24px); }
}

.ms-card-stage-select { display:none; }

/* Name suggestions and bulk selection keep the document draft mounted. */
.ms-assortment-search { display:grid; gap:6px; min-width:200px; }
.ms-assortment-search>input,.ms-assortment-search>select { width:100%; min-width:0; min-height:44px; max-width:100%; padding:9px 11px; border:1px solid var(--line); border-radius:8px; background:var(--input-bg); color:var(--text); font:inherit; font-size:12px; }
.ms-assortment-suggestions { display:grid; gap:3px; max-height:240px; overflow:auto; overscroll-behavior:contain; padding:4px; border:1px solid var(--line); border-radius:8px; background:var(--surface); }
.ms-assortment-suggestions[hidden] { display:none; }
.ms-assortment-option { display:block; width:100%; min-height:44px; padding:9px 10px; border:0; border-radius:5px; background:transparent; color:var(--text); font:inherit; font-size:12px; line-height:1.5; text-align:left; white-space:normal; overflow-wrap:anywhere; cursor:pointer; }
.ms-assortment-option:hover { background:var(--surface-soft); }
.ms-assortment-suggestions>p { margin:6px; color:var(--muted); font-size:12px; line-height:1.5; }
.ms-assortment-option small { display:block; color:var(--muted); }
.ms-catalog-picker.modal { width:min(820px,calc(100vw - 32px)); max-height:calc(100dvh - 40px); padding:0; border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); color:var(--text); box-shadow:0 24px 80px #17263c30; overflow:hidden; }
.ms-catalog-picker.modal[open] { display:flex; flex-direction:column; }
.ms-catalog-picker::backdrop { background:#17263c4d; }
.ms-catalog-picker>.modal-head { flex-shrink:0; gap:16px; margin:0; padding:18px 20px; border-bottom:1px solid var(--line); }
.ms-catalog-picker .modal-head h2 { margin:0; font-size:19px; overflow-wrap:anywhere; }
.ms-catalog-picker>.modal-body { display:grid; gap:16px; min-height:0; padding:20px; overflow:auto; overscroll-behavior:contain; }
.ms-picker-controls { display:flex; flex-wrap:wrap; gap:12px; align-items:flex-end; }
.ms-picker-controls label { display:grid; flex:1 1 180px; gap:6px; min-width:0; color:var(--muted); font-size:12px; }
.ms-picker-controls :is(input,select) { width:100%; min-width:0; min-height:44px; padding:10px 12px; border:1px solid var(--line); border-radius:8px; background:var(--input-bg); color:var(--text); font:inherit; font-size:13px; }
.ms-picker-results { display:grid; gap:6px; min-width:0; max-height:45dvh; padding:2px; overflow:auto; overscroll-behavior:contain; }
.ms-picker-item { display:flex; align-items:center; gap:12px; min-height:52px; padding:11px 12px; border:1px solid var(--line); border-radius:8px; background:var(--surface); font-size:13px; line-height:1.5; cursor:pointer; }
.ms-picker-item:has(input:checked) { border-color:var(--blue); background:var(--surface-soft); }
.ms-picker-item input[type=checkbox] { flex:0 0 18px; width:18px; height:18px; min-width:18px; margin:0; accent-color:var(--blue); }
.ms-picker-item>span { min-width:0; overflow-wrap:anywhere; }
.ms-picker-item small { display:block; color:var(--muted); font-size:12px; }
.ms-picker-footer { display:grid; gap:14px; padding-top:14px; border-top:1px solid var(--line); }
.ms-picker-footer>.toolbar-group { display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-end; gap:10px; }
.ms-picker-footer .toolbar-group>span { margin-right:auto; color:var(--muted); font-size:13px; font-variant-numeric:tabular-nums; }
.ms-catalog-picker .ms-pagination { margin:0; }
.ms-catalog-picker .button { min-height:44px; }
.ms-catalog-picker :is(button,input,select):focus-visible,.ms-assortment-option:focus-visible { outline:2px solid var(--blue); outline-offset:2px; }
@media(max-width:600px) {
  .ms-catalog-picker.modal { width:calc(100vw - 20px); max-height:calc(100dvh - 20px); }
  .ms-catalog-picker>.modal-head,.ms-catalog-picker>.modal-body { padding:14px; }
  .ms-picker-controls label { flex-basis:100%; }
  .ms-picker-footer .toolbar-group>span { flex-basis:100%; }
  .ms-picker-footer .toolbar-group>.button { flex:1 1 auto; }
}
