* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --actions-column-width: 62px;

  /* Preferred and minimum column widths */
  --mrm-width: 110px;
  --mrm-min-width: 100px;

  --mrnc-width: 125px;
  --mrnc-min-width: 105px;

  --stable-width: 105px;
  --stable-min-width: 80px;

  --mrm-picture-width: 220px;
  --mrm-picture-min-width: 180px;

  --mrnc-picture-width: 420px;
  --mrnc-picture-min-width: 350px;

  --components-width: 115px;
  --components-min-width: 95px;

  --components-width-mrnc: 115px;
  --components-min-width-mrnc: 95px;

  --component-group-width: 170px;
  --component-group-min-width: 140px;

  --conductor-width: 110px;
  --conductor-min-width: 80px;

  --wild-width: 115px;
  --wild-min-width: 90px;

  --discriminant-width: 125px;
  --discriminant-min-width: 100px;

  --omega-width: 145px;
  --omega-min-width: 120px;

  --header-background: #34495e;
  --table-border: #d8dde3;
}

/* Page */

body {
  padding: 6px;
  color: #222;
  background-color: #f5f6f8;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

.container {
  width: 100%;
  padding: 16px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgb(0 0 0 / 10%);
}

h1 {
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
  font-size: 1.6rem;
  font-weight: 400;
  text-align: left;
}

/* Table introduction and guide */

.table-introduction,
.ai-use-declaration {
  color: #3f474e;
  font-size: 0.87rem;
  line-height: 1.55;
}

.table-introduction {
  margin-bottom: 16px;
}

.ai-use-declaration {
  margin-top: 32px;
}

.table-introduction > p:first-child {
  width: 100%;
  margin-bottom: 10px;
}

.table-guide {
  width: 100%;
  border: 1px solid var(--table-border);
  border-radius: 6px;
  background: #f8f9fa;
}

.table-guide summary {
  padding: 8px 11px;
  color: #34495e;
  cursor: pointer;
  font-weight: 500;
  user-select: none;
}

.table-guide[open] summary {
  border-bottom: 1px solid #e1e4e8;
}

.table-guide-content {
  padding: 12px 14px 14px;
}

.table-guide-content a,
.paper-reference a {
  color: #315f85;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.table-guide-content a:hover,
.paper-reference a:hover {
  color: #1f496b;
}

.paper-reference {
  margin-bottom: 13px;
}

.table-guide dl {
  display: grid;
  grid-template-columns: minmax(175px, 225px) minmax(0, 1fr);
  gap: 8px 18px;
}

.table-guide dt {
  color: #34495e;
  font-weight: 600;
}

.table-guide dd {
  margin: 0;
}

.controls-help {
  width: 100%;
  margin-top: 9px;
  color: #65717c;
  font-size: 0.78rem;
}

/* Controls */

.controls {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.row-tools,
#toggler {
  padding: 12px;
  border: 1px solid var(--table-border);
  border-radius: 7px;
  background: white;
}

.row-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px 14px;
}

.row-tool-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.row-tool-buttons button {
  padding: 7px 10px;
  border: 1px solid #cfd5dc;
  border-radius: 5px;
  background: #f8f9fa;
  color: #34495e;
  cursor: pointer;
  font: inherit;
  font-size: 0.75rem;
}

.row-tool-buttons button:hover:not(:disabled) {
  background: #edf2f6;
}

.row-tool-buttons button.active {
  border-color: #537a9d;
  background: #e8f1f8;
  color: #244d70;
}

.row-tool-buttons button:disabled {
  opacity: 0.45;
  cursor: default;
}

.row-tools-help {
  flex: 1 0 100%;
  color: #65717c;
  font-size: 0.73rem;
}

.row-count {
  flex: 1 0 100%;
  color: #66717c;
  font-size: 0.76rem;
  font-weight: 600;
}

#toggler {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#toggler label {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid #e0e3e7;
  border-radius: 4px;
  background-color: #f8f9fa;
  font-size: 0.68rem;
}

/* Scrollable table panel */

.table-wrapper {
  position: relative;
  height: 100vh;
  min-height: 500px;
  overflow: auto;
  border: 1px solid var(--table-border);
  border-radius: 6px;
  isolation: isolate;
}

/*
 * The table fills the available width when its visible columns fit.
 * When their minimum/content widths exceed the wrapper, the table becomes
 * wider and the wrapper supplies horizontal scrolling.
 */
table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
  background-color: white;
}

th,
td {
  padding: 4px 6px;
  border-right: 1px solid var(--table-border);
  border-bottom: 1px solid var(--table-border);
  background-clip: padding-box;
  text-align: center;
  vertical-align: middle;
  overflow-wrap: break-word;
  font-size: 0.82rem;
}

/* Sticky heading */

thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 7px 6px;
  color: white;
  background-color: var(--header-background);
  box-shadow: 0 2px 0 rgb(0 0 0 / 14%);
  white-space: normal;
  font-size: 0.78rem;
  font-weight: 400;
}

tbody th[scope="row"] {
  white-space: nowrap;
  background-color: white;
  font-weight: 400;
}

/* Row colours */

tbody tr.row-stripe-odd > * {
  background-color: #f8f9fa;
}

tbody tr:hover > * {
  background-color: #eaf2f8 !important;
}

tbody tr.row-selected > * {
  background-color: #dceeff !important;
}

tbody tr.row-pinned > * {
  position: sticky;
  top: var(--pinned-top, var(--sticky-header-height, 0px));
  z-index: 6;
  background-color: #fff2e2 !important;
  box-shadow: 0 1px 0 #d8c3a9;
}

tbody tr.row-pinned > .col-actions {
  z-index: 9;
  box-shadow: inset 3px 0 0 #b66f2a, 0 1px 0 #d8c3a9;
}

tbody tr.row-pinned > .col-nu {
  z-index: 8;
}

tbody tr.row-selected.row-pinned > * {
  background-color: #e9edf3 !important;
}

tbody tr.row-selected.row-pinned > .col-actions {
  box-shadow: inset 3px 0 0 #6b7f93, 0 1px 0 #c6ced6;
}

/* Sticky action column */

.col-actions {
  position: sticky;
  left: 0;
  z-index: 3;
  width: var(--actions-column-width);
  min-width: var(--actions-column-width);
  max-width: var(--actions-column-width);
  padding-right: 4px;
  padding-left: 4px;
}

thead .col-actions {
  z-index: 13;
  background-color: var(--header-background);
}

.row-actions {
  white-space: nowrap;
  background: #fff;
}

/* Sticky MRM reduction-type column */

.col-nu {
  position: sticky;
  left: var(--actions-column-width);
  z-index: 2;
  width: var(--mrm-width);
  min-width: var(--mrm-min-width);
  box-shadow: 2px 0 0 rgb(52 73 94 / 16%);
}

thead .col-nu {
  z-index: 12;
  background-color: var(--header-background);
}

/* Row selection and pinning */

.row-selector {
  width: 14px;
  height: 14px;
  vertical-align: middle;
  cursor: pointer;
  accent-color: #47779f;
}

.pin-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 21px;
  height: 21px;
  margin-left: 3px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #8a949d;
  cursor: pointer;
  line-height: 1;
  vertical-align: middle;
}

.pin-button svg {
  display: block;
  width: 13px;
  height: 13px;
}

.pin-button:hover {
  color: #6a7782;
  background: #eef1f3;
}

.pin-button[aria-pressed="true"] {
  color: #9d571b;
  background: #f6dfc8;
}

.pin-button[aria-pressed="true"]:hover {
  color: #81420f;
  background: #efd0b1;
}

/* Column sizing */

/*
 * These are preferred widths, not rigid widths. The minimum widths prevent
 * columns from becoming unusably narrow, while the browser can distribute
 * spare width among the visible columns when the table fits in the window.
 */

.col-mrnc {
  width: var(--mrnc-width);
  min-width: var(--mrnc-min-width);
}

.col-stable {
  width: var(--stable-width);
  min-width: var(--stable-min-width);
}

.col-mrm-pic {
  width: var(--mrm-picture-width);
  min-width: var(--mrm-picture-min-width);
}



.col-mrnc-pic {
  width: var(--mrnc-picture-width);
  min-width: var(--mrnc-picture-min-width);
  overflow: visible;
}

.col-components-mrnc {
  width: var(--components-mrnc-width);
  min-width: var(--components-mrnc-min-width);
}

.col-components {
  width: var(--components-width);
  min-width: var(--components-min-width);
}

.col-component {
  width: var(--component-group-width);
  min-width: var(--component-group-min-width);
}

.col-conductor {
  width: var(--conductor-width);
  min-width: var(--conductor-min-width);
}

.col-wild {
  width: var(--wild-width);
  min-width: var(--wild-min-width);
}


.col-discriminant {
  width: var(--discriminant-width);
  min-width: var(--discriminant-min-width);
}

.col-omega {
  width: var(--omega-width);
  min-width: var(--omega-min-width);
}

/* Special-fibre pictures */

tbody .col-mrm-pic,
tbody .col-mrnc-pic {
  padding: 4px 6px;
}

tbody .col-mrm-pic:has(img.special-fibre) {
  padding: 18px 16px;
}

tbody .col-mrnc-pic:has(img.special-fibre) {
  padding: 26px 36px;
}


.special-fibre {
  display: block;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0 auto;

  zoom: 1.5;
}


[hidden] {
  display: none !important;
}

/* Mobile */

@media (max-width: 700px) {
  .table-guide dl {
    display: block;
  }

  .table-guide dt {
    margin-top: 10px;
  }

  .table-guide dt:first-child {
    margin-top: 0;
  }

  body {
    padding: 0;
  }

  .container {
    padding: 16px 10px;
    border-radius: 0;
  }

  .table-wrapper {
    height: calc(100vh - 230px);
    min-height: 420px;
  }}

  .nu-type-line {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 1.1rem;
    white-space: nowrap;
  }
  
  .nu-type {
    flex: 0 0 auto;
  }
  
  .parameter-range {
    flex: 0 0 auto;
    font-size: 0.68rem;
    font-weight: 400;
    color: #666;
  }

  .nu-bracket {
    display: inline-block;
    font-size: 1.25em;
    line-height: 1;
    vertical-align: -0.04em;
  }

  .col-example {
    width: 60px;
    min-width: 60px;
  }
  
 /* .col-mrnc-components {
    width: 60px;
    min-width: 60px;
    text-align: center;
  }*/
  
  .col-monodromy {
    width: 60px;
    min-width: 60px;
    text-align: center;
  }
  
  .col-cluster-pics {
    width: 60px;
    min-width: 60px;
  }

  .nu-label-and-page {
    display: inline-flex;
    align-items: baseline;
    gap: 0.3rem;
  }
  
  .nu-page {
    font-size: 0.72rem;
    font-weight: 400;
    color: #666;
    white-space: nowrap;
  }
  .nu-component-key {
    width: auto;
    margin: 0.7rem 0 0.9rem;
    border-collapse: collapse;
  }
  
  .nu-component-key th,
  .nu-component-key td {
    padding: 0.35rem 0.75rem;
    border: 1px solid #d4d8dd;
    text-align: center;
    vertical-align: middle;
  }
  
  .table-guide .nu-component-key {
    display: inline-table;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100%;
    table-layout: auto;
    margin: 0.35rem 0 0.55rem;
    font-size: 0.82rem;
  }
  
  .table-guide .nu-component-key th,
  .table-guide .nu-component-key td {
    width: auto !important;
    min-width: 0 !important;
    padding: 0.16rem 0.4rem;
    white-space: nowrap;
    text-align: center;
  }

  .cluster-picture-list {
    display: flex;
    flex-direction: row;
    align-items: left;
    justify-content: left;
    gap: 1.25rem;
    flex-wrap: nowrap;
  }
  
  .cluster-picture {
    display: block;
    width: auto;
    height: auto;
    max-width: 320px;
    max-height: 210px;
    flex: 0 0 auto;
    zoom: 150%;
  }

  .col-cluster-pics {
    overflow-x: auto;
  }
