:root {
  color-scheme: light;
  --navy-950: #061630;
  --navy-900: #071a3c;
  --navy-850: #0a2147;
  --blue-600: #195cff;
  --page: #f8f9fb;
  --surface: #fff;
  --surface-subtle: #fbfcfe;
  --text: #152036;
  --muted: #68748a;
  --border: #e1e6ed;
  --input-border: #d8e0ea;
  --group-bg: #e5effd;
  --group-text: #102440;
  --normal-bg: #eff8eb;
  --normal-text: #15732e;
  --degraded-bg: #fff6e6;
  --degraded-text: #b85b10;
  --emergency-bg: #fceef0;
  --emergency-text: #c62232;
  --link: #1757e8;
  --hover: #f2f6fd;
  font-family: Inter, "Segoe UI", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  font-size: 14px;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #101824;
  --surface: #131f2e;
  --surface-subtle: #162334;
  --text: #e7edf7;
  --muted: #a0adc0;
  --border: #293648;
  --input-border: #354256;
  --group-bg: #1b3454;
  --group-text: #dce9fc;
  --normal-bg: #173322;
  --normal-text: #77d795;
  --degraded-bg: #382b1c;
  --degraded-text: #f3b36e;
  --emergency-bg: #3a2027;
  --emergency-text: #ff8c99;
  --link: #8db3ff;
  --hover: #1c2b3d;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 760px;
  height: 100vh;
  margin: 0;
  overflow: hidden;
  background: var(--page);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  display: flex;
  height: 68px;
  align-items: center;
  padding: 0 24px;
  color: #f7f9ff;
  background: linear-gradient(105deg, var(--navy-950), #081b3e 55%, var(--navy-900));
}

.brand {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 120px;
  height: 43px;
  flex-shrink: 0;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.nav-item svg,
.header-select svg,
.theme-toggle svg,
.edit-mode-button svg,
.add-wi-button svg,
.select-box svg,
.search-box svg,
.clear-button svg {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-copy strong {
  font-size: 20px;
  font-weight: 690;
  letter-spacing: -0.55px;
}

.brand-copy > span {
  color: #d4def1;
  font-size: 13px;
}

.topnav {
  display: flex;
  height: 100%;
  align-items: stretch;
  margin-left: 38px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 0;
  color: #f4f7ff;
  background: transparent;
  font-weight: 530;
}

.nav-item svg {
  width: 17px;
  height: 17px;
}

.nav-item:hover {
  background: #ffffff0c;
}

.nav-item.is-active::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 4px;
  background: #2471ff;
  content: "";
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.edit-mode-button,
.add-wi-button {
  display: inline-flex;
  height: 38px;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid #405271;
  border-radius: 4px;
  color: #f5f7fd;
  background: #ffffff08;
  font-size: 12px;
  font-weight: 620;
  white-space: nowrap;
}

.edit-mode-button svg,
.add-wi-button svg {
  width: 16px;
  height: 16px;
}

.edit-mode-button:hover,
.add-wi-button:hover {
  border-color: #6e85ac;
  background: #ffffff14;
}

.edit-mode-button.is-active {
  border-color: #37b877;
  color: #dffbed;
  background: #14845236;
}

.add-wi-button {
  border-color: #2c75ef;
  color: #fff;
  background: #1768dc;
}

.add-wi-button[hidden] {
  display: none;
}

.header-select {
  display: flex;
  height: 38px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid #344464;
  border-radius: 4px;
}

.header-select svg {
  width: 16px;
  height: 16px;
}

.header-select select {
  min-width: 94px;
  border: 0;
  outline: 0;
  color: #f5f7fd;
  background: transparent;
  font-size: 12px;
}

.header-select option {
  color: #fff;
  background: var(--navy-900);
}

.theme-toggle {
  width: 35px;
  height: 35px;
  padding: 5px;
  border: 0;
  border-radius: 4px;
  color: #fff;
  background: transparent;
}

.theme-toggle:hover {
  background: #ffffff13;
}

.theme-toggle .moon-icon,
:root[data-theme="dark"] .theme-toggle .sun-icon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .moon-icon {
  display: block;
}

.workspace {
  display: flex;
  height: calc(100vh - 68px);
  flex-direction: column;
  padding: 0 24px 12px;
}

.toolbar {
  display: flex;
  min-height: 62px;
  align-items: center;
  gap: 13px;
}

.select-box,
.search-box,
.labeled-filter select,
.clear-button {
  height: 36px;
  border: 1px solid var(--input-border);
  border-radius: 3px;
  background: var(--surface);
}

.select-box {
  display: flex;
  min-width: 222px;
  align-items: center;
  gap: 8px;
  padding: 0 9px;
}

.select-box svg {
  width: 17px;
  height: 17px;
  color: var(--blue-600);
}

.select-box select,
.search-box input {
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.select-box select {
  max-width: 205px;
  font-size: 12px;
}

.select-box select option,
.labeled-filter select option {
  color: var(--text);
  background-color: var(--surface);
}

:root[data-theme="dark"] .select-box select,
:root[data-theme="dark"] .labeled-filter select {
  color-scheme: dark;
}

.toolbar-divider {
  width: 1px;
  height: 34px;
  flex-shrink: 0;
  background: var(--border);
}

.search-box {
  display: flex;
  min-width: 235px;
  height: 36px;
  flex: 1 1 390px;
  align-items: center;
  padding: 0 9px;
}

.search-box input {
  font-size: 13px;
}

.search-box input::placeholder {
  color: var(--muted);
}

.search-box svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--muted);
}

.labeled-filter {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
}

.labeled-filter > span {
  white-space: nowrap;
  font-size: 12px;
  font-weight: 570;
}

.labeled-filter select {
  width: 123px;
  padding: 0 8px;
  color: var(--text);
  font-size: 12px;
}

.folder-filter select {
  width: 110px;
}

.clear-button {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  color: var(--blue-600);
  font-size: 12px;
}

.clear-button:hover {
  background: var(--hover);
}

.clear-button svg {
  width: 16px;
  height: 16px;
}

.register {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  border: 1px solid var(--border);
  background: var(--surface);
}

.toolbar[hidden],
.register[hidden],
.asp-section[hidden],
.asp-modal[hidden],
.edit-auth-modal[hidden],
.add-wi-modal[hidden],
.link-editor-modal[hidden],
.pdf-upload-modal[hidden] {
  display: none;
}

.edit-auth-modal,
.add-wi-modal {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  padding: 20px;
  place-items: center;
  background: rgb(3 12 27 / 76%);
}

.edit-auth-dialog,
.add-wi-dialog {
  width: min(470px, 100%);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 22px 70px rgb(0 0 0 / 40%);
}

.add-wi-dialog {
  width: min(720px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.edit-auth-header,
.add-wi-header {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.edit-auth-label,
.add-wi-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.45px;
  text-transform: uppercase;
}

.edit-auth-header h2,
.add-wi-header h2 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 19px;
}

.edit-auth-close,
.add-wi-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  font-size: 27px;
  line-height: 1;
}

.edit-auth-close:hover,
.add-wi-close:hover {
  color: var(--text);
  background: var(--hover);
}

.edit-auth-fields,
.add-wi-fields {
  display: grid;
  gap: 16px;
  padding: 20px 18px 14px;
}

.edit-auth-fields label,
.add-wi-fields label {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.edit-auth-fields label > span,
.add-wi-fields label > span {
  color: var(--text);
  font-size: 12px;
  font-weight: 640;
}

.add-wi-fields label em {
  margin-left: 4px;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 500;
}

.edit-auth-fields input,
.add-wi-fields input,
.add-wi-fields select {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  outline: 0;
  color: var(--text);
  background: var(--surface);
  font-size: 13px;
}

.edit-auth-fields input:focus,
.add-wi-fields input:focus,
.add-wi-fields select:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue-600), transparent 82%);
}

.edit-auth-fields small,
.add-wi-fields small {
  color: var(--muted);
  font-size: 11px;
}

.add-wi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.edit-auth-status,
.add-wi-status {
  min-height: 17px;
  margin: -3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.edit-auth-status.is-error,
.add-wi-status.is-error {
  color: var(--emergency-text);
}

.edit-auth-actions,
.add-wi-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 13px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-subtle);
}

.edit-auth-actions button,
.add-wi-actions button {
  min-width: 92px;
  height: 36px;
  padding: 0 14px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 620;
}

.edit-auth-cancel,
.add-wi-cancel {
  border: 1px solid var(--input-border);
  color: var(--text);
  background: var(--surface);
}

.edit-auth-submit,
.add-wi-save {
  border: 1px solid var(--blue-600);
  color: #fff;
  background: var(--blue-600);
}

.edit-auth-submit:disabled,
.add-wi-save:disabled {
  cursor: wait;
  opacity: 0.65;
}

.asp-section {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

.asp-toolbar {
  display: flex;
  min-height: 86px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.asp-heading h1 {
  margin: 0 0 3px;
  color: var(--text);
  font-size: 19px;
  font-weight: 650;
}

.asp-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.asp-search-grid {
  display: grid;
  width: min(900px, 70%);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.asp-search-field {
  display: grid;
  min-width: 0;
  gap: 5px;
  color: var(--text);
  font-size: 11px;
  font-weight: 620;
}

.asp-search-box {
  width: 100%;
  min-width: 0;
  flex: none;
}

.asp-register {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  border: 1px solid var(--border);
  background: var(--surface);
}

.asp-table {
  width: 100%;
  border-spacing: 0;
  table-layout: fixed;
}

.asp-table thead {
  position: sticky;
  z-index: 2;
  top: 0;
}

.asp-table th {
  height: 36px;
  padding: 0 16px;
  border-right: 1px solid #30415e;
  color: #f8faff;
  background: linear-gradient(180deg, #102448, var(--navy-900));
  font-size: 12px;
  font-weight: 620;
  text-align: left;
}

.asp-table th:last-child {
  border-right: 0;
  text-align: center;
}

.asp-name-column {
  width: 31%;
}

.asp-detail-column {
  width: 51%;
}

.asp-image-column {
  width: 18%;
}

.asp-row td {
  padding: 9px 16px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.asp-row td:last-child {
  border-right: 0;
}

.asp-row:hover td {
  background: var(--hover);
}

.asp-title-button {
  padding: 0;
  border: 0;
  color: var(--link);
  background: transparent;
  font-size: 13px;
  font-weight: 580;
  text-align: left;
}

.asp-title-button:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.asp-detail-main {
  margin: 0;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 560;
  line-height: 1.5;
}

.asp-detail-service,
.asp-detail-shuttle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.asp-detail-service strong,
.asp-detail-shuttle strong {
  color: var(--text);
  font-weight: 580;
}

.asp-preview-cell {
  text-align: center;
}

.asp-preview-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 4px 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--link);
  background: var(--surface);
}

.asp-preview-button:hover {
  border-color: var(--link);
}

.asp-preview-button img {
  display: block;
  width: 92px;
  height: 52px;
  border-radius: 2px;
  background: #fff;
  object-fit: contain;
}

.asp-preview-button span {
  font-size: 11px;
  font-weight: 550;
  white-space: nowrap;
}

.asp-empty-row td {
  height: 130px;
  color: var(--muted);
  text-align: center;
}

.asp-modal {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: grid;
  padding: 24px;
  place-items: center;
  background: rgb(3 12 27 / 78%);
}

.asp-dialog {
  display: flex;
  width: min(1450px, 100%);
  max-height: calc(100vh - 48px);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 22px 70px rgb(0 0 0 / 40%);
}

.asp-dialog-header {
  display: flex;
  min-height: 75px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}

.asp-dialog-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 550;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.asp-dialog-header h2 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 18px;
}

.asp-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  font-size: 27px;
  line-height: 1;
}

.asp-close:hover {
  color: var(--text);
  background: var(--hover);
}

.asp-animation-frame {
  display: grid;
  min-height: 0;
  flex: 1;
  overflow: auto;
  place-items: center;
  background: #fff;
}

.asp-animation-frame img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 210px);
  object-fit: contain;
}

.asp-dialog-footer {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 20px;
  border-top: 1px solid var(--border);
}

.asp-dialog-footer p {
  margin: 0;
  color: var(--text);
  font-size: 12px;
}

.asp-dialog-footer a {
  color: var(--link);
  font-size: 12px;
  white-space: nowrap;
}

.link-editor-modal {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  padding: 20px;
  place-items: center;
  background: rgb(3 12 27 / 72%);
}

.link-editor-dialog {
  width: min(560px, 100%);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 22px 70px rgb(0 0 0 / 38%);
}

.link-editor-header {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.link-editor-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.45px;
  text-transform: uppercase;
}

.link-editor-header h2 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 19px;
}

.link-editor-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  font-size: 27px;
  line-height: 1;
}

.link-editor-close:hover {
  color: var(--text);
  background: var(--hover);
}

.link-editor-fields {
  display: grid;
  gap: 17px;
  padding: 20px 18px 14px;
}

.link-editor-fields label {
  display: grid;
  gap: 7px;
}

.link-editor-fields label > span {
  color: var(--text);
  font-size: 12px;
  font-weight: 640;
}

.link-editor-fields input {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  outline: 0;
  color: var(--text);
  background: var(--surface);
  font-size: 13px;
}

.link-editor-fields input:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue-600), transparent 82%);
}

.link-editor-fields small {
  color: var(--muted);
  font-size: 11px;
}

.assignment-editor-fields {
  display: grid;
  gap: 17px;
  padding: 20px 18px 14px;
}

.assignment-editor-document {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assignment-editor-fields fieldset {
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
}

.assignment-editor-fields legend,
.assignment-condition-field > span {
  padding: 0 4px;
  color: var(--text);
  font-size: 12px;
  font-weight: 640;
}

.assignment-line-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.assignment-line-options label {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  background: var(--surface-subtle);
  font-size: 12px;
  cursor: pointer;
}

.assignment-line-options label:has(input:checked) {
  border-color: var(--blue-600);
  color: var(--link);
  background: color-mix(in srgb, var(--blue-600), transparent 91%);
}

.assignment-line-options input {
  accent-color: var(--blue-600);
}

.assignment-condition-field {
  display: grid;
  gap: 7px;
}

.assignment-condition-field select {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  outline: 0;
  color: var(--text);
  background: var(--surface);
  font-size: 13px;
}

.assignment-condition-field select:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue-600), transparent 82%);
}

.rename-editor-document {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-editor-status {
  min-height: 17px;
  margin: -3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.link-editor-status.is-error {
  color: var(--emergency-text);
}

.link-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 13px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-subtle);
}

.link-editor-actions button {
  min-width: 92px;
  height: 36px;
  padding: 0 14px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 620;
}

.link-editor-cancel {
  border: 1px solid var(--input-border);
  color: var(--text);
  background: var(--surface);
}

.link-editor-save {
  border: 1px solid var(--blue-600);
  color: #fff;
  background: var(--blue-600);
}

.link-editor-save:disabled {
  cursor: wait;
  opacity: 0.65;
}

.pdf-upload-modal {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  padding: 20px;
  place-items: center;
  background: rgb(3 12 27 / 72%);
}

.pdf-upload-dialog {
  width: min(560px, 100%);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 22px 70px rgb(0 0 0 / 38%);
}

.pdf-upload-header {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.pdf-upload-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.45px;
  text-transform: uppercase;
}

.pdf-upload-header h2 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 19px;
}

.pdf-upload-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  font-size: 27px;
  line-height: 1;
}

.pdf-upload-close:hover {
  color: var(--text);
  background: var(--hover);
}

.pdf-upload-fields {
  display: grid;
  gap: 17px;
  padding: 20px 18px 14px;
}

.pdf-upload-document {
  margin: 0;
  padding: 10px 12px;
  border-radius: 4px;
  color: var(--text);
  background: var(--surface-subtle);
  font-size: 12px;
  font-weight: 590;
  line-height: 1.45;
}

.pdf-file-field {
  display: grid;
  gap: 7px;
}

.pdf-file-field > span {
  color: var(--text);
  font-size: 12px;
  font-weight: 640;
}

.pdf-file-picker {
  position: relative;
}

.pdf-file-picker input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.pdf-file-picker label {
  display: flex;
  width: 100%;
  min-height: 43px;
  align-items: stretch;
  justify-content: space-between;
  border: 1px solid var(--input-border);
  border-radius: 4px;
  color: var(--text);
  background: var(--surface);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.pdf-file-picker label:hover {
  border-color: var(--link);
}

.pdf-file-picker input[type="file"]:focus-visible + label {
  border-color: var(--link);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--link), transparent 78%);
}

.pdf-file-name {
  min-width: 0;
  overflow: hidden;
  align-self: center;
  padding: 0 12px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-file-trigger {
  display: inline-flex;
  min-width: 112px;
  align-items: center;
  justify-content: center;
  border-left: 1px solid var(--input-border);
  border-radius: 0 3px 3px 0;
  color: #fff;
  background: var(--blue-600);
  font-weight: 650;
  white-space: nowrap;
}

.pdf-file-picker label:hover .pdf-file-trigger {
  filter: brightness(1.08);
}

.pdf-upload-fields small {
  color: var(--muted);
  font-size: 11px;
}

.pdf-upload-status {
  min-height: 17px;
  margin: -3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.pdf-upload-status.is-error {
  color: var(--emergency-text);
}

.pdf-upload-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 13px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-subtle);
}

.pdf-upload-actions button {
  min-width: 92px;
  height: 36px;
  padding: 0 14px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 620;
}

.pdf-upload-cancel {
  border: 1px solid var(--input-border);
  color: var(--text);
  background: var(--surface);
}

.pdf-upload-save {
  border: 1px solid var(--blue-600);
  color: #fff;
  background: var(--blue-600);
}

.pdf-upload-save:disabled {
  cursor: wait;
  opacity: 0.65;
}

.table-scroll {
  min-height: 0;
  flex: 1;
  overflow: auto;
  scrollbar-color: #aab7c9 transparent;
  scrollbar-width: thin;
}

.document-table {
  width: 100%;
  border-spacing: 0;
  table-layout: fixed;
}

.document-table thead {
  position: sticky;
  z-index: 2;
  top: 0;
}

.document-table th {
  height: 32px;
  border-right: 1px solid #30415e;
  color: #f8faff;
  background: linear-gradient(180deg, #102448, var(--navy-900));
}

.document-table th:last-child,
.document-table td:last-child {
  border-right: 0;
}

.document-table th button {
  display: flex;
  width: 100%;
  height: 32px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 8px;
  border: 0;
  color: inherit;
  background: transparent;
  font-size: 12px;
  font-weight: 620;
  white-space: nowrap;
}

.title-column button {
  justify-content: flex-start !important;
}

.sort-indicator {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: auto;
  transform: rotate(45deg) translateY(-2px);
  border-right: 1px solid #a8b8d3;
  border-bottom: 1px solid #a8b8d3;
}

th[data-direction="ascending"] .sort-indicator {
  transform: rotate(225deg) translate(-2px, -1px);
  border-color: #fff;
}

th[data-direction="descending"] .sort-indicator {
  border-color: #fff;
}

.serial-column {
  width: 73px;
}

.title-column {
  width: 30%;
}

.reference-column {
  width: 21%;
}

.wi-pdf-column {
  width: 190px;
  padding: 0 8px;
  font-size: 11px;
}

.line-column {
  width: 105px;
}

.condition-column {
  width: 150px;
}

.folder-column {
  width: 12%;
}

.document-table td {
  height: 29px;
  padding: 4px 12px;
  overflow: hidden;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 12.7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-row:hover td {
  background: var(--hover);
}

.serial-cell,
.line-cell,
.condition-cell {
  text-align: center;
}

.title-cell {
  font-weight: 495;
}

.title-entry {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.title-entry > span {
  min-width: 0;
  overflow: hidden;
  flex: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-row-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 5px;
}

.remove-wi-button {
  height: 23px;
  flex-shrink: 0;
  padding: 0 7px;
  border: 1px solid color-mix(in srgb, var(--emergency-text), transparent 45%);
  border-radius: 3px;
  color: var(--emergency-text);
  background: var(--surface);
  font-size: 10.5px;
  font-weight: 620;
}

.remove-wi-button:hover,
.remove-wi-button:focus-visible {
  border-color: var(--emergency-text);
  background: color-mix(in srgb, var(--emergency-bg), var(--surface) 45%);
}

.rename-wi-button {
  height: 23px;
  flex-shrink: 0;
  padding: 0 7px;
  border: 1px solid var(--input-border);
  border-radius: 3px;
  color: var(--link);
  background: var(--surface);
  font-size: 10.5px;
  font-weight: 620;
}

.rename-wi-button:hover,
.rename-wi-button:focus-visible {
  border-color: var(--link);
  background: var(--hover);
}

.reference-cell {
  text-align: center;
}

.reference-editor {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reference-content {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-edit-button {
  height: 23px;
  flex-shrink: 0;
  padding: 0 8px;
  border: 1px solid var(--input-border);
  border-radius: 3px;
  color: var(--link);
  background: var(--surface);
  font-size: 10.5px;
  font-weight: 620;
}

.link-edit-button:hover,
.link-edit-button:focus-visible {
  border-color: var(--link);
  background: var(--hover);
}

.wi-pdf-cell {
  text-align: center;
}

.wi-pdf-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.wi-pdf-open,
.wi-pdf-upload {
  height: 23px;
  padding: 0 7px;
  border: 1px solid var(--input-border);
  border-radius: 3px;
  font-size: 10.5px;
  font-weight: 620;
  line-height: 21px;
  white-space: nowrap;
}

.wi-pdf-open {
  color: #fff;
  background: var(--blue-600);
  text-decoration: none;
}

.wi-pdf-missing {
  color: var(--muted);
  font-size: 11px;
}

.wi-pdf-upload {
  color: var(--link);
  background: var(--surface);
}

.wi-pdf-open:hover,
.wi-pdf-open:focus-visible,
.wi-pdf-upload:hover,
.wi-pdf-upload:focus-visible {
  border-color: var(--link);
  filter: brightness(0.96);
}

.reference-link {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link), transparent 38%);
  text-underline-offset: 2px;
}

.reference-link:hover {
  color: var(--blue-600);
  text-decoration-thickness: 2px;
}

.reference-without-link {
  color: var(--text);
}

.condition-cell.is-normal {
  color: var(--normal-text);
}

.condition-cell.is-degraded {
  color: var(--degraded-text);
}

.condition-cell.is-emergency {
  color: var(--emergency-text);
  font-weight: 560;
}

.assignment-entry {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.assignment-entry > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.assignment-edit-button {
  height: 23px;
  flex-shrink: 0;
  padding: 0 8px;
  border: 1px solid var(--input-border);
  border-radius: 3px;
  color: var(--link);
  background: var(--surface);
  font-size: 10.5px;
  font-weight: 620;
}

.assignment-edit-button:hover,
.assignment-edit-button:focus-visible {
  border-color: var(--link);
  background: var(--hover);
}

.folder-entry {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.folder-entry > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group-row td,
.condition-row td {
  height: 28px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.15px;
}

.group-row td {
  color: var(--group-text);
  background: var(--group-bg);
}

.group-row .group-code,
.condition-row .group-code {
  text-align: center;
}

.condition-row.is-normal td {
  color: var(--normal-text);
  background: var(--normal-bg);
}

.condition-row.is-degraded td {
  color: var(--degraded-text);
  background: var(--degraded-bg);
}

.condition-row.is-emergency td {
  color: var(--emergency-text);
  background: var(--emergency-bg);
}

.condition-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.condition-heading > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-add-button {
  height: 23px;
  flex-shrink: 0;
  padding: 0 10px;
  border: 1px solid #4a8cff;
  border-radius: 3px;
  color: #fff;
  background: var(--blue-600);
  font-size: 10.5px;
  font-weight: 680;
}

.quick-add-button:hover,
.quick-add-button:focus-visible {
  border-color: #9fc0ff;
  filter: brightness(1.1);
}

.quick-add-row td {
  height: 42px;
  padding: 4px 7px;
  background: color-mix(in srgb, var(--blue-600), var(--surface) 94%);
}

.quick-add-row:hover td {
  background: color-mix(in srgb, var(--blue-600), var(--surface) 90%);
}

.quick-add-serial {
  padding: 0 !important;
}

.quick-add-remove {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--emergency-text), transparent 35%);
  border-radius: 50%;
  color: #fff;
  background: color-mix(in srgb, var(--emergency-text), #8d1024 35%);
  font-size: 20px;
  font-weight: 700;
  line-height: 21px;
}

.quick-add-remove:hover,
.quick-add-remove:focus-visible {
  border-color: #fff;
  filter: brightness(1.12);
}

.quick-add-input {
  width: 100%;
  height: 30px;
  min-width: 0;
  padding: 0 8px;
  border: 1px solid var(--input-border);
  border-radius: 3px;
  outline: 0;
  color: var(--text);
  background: var(--surface);
  font-size: 12px;
}

.quick-add-input:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--blue-600), transparent 80%);
}

.quick-add-actions-cell {
  text-align: center;
}

.quick-add-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.quick-add-save {
  height: 25px;
  padding: 0 8px;
  border-radius: 3px;
  font-size: 10.5px;
  font-weight: 650;
}

.quick-add-save {
  border: 1px solid var(--blue-600);
  color: #fff;
  background: var(--blue-600);
}

.quick-add-save:disabled {
  cursor: wait;
  opacity: 0.65;
}

.empty-row td {
  height: 150px;
  color: var(--muted);
  text-align: center;
}

.results-bar {
  display: flex;
  height: 45px;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.results-summary {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 1460px) {
  .topbar {
    padding: 0 18px;
  }

  .workspace {
    padding-right: 18px;
    padding-left: 18px;
  }

  .toolbar {
    gap: 9px;
  }

  .select-box {
    min-width: 187px;
  }

  .labeled-filter select {
    width: 107px;
  }

  .folder-filter select {
    width: 88px;
  }
}

@media (max-width: 1190px) {
  body {
    overflow: auto;
  }

  .workspace {
    height: calc(100vh - 68px);
  }

  .topnav {
    margin-left: 20px;
  }

  .nav-item {
    padding-right: 9px;
    padding-left: 9px;
  }

  .toolbar {
    min-height: 106px;
    flex-wrap: wrap;
    align-content: center;
    row-gap: 9px;
  }

  .search-box {
    min-width: 330px;
    flex: 1 1 55%;
  }

  .toolbar-divider {
    display: none;
  }

  .asp-toolbar {
    align-items: stretch;
    flex-direction: column;
    padding: 12px 0;
  }

  .asp-search-grid {
    width: 100%;
  }
}

@media (max-width: 850px) {
  .topnav {
    margin-left: 12px;
  }

  .nav-item span {
    display: none;
  }

  .nav-item svg {
    width: 19px;
    height: 19px;
  }

  .edit-mode-button span,
  .add-wi-button span {
    display: none;
  }

  .edit-mode-button,
  .add-wi-button {
    width: 38px;
    justify-content: center;
    padding: 0;
  }

  .add-wi-grid {
    grid-template-columns: 1fr;
  }

  .brand-copy strong {
    font-size: 17px;
  }

  .document-table {
    min-width: 1150px;
  }

  .results-summary {
    font-size: 11px;
  }
}

@media print {
  body {
    height: auto;
    overflow: visible;
    background: #fff;
  }

  .topbar-actions,
  .topnav,
  .toolbar,
  .results-bar {
    display: none;
  }

  .workspace,
  .table-scroll {
    height: auto;
    overflow: visible;
  }

  .register {
    border: 0;
  }
}
