:root {
  color-scheme: dark;
  --canvas: #1d1d1f;
  --bar: #313134;
  --panel: #29292c;
  --surface: #353538;
  --rule: #444447;
  --subtle-rule: #353538;
  --text: #eeeef0;
  --sub: #c0c0c5;
  --dim: #a2a2aa;
  --accent: #8abaff;
  --selection: #1467ca;
  --focus: #85baff;
  --teal: var(--accent);
  --active: var(--selection);
  --sidebar-width: clamp(205px, 16vw, 238px);
  --category-width: 58px;
  --field-width: 118px;
  --model-width: clamp(150px, 12vw, 193px);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Microsoft YaHei UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
body.workbench {
  margin: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  color: var(--text);
  background: var(--canvas);
  font: 14px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
}
.workbench [hidden] { display: none !important; }
.workbench :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.workbench button, .workbench input, .workbench select { font: inherit; }
.workbench button, .workbench summary, .workbench select { cursor: pointer; }
.workbench button:disabled, .workbench select:disabled { cursor: default; opacity: .45; }
.workbench a { color: var(--accent); text-underline-offset: 3px; }

/* Shared window toolbar */
.appbar {
  position: relative;
  z-index: 9;
  flex: none;
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 50px;
  padding: 7px 18px;
  background: #242426;
  border-bottom: 1px solid #414143;
}
.appbar .wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #f5f5f7;
  font-weight: 690;
  font-size: 1.15rem;
  line-height: 1;
  letter-spacing: -.045em;
  white-space: nowrap;
  text-decoration: none;
}
.appbar .wordmark::before {
  content: "";
  width: 20px;
  height: 18px;
  border: 1.5px solid #d8d8dc;
  border-radius: 4px;
  background:
    linear-gradient(#d8d8dc,#d8d8dc) 34% 50%/1px 100% no-repeat,
    linear-gradient(#a4a4ad,#a4a4ad) 77% 37%/6px 1px no-repeat,
    linear-gradient(#a4a4ad,#a4a4ad) 77% 63%/6px 1px no-repeat;
}
/* Older cached model pages place the icon definitions before the toolbar. */
.modality-symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.modality { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; margin-inline: 4px; }
.modality svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; color: var(--sub); }
.appbar nav {
  display: inline-flex;
  align-items: stretch;
  gap: 2px;
  margin-left: 12px;
  padding: 2px;
  border-radius: 8px;
  background: #242426;
  box-shadow: inset 0 1px 2px #0004, 0 1px #ffffff0c;
}
.appbar nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 2px 15px;
  border-radius: 6px;
  font-size: .84rem;
  font-weight: 510;
  color: #c6c6ca;
  text-decoration: none;
  white-space: nowrap;
}
.appbar nav a:hover { background: #3d3d40; color: #fff; }
.appbar nav a[aria-current="page"], .appbar nav a.active {
  background: #57575b;
  box-shadow: inset 0 1px #ffffff21, 0 1px 2px #0004;
  color: white;
}
.affiliation { margin-left: auto; color: #b5b5bb; font-size: .8rem; }

/* Shared split view and inset source list */
.work-area {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0,1fr);
  flex: 1;
  min-height: 0;
}
.sidebar {
  min-height: 0;
  min-width: 0;
  margin: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 9px 7px 14px;
  border: 1px solid #424244;
  border-radius: 14px;
  background: #232325;
  scrollbar-color: #57575b transparent;
  scrollbar-width: thin;
}
.sidebar .side-label {
  margin: 18px 8px 5px;
  color: #acacb1;
  font-size: .73rem;
  font-weight: 580;
}
.sidebar > .side-label:first-child { margin-top: 3px; }
.sidebar :is(.side-item,.tree-select,.tree-toggle,.version-button,.line-button,summary) {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-width: 0;
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: #d6d6d9;
  font: 480 .84rem/1.35 var(--sans);
  text-decoration: none;
  text-align: left;
  overflow-wrap: anywhere;
}
.sidebar :is(.side-item,.tree-leaf,.tree-toggle,.version-button,.line-button,summary):hover {
  background: #2c2c2f;
  color: #f8f8fa;
}
.sidebar :is(.side-item,.tree-leaf,.version-button,.line-button):is(.active,[aria-current="page"],[aria-current="true"]) {
  background: #343436;
  border-color: #57575a;
  color: #fff;
}
.sidebar :is(.tree-select,.tree-toggle,.side-item,summary,.version-button,.line-button) small,
.sidebar .side-item > span:last-child {
  margin-left: auto;
  flex: none;
  color: #a0a0a5;
  font: .7rem/1.4 var(--sans);
  font-variant-numeric: tabular-nums;
}
.sidebar :is(.active,[aria-current="page"],[aria-current="true"]) :is(small,span:last-child) { color: #d1d1d4; }
.lab-search { display: block; margin: 5px 2px 10px; }
.lab-search input {
  width: 100%;
  padding: 5px 8px;
  min-height: 29px;
  border: 1px solid #434346;
  border-radius: 7px;
  background: #1f1f21;
  color: var(--text);
  font-size: .81rem;
}
.lab-search input::placeholder, .searchbox input::placeholder { color: #a8a8b0; }
.side-end {
  margin: 16px 9px 0;
  padding-top: 13px;
  border-top: 1px solid #414145;
  color: var(--dim);
  font-size: .75rem;
  line-height: 1.65;
}
.tree-toggle::after, .more-series > summary::after {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  margin-inline: 3px 2px;
  color: var(--dim);
  border: solid currentColor;
  border-width: 1.4px 1.4px 0 0;
  transform: rotate(45deg);
}
.tree-toggle[aria-expanded="true"]::after, .more-series[open] > summary::after { transform: rotate(135deg); }
.lab-group { margin: 1px 0; }
.sidebar .lab-group > .tree-row > .tree-toggle { color: #e4e4e7; }
.sidebar :is(.maker-list,.family-list) { margin: 2px 0 6px 10px; }
.sidebar .version-list { margin: 1px 0 5px 10px; }
.sidebar :is(.tree-leaf,.version-button,.line-button)::before {
  content: "";
  flex: 0 0 12px;
  height: 10px;
  border: 1px solid currentColor;
  border-radius: 2px;
  background: linear-gradient(currentColor,currentColor) 50% 0 / 1px 100% no-repeat;
  color: #99999e;
}
.sidebar :is(.tree-leaf,.version-button,.line-button) { font-size: .81rem; }
.sidebar .more-series > summary { list-style: none; cursor: pointer; color: #b6b6bd; }
.sidebar summary::-webkit-details-marker { display: none; }
.sidebar :is(.tree-select,.tree-toggle,.side-item,.version-button,.line-button,summary):focus-visible { outline-offset: -2px; }
#toggleNav { display: none; }

/* Model window */
.release-date { color:var(--sub); font:.75rem/1.5 var(--mono); font-variant-numeric:tabular-nums; }
.workspace {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 8px 10px 8px 0;
  border: 1px solid #414144;
  border-radius: 14px;
  background: #202022;
}
.work-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 14px;
  padding: 15px 16px 10px;
}
.work-title > div:first-child { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.work-title h1 { margin: 0; color: #f5f5f7; font-size: clamp(1.18rem,1.8vw,1.55rem); line-height: 1.3; font-weight: 640; letter-spacing: -.035em; }
.work-title #summary { color: var(--dim); font-size: .81rem; font-variant-numeric: tabular-nums; }
.matrix-actions, .matrix-pager { display: flex; align-items: center; gap: 5px; }
.tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 0 16px 12px;
}
#filterOptions { display:contents; }
#toggleFilters { display:none; }
@media (max-width:640px) {
  #toggleFilters { display:inline-flex; align-items:center; }
  #filterOptions { display:none; }
  .tools.filters-open #filterOptions { display:flex; flex:1 0 100%; flex-wrap:wrap; gap:5px; }
}
.tools button, .tools select, .work-foot button, .matrix-actions button, #toggleNav, .empty-state button {
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid #4e4e52;
  border-radius: 6px;
  background: #37373a;
  box-shadow: inset 0 1px #ffffff08, 0 1px 1px #0002;
  color: #e1e1e5;
  font-size: .81rem;
  line-height: 1.3;
}
:is(.tools,.work-foot,.matrix-actions,.empty-state) button:hover:not(:disabled), #toggleNav:hover { background: #46464a; }
:is(.tools,.matrix-actions) button[aria-pressed="true"] { border-color: #3b7bc1; background: #224b7a; color: #eaf3ff; }
.tools select {
  max-width: 100%;
  appearance: none;
  padding-right: 25px;
  background-image: linear-gradient(45deg,transparent 50%,#c8c8cf 50%),linear-gradient(135deg,#c8c8cf 50%,transparent 50%);
  background-position: calc(100% - 12px) 53%,calc(100% - 8px) 53%;
  background-size: 4px 4px;
  background-repeat: no-repeat;
}
.searchbox {
  display: flex;
  align-items: center;
  position: relative;
  flex: 1 1 190px;
  max-width: 330px;
  height: 29px;
  border: 1px solid #505054;
  border-radius: 7px;
  background: #29292b;
}
.searchbox::before, .searchbox::after { position: absolute; content: ""; pointer-events: none; }
.searchbox::before { left: 10px; top: 8px; width: 8px; height: 8px; border: 1.5px solid #adadb4; border-radius: 50%; }
.searchbox::after { left: 18px; top: 17px; width: 5px; border-top: 1.5px solid #adadb4; transform: rotate(46deg); }
.searchbox:focus-within { border-color: var(--focus); outline: 2px solid #5984ba66; }
.searchbox input {
  min-width: 0;
  width: 100%;
  height: 100%;
  padding: 0 8px 0 30px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: .86rem;
}
.searchbox input:focus-visible { outline: 0; }
.searchbox kbd { margin-right: 8px; color: #adadb3; font: .75rem var(--mono); }
.matrix-viewport {
  position: relative;
  isolation: isolate;
  display: flex;
  flex: 1 1 0;
  min-height: 0;
}
.column-arrow {
  position: absolute;
  top: var(--arrow-center, 50px);
  z-index: 1;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  transform: translateY(-50%);
  border: 1px solid #727275;
  border-radius: 50%;
  background: #202022f0;
  color: #fafafa;
  box-shadow: 0 2px 6px #0005;
}
.column-arrow:hover { background: #404043; border-color: #aaa; }
.column-arrow:active { background: #505054; }
.column-arrow::before {
  content: "";
  width: 10px;
  height: 10px;
  border: solid currentColor;
  border-width: 2px 2px 0 0;
}
#backCol { left: calc(var(--category-width) + var(--field-width) - 44px); }
#backCol::before { transform: translateX(2px) rotate(-135deg); }
#forwardCol { right: calc(var(--scrollbar-width, 0px) + 6px); }
#forwardCol::before { transform: translateX(-2px) rotate(45deg); }
@media (pointer: coarse) {
  .column-arrow { width: 44px; height: 44px; }
  #backCol { left: calc(var(--category-width) + var(--field-width) - 48px); }
}
.table-frame {
  container-type: inline-size;
  position: relative;
  isolation: isolate;
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  margin: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border-block: 1px solid #414145;
  background: #202022;
  scrollbar-color: #66666b #242426;
  scrollbar-width: thin;
}
.table-frame:focus-visible { outline-offset: -2px; }
.matrix {
  --cell-width: max(var(--model-width),calc((100cqw - var(--category-width) - var(--field-width)) / var(--column-count)));
  width: max-content;
  border-spacing: 0;
  border-collapse: separate;
  color: var(--text);
  font-size: .865rem;
  line-height: 1.35;
}
.matrix :is(th,td) { border: 0; border-right: 1px solid #38383b; border-bottom: 1px solid #343436; text-align: center; vertical-align: middle; }
.matrix thead th { position: sticky; top: 0; z-index: 4; height: 1px; border-bottom-color: #4a4a4e; background: #1b1b1d; }
.matrix .corner {
  left: 0;
  z-index: 7;
  width: calc(var(--field-width) + var(--category-width));
  min-width: calc(var(--field-width) + var(--category-width));
  padding: 0;
  background: #252527;
  color: #c4c4ca;
  font-size: .8rem;
  font-weight: 560;
}
.matrix .model-head, .matrix td {
  width: var(--cell-width, var(--model-width));
  min-width: var(--cell-width, var(--model-width));
  max-width: var(--cell-width, var(--model-width));
  overflow-wrap: anywhere;
}
.matrix .model-head { padding: 0; }
.matrix .col-head, .matrix .col-labels {
  display: grid;
  height: 100%;
  grid-template-columns: minmax(0,1fr);
  grid-template-rows: auto minmax(2.45em,1fr) auto;
  align-items: center;
  row-gap: 4px;
  padding: 10px 12px;
}
.matrix .col-head { cursor:pointer; }
.matrix .col-head .release-date { grid-area: 1 / 1; padding-inline: 17px; }
.matrix .col-labels > span, .matrix .col-labels small { color:var(--dim); font:.75rem/1.5 var(--sans); }
.matrix .col-head strong, .matrix .col-labels strong { color: #f4f4f6; font-size: .91rem; line-height: 1.3; font-weight: 590; }
.matrix .col-head small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #b9b9c0; font: .75rem/1.35 var(--mono); }
.matrix .col-head input { grid-area: 1 / 1; justify-self: end; margin: 0; width: 14px; height: 14px; accent-color: var(--selection); cursor: pointer; }
.matrix .model-head:hover { background: #28282b; }
.matrix .model-head:has(input:checked) { background: #253f60; box-shadow: inset 0 2px #6aa8f7; }
.matrix tbody tr { --row: #222224; }
.matrix tbody tr:nth-child(even) { --row: #29292b; }
.matrix tbody tr:hover { --row: #333337; }
.matrix td { height: 29px; padding: 4px 9px; background: var(--row); }
.matrix tbody + tbody tr:first-child > * { border-top: 1px solid #4a4a4d; }
.matrix :is(th.category,th.field) { position: sticky; z-index: 2; padding: 5px 8px; line-height: 1.3; overflow-wrap: anywhere; }
.matrix .category { left: 0; width: var(--category-width); min-width: var(--category-width); max-width: var(--category-width); color: #b5b5bd; background: #2d2d30; font-size: .8rem; font-weight: 560; }
.matrix .field { left: var(--category-width); width: var(--field-width); min-width: var(--field-width); max-width: var(--field-width); color: #d4d4d8; background: #2a2a2d; font-weight: 460; box-shadow: 2px 0 3px #1112; }
.matrix .mono, .matrix .numeric { font: .81rem/1.4 var(--mono); font-variant-numeric: tabular-nums; }
.matrix .no { color: #c0c0c5; }
.matrix .muted { color: #919198; }
.matrix .yes { color: #e2e2e6; }
.matrix a.source { display: inline-block; margin: 2px 0; color: var(--accent); text-decoration-color: #6081aa; }
.matrix a.source:hover { text-decoration-color: currentColor; }
.empty-state { max-width: 440px; margin: 0 auto; padding: clamp(40px,12vh,110px) 20px; text-align: center; color: var(--sub); }
.empty-state h2 { margin: 0 0 5px; font-size: 1.02rem; color: var(--text); }
.empty-state p { margin: 4px 0 14px; }
.work-foot { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; min-height: 38px; padding: 6px 16px; color: var(--dim); font-size: .77rem; }
.matrix-pager #pageNumber { min-width: 3.4em; text-align: center; font-variant-numeric: tabular-nums; }
.table-notes { display:flex; align-items:baseline; flex-wrap:wrap; gap:1px 12px; }
.table-notes a { color:var(--sub); }
.work-foot button { min-height: 24px; padding: 2px 7px; font-size: .76rem; }

@media (max-width: 1100px) {
  :root { --sidebar-width: 201px; --category-width: 51px; --field-width: 106px; }
  .tools { gap: 5px; }
}
@media (max-width: 810px) {
  :root { --category-width: 45px; --field-width: 93px; --model-width: 150px; }
  .appbar { flex-wrap: wrap; gap: 4px 9px; min-height: 48px; padding: 7px 12px; }
  .appbar nav { margin-left: auto; }
  .appbar nav a { min-height: 27px; padding: 3px 8px; font-size: .78rem; }
  .appbar .wordmark { font-size: 1.02rem; gap: 7px; }
  .appbar .wordmark::before { width: 17px; height: 15px; }
  .affiliation { flex-basis: 100%; margin-left: 0; font-size: .74rem; }
  #toggleNav { display: inline-flex; min-height: 27px; align-items: center; padding: 3px 7px; }
  .work-area { display: flex; position: relative; }
  .workspace { width: 100%; margin:0; border:0; border-radius:0; }
  .sidebar { display: none; position: absolute; z-index: 8; inset: 0 auto 0 0; width: min(290px,87vw); margin: 4px; box-shadow: 8px 4px 28px #0008; }
  .menu-open .sidebar { display: block; }
  .sidebar :is(.tree-select,.tree-toggle,.side-item,.version-button,.line-button,summary) { min-height: 40px; }
  .work-title { padding: 10px 12px 6px; align-items: baseline; }
  .work-title h1 { font-size: 1.09rem; }
  .tools { padding: 1px 12px 9px; }
  .searchbox { max-width: none; }
  .table-frame { margin:0; }
  .work-foot { padding: 5px 9px; }
  .matrix td, .matrix .field { padding-inline: 6px; }
}
@media (max-width: 380px) {
  .appbar { gap: 4px 6px; padding-inline: 8px; }
  .appbar nav a { padding-inline: 6px; }
  .appbar .wordmark::before { display: none; }
  .matrix-actions { gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .workbench *, .workbench *::before, .workbench *::after { scroll-behavior: auto !important; }
}

.matrix .source-mark {
  width: 1.25em;
  height: 1.25em;
  margin-inline-end: .25em;
  vertical-align: -.24em;
}
