/* MIS screen: the client's sheet over many columns (docs/ui-design/screens/MIS.dc.html). Tokens only. The table scrolls inside its
   card, never the page; the first column and the two header rows stay put. No transform or container on page sections. */
.ms-page .m-head { flex-wrap: wrap; gap: 12px 16px; }
.ms-set { margin-left: 4px; padding: 0 8px; height: 20px; display: inline-flex; align-items: center; border-radius: 999px; background: var(--sunken); color: var(--ink-2); font-size: 12px; font-weight: 500; }
.ms-page .m-actions { flex-wrap: wrap; }
.ms-page .m-btn[disabled] { opacity: .5; cursor: default; }

.ms-card { overflow: hidden; min-width: 0; }
.ms-card.stale { opacity: .6; transition: opacity .15s; }
.ms-wrap { overflow: auto; max-width: 100%; max-height: calc(100vh - 220px); min-height: 280px; overscroll-behavior: contain; }
.ms-table { width: max-content; min-width: 100%; }
.ms-table th, .ms-table td { background: inherit; }
.ms-table thead th { position: sticky; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--line); height: 34px; }
.ms-table thead tr:first-child th { top: 0; color: var(--ink); font-weight: 600; font-size: 13px; border-bottom: 0; }
.ms-table thead tr:nth-child(2) th { top: 34px; height: 28px; font-size: 12px; }
.ms-table th.ms-lab { left: 0; z-index: 5; min-width: 300px; text-align: left; vertical-align: bottom; }
.ms-table th.num { min-width: 96px; }
.ms-table .first { border-left: 1px solid var(--line); }
.ms-per { text-align: center !important; }
.ms-part { display: inline-block; width: 8px; height: 8px; margin-left: 6px; border-radius: 50%; border: 1.5px solid var(--warn-ink); background: transparent; vertical-align: 1px; cursor: help; }

.ms-table tbody tr { background: var(--surface); }
.ms-table tbody tr:hover { background: var(--hover); }
.ms-table td { height: 38px; padding: 6px 12px; }
.ms-table td.ms-lab { position: sticky; left: 0; z-index: 2; min-width: 300px; max-width: 420px; white-space: normal; color: var(--ink-2); }
.ms-table td.lv1 { padding-left: 36px; } .ms-table td.lv2 { padding-left: 52px; } .ms-table td.lv3 { padding-left: 68px; } .ms-table td.lv4 { padding-left: 84px; }
.ms-table td.neg { color: var(--ink); }
.ms-table tr.bold > td { color: var(--ink); font-weight: 600; }
.ms-table tr.grp { background: var(--sunken); }
.ms-table tr.grp > td { color: var(--ink); font-weight: 600; font-size: 12.5px; height: 34px; }
.ms-table tr.subt { background: #faf9f7; }
.ms-table tr.subt > td { color: var(--ink); font-weight: 600; }
.ms-table tr.total { background: #faf9f7; }
.ms-table tr.total > td { color: var(--ink); font-weight: 600; border-top: 1px solid var(--line-2); }
.ms-table tr.pct > td { color: var(--ink-3); font-size: 12.5px; height: 32px; }
.ms-table tr.memo > td { color: var(--ink-3); font-size: 12.5px; font-style: italic; height: 32px; }
.ms-table tr.gap > td { border-top: 10px solid var(--sunken); }
.ms-table tbody tr:last-child td { border-bottom: 0; }
.ms-table .m-cell { min-width: 80px; }
.ms-table .m-cell[aria-pressed="true"] { color: #fff; }
.ms-dot { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--coral); vertical-align: 2px; }
.ms-table tr.ms-toggle { background: var(--sunken); }
.ms-table tr.ms-toggle td { padding: 0; height: 36px; position: sticky; left: 0; }
.ms-table tr.ms-toggle button { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 20px; border: 0; background: transparent; cursor: pointer; text-align: left; font-weight: 600; font-size: 12.5px; color: var(--ink); position: sticky; left: 0; width: max-content; }
.ms-table tr.ms-toggle small { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.ms-chev { display: inline-flex; transition: transform .15s ease; } .ms-chev.open { transform: rotate(90deg); }
.ms-table tr.ms-off td.ms-lab .sub { color: var(--ink-3); font-size: 12px; line-height: 16px; }

.ms-legend-dot { width: 8px !important; height: 8px !important; border-radius: 50% !important; background: var(--coral) !important; }
.ms-bl-d { display: block; }
.ms-skel { padding: 20px; display: grid; gap: 14px; }
.ms-skel i { display: block; height: 14px; border-radius: 7px; background: linear-gradient(90deg, var(--sunken) 25%, var(--line) 50%, var(--sunken) 75%); background-size: 200% 100%; animation: m-shimmer 1.4s linear infinite; }
.ms-empty { padding: 96px 24px; }

/* the source sheet */
.ms-sh-t { flex: 1; min-width: 0; }
.ms-sh-v { font-size: 26px; }
.ms-sh-note { margin: 0; padding: 12px 20px 0; color: var(--ink-3); font-size: 12.5px; }
.ms-sh-tab td { height: 44px; }
.ms-pub { color: var(--brand-deep); }
.ms-sh-h { padding: 18px 20px 6px; }
.ms-entries { display: grid; }
.ms-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 20px; border-top: 1px solid var(--line); }
.ms-entry .key { display: block; font-weight: 500; color: var(--ink); }
.ms-entry .sub { display: block; font-size: 12.5px; color: var(--ink-3); }
.ms-acct { display: block; width: 100%; padding: 0; border: 0; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.ms-acct:hover .key { color: var(--brand-deep); text-decoration: underline; }
.ms-acct:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.ms-sh-tab td .key, .ms-sh-tab td .sub { display: block; }
.ms-sh-tab td .sub { font-size: 12.5px; color: var(--ink-3); }
.ms-back { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ms-back .sub { flex-basis: 100%; }
.ms-vtab { width: 100%; overflow-wrap: anywhere; }
.ms-vtab td { white-space: normal; }
.ms-vtab td:nth-child(2) { white-space: nowrap; }
.ms-vtab th, .ms-vtab td { padding-left: 8px; padding-right: 8px; vertical-align: top; }
.ms-vtab th:first-child, .ms-vtab td:first-child { padding-left: 20px; white-space: nowrap; }
.ms-vtab th:last-child, .ms-vtab td:last-child { padding-right: 20px; white-space: nowrap; }
.ms-lease { display: grid; gap: 12px; padding: 4px 20px 20px; }
.ms-lease-act { display: flex; justify-content: flex-end; }
.ms-err { margin: 0; color: var(--bad); font-size: 13px; }

/* the columns sheet */
.ms-cols { width: min(520px, calc(100vw - 20px)); }
.ms-cols-b { padding: 16px 20px 24px; display: grid; gap: 22px; align-content: start; }
.ms-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.ms-presets .m-btn[aria-pressed="true"] { background: var(--brand-tint); border-color: var(--brand-line); color: var(--brand-deep); }
.ms-custom { display: grid; gap: 20px; }
.ms-sec { display: grid; gap: 8px; justify-items: start; }
.ms-sec .m-seg button[disabled] { opacity: .45; cursor: default; }
.ms-fy { display: grid; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.ms-list { display: grid; gap: 6px; }
.ms-ticks { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.ms-tick { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; font-size: 13px; color: var(--ink); }
.ms-tick:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); }
.ms-tick.off { opacity: .5; cursor: default; }
.ms-tick small { font-size: 11.5px; color: var(--ink-3); }
.ms-tick input { accent-color: var(--brand); margin: 0; }
.ms-cols-f { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--sunken); }

@media (max-width: 760px) {
  .ms-page .m-head { align-items: flex-start; }
  .ms-wrap { max-height: none; }
  .ms-table th.ms-lab, .ms-table td.ms-lab { min-width: 150px; max-width: 170px; }
  .ms-table td { padding: 6px 10px; }
  .ms-table td.lv1 { padding-left: 24px; } .ms-table td.lv2 { padding-left: 32px; } .ms-table td.lv3, .ms-table td.lv4 { padding-left: 40px; }
  .ms-table th.num { min-width: 84px; }
}
@media (prefers-reduced-motion: reduce) { .ms-skel i { animation: none; } .ms-chev { transition: none; } }
.ms-enter { border: 0; background: transparent; padding: 4px 8px; margin: -4px -8px; border-radius: 8px; color: var(--brand-deep); font-weight: 500; font-size: 13px; cursor: pointer; }
.ms-enter:hover { background: var(--brand-tint); }
