* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  color: #222;
  background: #f5f6f8;
}

.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: #6f1d3d;
  color: #fff;
}

.top-nav nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-title-chip {
  background: #c6889f;
  color: #2a0d18;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 4px;
  min-width: 140px;
}

.nav-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.55);
  display: inline-block;
}

.top-nav a,
.dropdown-toggle {
  color: #fff;
  text-decoration: none;
  border: 0;
  background: none;
  font-size: 14px;
  cursor: pointer;
}

.top-nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-nav-right span,
.top-nav-right a {
  font-size: 14px;
}

.project-switch-form {
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.project-switch-select {
  height: 24px;
  min-width: 96px;
  width: 96px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 12px;
  padding: 0 4px;
}

.project-switch-select option {
  color: #222;
}

.dropdown {
  position: relative;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 24px;
  left: 0;
  min-width: 220px;
  background: #fff;
  color: #222;
  border: 1px solid #ddd;
  border-radius: 4px;
  z-index: 10;
}

.dropdown-menu a {
  display: block;
  padding: 8px 10px;
  color: #222;
}

.dropdown.open .dropdown-menu {
  display: block;
}

.page-content {
  padding: 14px;
}

.panel {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
}

.split-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
}

.split-layout > .panel {
  min-width: 0;
}

.animals-layout {
  grid-template-columns: 4fr 1fr;
}

.tests-layout {
  --tests-right-panel-width: 260px;
  grid-template-columns: minmax(0, 1fr) 10px minmax(220px, var(--tests-right-panel-width));
  min-height: calc(100vh - 110px);
  align-items: stretch;
}

.tests-layout > .panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#tests-grid {
  flex: 1 1 auto;
  min-height: 0;
}

.tests-vertical-splitter {
  cursor: col-resize;
  border-left: 2px solid #d7dbe0;
  border-right: 2px solid #d7dbe0;
  border-radius: 4px;
  background: linear-gradient(to right, #f5f7fa, #eef2f7);
  margin: 0 4px;
}

.tests-vertical-splitter:hover {
  border-left-color: #9db4d8;
  border-right-color: #9db4d8;
}

.grid-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.danger-btn {
  background: #b42318;
  color: #fff;
  border: 1px solid #8e1a12;
}

.shipment-top-toolbar {
  align-items: center;
}

.shipment-send-btn {
  font-weight: 700;
  background: #16794a;
  color: #fff;
  border: 1px solid #0f5d39;
}

.shipment-items-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}

.shipment-section-title {
  margin: 0;
}

.shipment-items-toolbar {
  margin-bottom: 0;
  justify-content: flex-end;
}

.shipment-divider {
  height: 0;
  border-top: 2px solid #c7c7c7;
  border-bottom: 2px solid #c7c7c7;
  margin: 10px 0;
}

.shipment-request-tests-section {
  margin-top: 10px;
  width: 460px;
  max-width: 100%;
  background: #e9e9ee;
  border: 1px solid #cfcfd8;
  border-radius: 4px;
  padding: 10px;
}

.shipment-request-tests-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.shipment-request-test-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
}

.shipment-request-test-row select {
  width: 260px;
  min-width: 260px;
  max-width: 260px;
  flex: 0 0 auto;
}

.shipment-request-tests-submit-wrap {
  justify-content: flex-start;
  margin-top: 8px;
}

.side-panel {
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  overflow-x: hidden;
}

.tests-results-panel {
  max-height: none;
  height: 100%;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-block {
  padding: 8px;
  border: 1px solid #ddd;
  background: #fafafa;
  border-radius: 4px;
}

.tests-detail-compact {
  gap: 6px;
}

.tests-detail-compact .detail-block {
  padding: 6px;
  font-size: 12px;
  line-height: 1.2;
}

.tests-detail-compact .detail-block > div {
  margin-bottom: 2px;
}

.tests-detail-compact .detail-block > div:last-child {
  margin-bottom: 0;
}

.tests-animal-mini-map {
  width: 100%;
  height: 130px;
  border: 1px solid #d5d5d5;
  border-radius: 4px;
  margin-top: 4px;
}

.tests-adv-filter-modal-card {
  width: min(900px, 96vw);
}

.tests-adv-filter-controls {
  display: grid;
  grid-template-columns: 80px 180px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.tests-adv-filter-rows {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}

.tests-adv-filter-row {
  display: grid;
  grid-template-columns: minmax(110px, 160px) 64px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.tests-adv-filter-row > * {
  min-width: 0;
}

.tests-adv-filter-row select,
.tests-adv-filter-row input,
.tests-adv-filter-value-wrap {
  width: 100%;
}

.tests-adv-filter-row button {
  min-width: 34px;
  width: 34px;
  padding: 4px 0;
}

.form-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 6px 8px;
  align-items: center;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
}

.list-box {
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
}

.list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid #eee;
}

.list-row:last-child {
  border-bottom: 0;
}

.list-row.shipment-request-test-row {
  justify-content: flex-start;
  gap: 6px;
}

.mobile-scan-nav-toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 3000;
  min-width: 280px;
  max-width: 420px;
  background: #1f2937;
  color: #fff;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  padding: 10px 12px;
}

.mobile-scan-nav-toast-text {
  margin-bottom: 8px;
  line-height: 1.35;
}

.mobile-scan-nav-toast-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.mobile-scan-nav-toast-actions button {
  padding: 4px 10px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay[hidden] {
  display: none !important;
}

.modal-card {
  width: min(520px, 92vw);
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 14px;
}

.bulk-delete-preview-card {
  width: min(920px, 96vw);
  max-height: 88vh;
  overflow: auto;
}

.bulk-delete-preview-note {
  color: #a15c00;
}

.bulk-delete-preview-list-wrap {
  margin-top: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 8px;
}

.bulk-delete-preview-table {
  width: 100%;
  border-collapse: collapse;
}

.bulk-delete-preview-table th,
.bulk-delete-preview-table td {
  border: 1px solid #e3e3e3;
  padding: 6px;
  vertical-align: top;
  text-align: left;
}

.bulk-delete-preview-table pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.multiply-edit-modal-card {
  width: min(720px, 96vw);
  border: 2px solid #b42318;
}

.multiply-edit-warning {
  margin: 0 0 10px 0;
  color: #b42318;
  font-weight: 700;
}

.multiply-edit-selected-count {
  margin: 0 0 10px 0;
  color: #344054;
  font-size: 13px;
}

.multiply-edit-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.multiply-edit-field-row {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 8px;
  align-items: center;
}

.multiply-edit-field-toggle {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 13px;
}

#animals-map {
  width: 100%;
  aspect-ratio: 5 / 4;
  height: auto;
  border: 1px solid #ddd;
}

.grid-scroll-wrap {
  width: 100%;
  overflow: visible;
}

.grid-host {
  width: 100%;
  overflow-x: scroll;
  overflow-y: hidden;
}

.animals-grid-wrap {
  max-height: none;
  overflow: visible;
}

.animals-samples-section {
  margin-top: 10px;
}

.animals-samples-toolbar {
  justify-content: space-between;
  align-items: center;
}

.animals-samples-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.animals-samples-actions .danger-btn {
  background: #b42318;
  color: #fff;
  border: 1px solid #8e1a12;
}

.animals-samples-grid-wrap {
  max-height: none;
  overflow: visible;
}

.samples-tissues-grid-wrap {
  max-height: none;
  overflow: visible;
}

.samples-aliquots-section {
  margin-top: 10px;
}

.samples-meta-line {
  margin: 2px 0 6px;
  font-size: 12px;
  line-height: 1.35;
  color: #3c4a5c;
}

.samples-horizontal-splitter,
.tables-horizontal-splitter {
  height: 10px;
  margin: 6px 0;
  cursor: row-resize;
  border-top: 2px solid #d7dbe0;
  border-bottom: 2px solid #d7dbe0;
  border-radius: 4px;
  background: linear-gradient(to bottom, #f5f7fa, #eef2f7);
}

.samples-horizontal-splitter:hover,
.tables-horizontal-splitter:hover {
  border-top-color: #9db4d8;
  border-bottom-color: #9db4d8;
}

.samples-aliquots-grid-wrap {
  max-height: none;
  overflow: visible;
}

.animals-side-actions {
  align-items: center;
}

.animals-side-actions .danger-btn {
  margin-left: auto;
  background: #b42318;
  color: #fff;
  border: 1px solid #8e1a12;
}

.animals-modal-card {
  width: min(1100px, 96vw);
  max-height: 92vh;
  overflow: auto;
}

.animals-sample-modal-card {
  width: min(520px, 92vw);
}

.animals-sample-form {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px;
  align-items: center;
}

.animals-sample-form input,
.animals-sample-form select {
  width: 100%;
}

.animals-modal-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
  gap: 12px;
}

.animals-modal-form {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px;
  align-items: center;
}

.animals-modal-form textarea,
.animals-modal-form input,
.animals-modal-form select {
  width: 100%;
}

.animals-modal-map-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#animals-edit-map {
  width: 100%;
  min-height: 300px;
  border: 1px solid #ddd;
}

.animals-files-sections {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.animals-files-section {
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  padding: 8px;
}

.animals-files-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.animals-files-header h3 {
  margin: 0;
  font-size: 15px;
}

.animals-existing-files,
.animals-upload-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.animals-docs-drop-zone {
  border: 1px dashed #999;
  border-radius: 6px;
  padding: 10px;
  text-align: center;
  color: #555;
  background: #fafafa;
  margin-bottom: 8px;
}

.animals-docs-drop-zone.dragover {
  border-color: #6f1d3d;
  background: #f3e7ed;
}

.animals-file-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
}

.animals-doc-file-row {
  grid-template-columns: 1fr 1fr auto;
}

.animals-file-row button {
  min-width: 28px;
}

.animals-existing-file-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
  padding: 4px 6px;
  border: 1px solid #eee;
  border-radius: 4px;
}

.animals-modal-error {
  color: #b42318;
  font-size: 13px;
  margin-top: 8px;
  min-height: 18px;
}

.animals-modal-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

#tests-form-modal .animals-sample-modal-card,
#tests-bulk-edit-modal .animals-sample-modal-card {
  width: min(780px, 96vw);
}

#tests-form-upload-section,
#tests-bulk-upload-section {
  grid-column: 1 / -1;
  width: calc(100% + 28px);
  margin-left: -14px;
  margin-right: -14px;
  border-left: 0;
  border-right: 0;
  border-radius: 0;
  padding: 10px 14px;
}

#tests-bulk-edit-modal .animals-sample-form {
  grid-template-columns: 160px minmax(0, 1fr);
  justify-content: stretch;
  align-content: start;
}

.tests-date-input-wrap {
  position: relative;
  width: 100%;
}

.tests-date-input-wrap input[type="text"] {
  padding-right: 28px;
}

.tests-date-picker-arrow {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.tests-date-picker-arrow::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -35%);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 6px solid #555;
}

.tests-date-picker-arrow:hover::before {
  border-top-color: #222;
}

.tests-code-input-wrap {
  position: relative;
  width: 100%;
}

.tests-code-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 35;
  max-height: 220px;
  overflow: auto;
  background: #fff;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  box-shadow: 0 6px 16px rgba(16, 24, 40, 0.12);
}

.tests-code-suggestion-item {
  padding: 6px 8px;
  cursor: pointer;
  font-size: 13px;
}

.tests-code-suggestion-item:hover {
  background: #f2f4f7;
}

#tests-form-upload-section .animals-doc-file-row,
#tests-bulk-upload-section .animals-doc-file-row,
#tests-form-upload-section .animals-existing-file-row {
  grid-template-columns: minmax(0, 1fr) minmax(180px, 260px) auto;
}

.tests-upload-delete-btn {
  min-width: 52px !important;
  width: 52px;
  padding: 2px 6px;
  font-size: 11px;
  line-height: 1.2;
}

.grid-fixed-rows tbody {
  display: block;
  max-height: var(--grid-body-max-height, 360px);
  overflow-y: auto;
  overflow-x: hidden;
}

.grid-fixed-rows thead,
.grid-fixed-rows tbody tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.grid-fixed-rows thead tr.grid-filter-row th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #fff;
}

.grid-fixed-rows thead tr.grid-header-row th {
  position: sticky;
  top: 34px;
  z-index: 3;
  background: #fff;
}

.animals-thumbnails {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.animals-attachments {
  margin: 8px 0;
}

.animals-attachments-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.animals-attachment-link-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.animals-attachments-list a {
  font-size: 12px;
}

.file-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid #d3c0c8;
  background: #f3e7ed;
  color: #4a1a2c;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.02em;
}

.animals-thumbnail {
  width: 88px;
  height: 88px;
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.animals-thumbnail img {
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
}

.animals-thumbnail-label {
  width: 88px;
  font-size: 11px;
  color: #555;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.animals-detail-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.animals-detail-card {
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  padding: 8px;
}

.animals-detail-line {
  font-size: 13px;
  margin-bottom: 4px;
}

.animals-detail-line:last-child {
  margin-bottom: 0;
}

table.animals-grid th:nth-child(1),
table.animals-grid td:nth-child(1) {
  width: 32px;
  min-width: 32px;
  max-width: 32px;
  padding-left: 4px;
  padding-right: 4px;
}

table.animals-grid th:nth-child(2),
table.animals-grid td:nth-child(2) {
  width: 42px;
  min-width: 42px;
  max-width: 42px;
  padding-left: 4px;
  padding-right: 4px;
}

table.animals-grid th:nth-child(3),
table.animals-grid td:nth-child(3) {
  width: 135px;
  min-width: 135px;
  max-width: 135px;
  padding-left: 4px;
  padding-right: 4px;
}

table.animals-grid th:nth-child(4),
table.animals-grid td:nth-child(4) {
  width: 132px;
  min-width: 132px;
  max-width: 132px;
  padding-left: 4px;
  padding-right: 4px;
}

table.animals-grid th:nth-child(5),
table.animals-grid td:nth-child(5) {
  width: 70px;
  min-width: 70px;
  max-width: 70px;
  padding-left: 4px;
  padding-right: 4px;
}

table.animals-grid th:nth-child(6),
table.animals-grid td:nth-child(6) {
  width: 110px;
  min-width: 110px;
  max-width: 110px;
  padding-left: 4px;
  padding-right: 4px;
}

table.animals-grid th:nth-child(9),
table.animals-grid td:nth-child(9) {
  width: 72px;
  min-width: 72px;
  max-width: 72px;
  padding-left: 4px;
  padding-right: 4px;
  text-align: center;
}

table.samples-tissues-grid th:nth-child(5),
table.samples-tissues-grid td:nth-child(5),
table.samples-aliquots-grid th:nth-child(5),
table.samples-aliquots-grid td:nth-child(5) {
  width: 92px;
  min-width: 92px;
  max-width: 92px;
}

table.samples-tissues-grid th:nth-child(6),
table.samples-tissues-grid td:nth-child(6),
table.samples-aliquots-grid th:nth-child(6),
table.samples-aliquots-grid td:nth-child(6) {
  width: 88px;
  min-width: 88px;
  max-width: 88px;
}

table.samples-tissues-grid th:nth-child(7),
table.samples-tissues-grid td:nth-child(7),
table.samples-aliquots-grid th:nth-child(7),
table.samples-aliquots-grid td:nth-child(7) {
  width: 72px;
  min-width: 72px;
  max-width: 72px;
  text-align: right;
}

table.samples-tissues-grid th:nth-child(8),
table.samples-tissues-grid td:nth-child(8),
table.samples-aliquots-grid th:nth-child(8),
table.samples-aliquots-grid td:nth-child(8) {
  width: 56px;
  min-width: 56px;
  max-width: 56px;
  text-align: center;
}

table.samples-tissues-grid th:nth-child(9),
table.samples-tissues-grid td:nth-child(9),
table.samples-aliquots-grid th:nth-child(9),
table.samples-aliquots-grid td:nth-child(9) {
  width: 84px;
  min-width: 84px;
  max-width: 84px;
}

table.samples-tissues-grid th:nth-child(10),
table.samples-tissues-grid td:nth-child(10) {
  width: 68px;
  min-width: 68px;
  max-width: 68px;
  text-align: center;
}

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.tab-btn {
  padding: 6px 10px;
  border: 1px solid #ccc;
  background: #fff;
}

.tab-btn.active {
  background: #e8f2ff;
}

.settings-entities-modal-card {
  width: min(560px, 92vw);
}

.settings-entities-modal-form {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px;
  align-items: center;
}

.settings-entities-modal-form input,
.settings-entities-modal-form select {
  width: 100%;
}

.settings-entities-multiselect-wrap {
  display: grid;
  gap: 6px;
}

.settings-entities-multiselect-search {
  width: 100%;
}

.settings-entities-app-settings-form {
  display: grid;
  grid-template-columns: 240px minmax(320px, 1fr);
  gap: 8px 10px;
  align-items: center;
  margin-top: 8px;
  width: 100%;
}

/* Printer settings: QZ/network blocks were wrapping labels in divs, so grid row-gap did not apply between fields (unlike Print layout). Subtree participates in parent grid when visible. */
#settings-printer-settings-wrap #settings-app-qz-controls:not([hidden]),
#settings-printer-settings-wrap #settings-app-network-controls:not([hidden]) {
  display: contents;
}

.settings-app-printer-save-row {
  grid-column: 1 / -1;
  margin-top: 10px;
}

.settings-app-worker-script-link-row {
  display: contents;
}

.settings-app-worker-script-link {
  grid-column: 1 / -1;
  margin-top: 4px;
  font-size: 14px;
}

.settings-print-queue-scroll {
  max-height: min(38.5vh, 336px);
  overflow: auto;
  width: 100%;
}

.settings-print-queue-note {
  margin-top: 8px;
  font-size: 12px;
  color: #64748b;
}

#settings-entities-app-settings,
#settings-entities-data-import {
  width: min(50vw, 980px);
  max-width: 100%;
}

/* ~30% wider than sibling settings blocks so Print settings + layout + queue table fit one line per cell */
#settings-entities-print-settings {
  width: min(65vw, 1274px);
  max-width: 100%;
}

.settings-entities-app-settings-form input,
.settings-entities-app-settings-form select {
  width: 100%;
}

.settings-app-layout-name-wrap,
.settings-app-layout-save-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.settings-app-layout-save-wrap {
  grid-template-columns: 1fr auto;
}

.settings-app-printer-name-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.settings-app-qz-download-row-wrap {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.settings-app-section-divider {
  grid-column: 1 / -1;
  border-top: 2px solid #cfd4dc;
  margin: 6px 0 2px 0;
}

.settings-app-major-divider {
  grid-column: 1 / -1;
  border-top: 4px solid #1f2937;
  margin: 14px 0 10px 0;
}

.settings-app-layout-section-title {
  grid-column: 1 / -1;
  font-weight: 600;
  margin-top: 2px;
  margin-bottom: 2px;
}

.settings-app-label-preview-wrap {
  border: 1px solid #d6dbe2;
  border-radius: 6px;
  background: #f8fafc;
  padding: 10px;
  width: 100%;
  min-width: 460px;
  box-sizing: border-box;
}

/* Full width of form like section dividers; avoid narrow 2nd column squeezing the table */
.settings-app-print-queue-wrap {
  grid-column: 1 / -1;
  min-width: 0;
  max-width: none;
}

.settings-app-print-queue-wrap .settings-print-queue-scroll {
  overflow-x: auto;
}

.settings-app-print-queue-wrap table {
  width: max(100%, 598px);
  table-layout: auto;
}

.settings-app-print-queue-wrap th,
.settings-app-print-queue-wrap td {
  white-space: nowrap;
  padding: 6px 10px;
}

.settings-app-label-preview {
  width: 100%;
  min-height: 140px;
}

.settings-app-label-preview-sheet {
  border: 2px solid #111827;
  border-radius: 4px;
  background: #fff;
  overflow: hidden;
  display: grid;
  align-content: start;
  gap: 1px;
  padding: 4px;
  margin: 0 auto;
}

.settings-app-label-preview-row {
  border: 1px dashed #c4ccd7;
  border-radius: 4px;
  background: #f8fafc;
  padding: 1px 3px;
  min-height: 22px;
  display: flex;
  align-items: center;
}

.settings-app-label-preview-text {
  font-size: 12px;
  color: #111827;
}

.settings-app-label-preview-qr {
  width: 52px;
  height: 52px;
  border: 1px solid #111827;
  background:
    linear-gradient(90deg, #111827 25%, transparent 25%, transparent 50%, #111827 50%, #111827 75%, transparent 75%),
    linear-gradient(#111827 25%, transparent 25%, transparent 50%, #111827 50%, #111827 75%, transparent 75%);
  background-size: 10px 10px;
}

.settings-app-label-preview-barcode {
  width: 100%;
}

.settings-app-label-preview-barcode-bars {
  height: 44px;
  background: repeating-linear-gradient(
    to right,
    #111827 0 2px,
    transparent 2px 4px,
    #111827 4px 7px,
    transparent 7px 10px
  );
  border: 1px solid #111827;
}

.settings-app-label-preview-barcode-text {
  margin-top: 3px;
  font-size: 10px;
  letter-spacing: 0.5px;
}

.settings-app-label-preview-meta {
  margin-top: 8px;
  text-align: center;
  font-size: 12px;
  color: #4b5563;
}

.settings-app-print-label-row {
  margin-top: 8px;
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.settings-app-print-label-row-inline {
  grid-column: 1 / -1;
}

.settings-import-result {
  margin: 0;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.4;
}

.settings-import-history table {
  width: 100%;
  border-collapse: collapse;
}

.settings-import-history th,
.settings-import-history td {
  border-bottom: 1px solid #e5e7eb;
  padding: 6px 8px;
  font-size: 12px;
  text-align: left;
}

#settings-app-label-rows-config,
#settings-app-animal-label-rows-config {
  display: grid;
  gap: 8px;
}

.settings-app-label-row {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) 76px 82px 118px 168px;
  gap: 8px;
  align-items: center;
}

.settings-app-label-row input,
.settings-app-label-row select {
  width: 100%;
}

.dashboard-table {
  width: min(50%, 640px);
  border-collapse: collapse;
  table-layout: fixed;
  margin: 0;
}

.dashboard-table th,
.dashboard-table td {
  border: 1px solid #d7dce3;
  padding: 8px 10px;
  text-align: center;
  vertical-align: middle;
}

.dashboard-table thead th {
  background: #f4f7fb;
  font-weight: 600;
}

@media (max-width: 900px) {
  .dashboard-table {
    width: 100%;
  }
}

table.grid {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

table.grid th,
table.grid td {
  border-bottom: 1px solid #e5e5e5;
  border-left: 0;
  border-right: 0;
  padding: 6px 8px;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

table.grid th {
  position: relative;
}

table.grid th.grid-select-col,
table.grid td.grid-select-col {
  width: 28px;
  min-width: 28px;
  max-width: 28px;
  padding-left: 4px;
  padding-right: 4px;
  text-align: center;
}

table.grid td.grid-select-col input[type="checkbox"] {
  margin: 0;
}

table.grid th.grid-id-col,
table.grid td.grid-id-col {
  width: 42px;
  min-width: 42px;
  max-width: 42px;
  padding-left: 4px;
  padding-right: 4px;
}

table.grid tbody tr:nth-child(odd) {
  background: #fafafa;
}

table.grid tbody tr:nth-child(even) {
  background: #fff;
}

table.grid tbody tr.row-selected {
  background: #dbeafe !important;
}

table.grid th.sortable {
  cursor: pointer;
}

table.grid td.editable-cell {
  background: #fffceb;
  cursor: pointer;
}

.grid-inline-input {
  width: 100%;
  min-width: 90px;
  box-sizing: border-box;
}

.grid-col-resize-handle {
  position: absolute;
  top: 0;
  right: -4px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
  z-index: 2;
}

.grid-col-resize-handle::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 3px;
  width: 1px;
  background: transparent;
}

table.grid th:hover .grid-col-resize-handle::after {
  background: #cbd5e1;
}

.grid-filter-row input {
  width: 100%;
}

.grid-filter-row select {
  width: 100%;
}

.grid-date-filter {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.grid-date-filter input[type="text"] {
  width: 100%;
  font-size: 12px;
}

.grid-pager {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0 0;
}

.grid-pager-status {
  color: #475467;
  font-size: 12px;
}

.grid-pager-size {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.pdf-viewer-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  background: #f8fafc;
  padding: 8px;
}

#pdf-canvas {
  display: block;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 2px 10px rgba(16, 24, 40, 0.15);
}

table.animals-grid .grid-filter-row th:nth-child(7) input {
  max-width: 120px;
}

.messages .message {
  padding: 8px 10px;
  margin-bottom: 8px;
  border-radius: 4px;
}

.messages .success {
  background: #e7f8ed;
}

.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}

.login-header-image {
  display: block;
  width: min(816px, 96vw);
  max-height: 276px;
  object-fit: contain;
}

.login-panel {
  width: min(340px, 88vw);
  margin: 0 auto;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 10px 14px;
}

.login-panel h1 {
  margin: 0 0 8px;
  font-size: 18px;
}

.login-panel form p {
  margin: 6px 0;
}

.login-panel input[type="text"],
.login-panel input[type="password"] {
  width: 100%;
}

.login-panel button[type="submit"] {
  margin-top: 6px;
  font-size: 12px;
  padding: 4px 10px;
}

.muted {
  color: #666;
  font-size: 12px;
}

.page-heading-inline-moved {
  display: none;
}
