:root {
  --lab-ink: #14221b;
  --lab-ink-soft: #26382f;
  --lab-muted: #69786f;
  --lab-paper: #edf2ee;
  --lab-card: #ffffff;
  --lab-soft: #f7f9f7;
  --lab-line: #dce5de;
  --lab-line-strong: #c9d6cd;
  --lab-green: #176b47;
  --lab-green-dark: #0d4b30;
  --lab-green-bright: #2d9b68;
  --lab-mint: #e3f4e9;
  --lab-red: #a83939;
  --lab-shadow: 0 14px 40px rgba(20, 34, 27, .09);
}

* { box-sizing: border-box; }
.lab-visually-hidden { position: fixed !important; width: 1px !important; height: 1px !important; padding: 0 !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
body:has(#lab-tables-app), body:has(.lab-login) {
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  color: var(--lab-ink);
  background: radial-gradient(circle at 85% 0%, rgba(117, 188, 142, .13), transparent 27rem), var(--lab-paper);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
#lab-tables-app, .lab-shell { height: 100dvh; min-height: 0; }

.lab-shell {
  display: grid;
  grid-template-rows: 54px 40px minmax(0, 1fr);
  overflow: hidden;
}
.lab-shell.focus-mode { grid-template-rows: 0 0 minmax(0, 1fr); }
.lab-shell.focus-mode .lab-header,
.lab-shell.focus-mode .lab-tabs { display: none; }

.lab-header {
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  padding: 0 clamp(12px, 1.6vw, 26px);
  color: white;
  background: linear-gradient(115deg, #101f18 0%, #1a3427 72%, #214431 100%);
  box-shadow: 0 4px 16px rgba(9, 24, 16, .18);
}
.lab-brand { display: flex; align-items: center; gap: 9px; min-width: 0; margin-right: auto; }
.lab-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 9px;
  color: #113522;
  background: linear-gradient(145deg, #b9edc8, #79c997);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), 0 4px 12px rgba(0, 0, 0, .18);
  font-size: 15px;
  font-weight: 900;
}
.lab-brand-copy, .lab-identity-copy { display: flex; min-width: 0; flex-direction: column; line-height: 1.18; }
.lab-brand-copy strong, .lab-identity-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lab-brand-copy strong { font-size: 13px; letter-spacing: -.01em; }
.lab-brand-copy small, .lab-identity small { color: #b6c6bd; font-size: 10px; }
.lab-private-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 999px;
  color: #c9d8d0;
  background: rgba(255, 255, 255, .06);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.lab-private-status i { width: 6px; height: 6px; border-radius: 50%; background: #65d590; box-shadow: 0 0 0 3px rgba(101, 213, 144, .14); }
.lab-identity { display: flex; min-width: 0; max-width: 210px; align-items: center; gap: 8px; font-size: 12px; }
.lab-avatar { display: grid; flex: 0 0 auto; place-items: center; width: 29px; height: 29px; border-radius: 50%; color: #d9f2e2; background: rgba(255, 255, 255, .11); font-weight: 800; }

.lab-tabs {
  z-index: 40;
  display: flex;
  min-width: 0;
  gap: 2px;
  padding: 0 clamp(8px, 1.4vw, 22px);
  overflow-x: auto;
  border-bottom: 1px solid var(--lab-line);
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 3px 12px rgba(20, 34, 27, .035);
  scrollbar-width: thin;
}
.lab-tabs button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 13px;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--lab-muted);
  background: transparent;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
}
.lab-tabs button:hover { color: var(--lab-ink); background: rgba(23, 107, 71, .04); }
.lab-tabs button.active { color: var(--lab-green); border-color: var(--lab-green); }
.lab-tab-index { color: #9aa9a0; font-size: 9px; font-variant-numeric: tabular-nums; letter-spacing: .05em; }
.lab-tabs button.active .lab-tab-index { color: var(--lab-green-bright); }

.lab-main {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 6px;
  padding: clamp(6px, .9vw, 12px);
}
.lab-command {
  position: relative;
  z-index: 20;
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(145px, auto) minmax(190px, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--lab-line);
  border-radius: 11px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 4px 18px rgba(20, 34, 27, .055);
}
.lab-command-title { display: grid; min-width: 0; grid-template-columns: auto auto; align-items: baseline; gap: 2px 8px; }
.lab-command-title .lab-eyebrow { grid-column: 1 / -1; }
.lab-command-title h1 { max-width: 230px; margin: 0; overflow: hidden; color: var(--lab-ink); font-size: 18px; line-height: 1.05; text-overflow: ellipsis; white-space: nowrap; }
.lab-eyebrow { margin: 0; color: var(--lab-green); font-size: 8px; font-weight: 850; letter-spacing: .14em; }
.lab-subtitle, .lab-help { margin: 0; color: var(--lab-muted); }
.lab-command .lab-subtitle { font-size: 10px; white-space: nowrap; }
.lab-search { position: relative; display: block; min-width: 0; width: 100%; }
.lab-search-icon { position: absolute; top: 50%; left: 11px; z-index: 1; color: #819087; font-size: 18px; transform: translateY(-52%) rotate(-20deg); pointer-events: none; }
.lab-search input[type="search"] { width: 100%; min-height: 34px; padding-left: 34px; background: var(--lab-soft); }
.lab-command-actions, .lab-secondary-actions { display: flex; align-items: center; gap: 5px; }
.lab-search-help { grid-column: 1 / -1; margin: 0; color: var(--lab-muted); font-size: 11px; line-height: 1.4; }
.lab-count { color: var(--lab-muted); font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lab-more-trigger { display: none !important; }
.lab-panel-wrap { position: relative; }

.lab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--lab-line-strong);
  border-radius: 8px;
  color: var(--lab-ink);
  background: white;
  box-shadow: 0 1px 2px rgba(20, 34, 27, .04);
  text-decoration: none;
  font-size: 11px;
  font-weight: 760;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .14s ease, box-shadow .14s ease, background .14s ease;
}
.lab-button:hover { border-color: #98aa9d; box-shadow: 0 5px 15px rgba(20, 34, 27, .08); }
.lab-button.primary { border-color: var(--lab-green); color: white; background: var(--lab-green); }
.lab-button.primary:hover { background: var(--lab-green-dark); }
.lab-button.secondary { background: transparent; }
.lab-header .lab-button.secondary { border-color: rgba(255, 255, 255, .24); color: white; background: rgba(255, 255, 255, .08); box-shadow: none; }
.lab-header .lab-button.secondary:hover { border-color: rgba(255, 255, 255, .45); background: rgba(255, 255, 255, .15); }
.lab-header .header-button { min-height: 30px; padding: 0 10px; }
.lab-button.compact { min-height: 34px; padding: 0 10px; }
.lab-button:disabled { cursor: not-allowed; opacity: .48; }
.lab-filter-trigger { gap: 6px; }
.lab-filter-badge { display: inline-grid; min-width: 17px; height: 17px; place-items: center; padding: 0 4px; border-radius: 999px; color: white; background: var(--lab-green); font-size: 9px; }
.hidden { display: none !important; }

input, select, textarea {
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--lab-line-strong);
  border-radius: 7px;
  color: var(--lab-ink);
  background: white;
}
.lab-field-label { display: grid; gap: 6px; color: var(--lab-muted); font-size: 12px; font-weight: 700; }
input::placeholder, textarea::placeholder { color: #9aa69e; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  border-color: var(--lab-green);
  outline: 3px solid rgba(23, 107, 71, .15);
  outline-offset: 0;
}

.lab-popover {
  position: absolute;
  z-index: 100;
  top: calc(100% + 7px);
  right: 0;
  overflow: auto;
  border: 1px solid var(--lab-line-strong);
  border-radius: 11px;
  background: white;
  box-shadow: 0 20px 60px rgba(20, 34, 27, .18);
}
.lab-popover-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 42px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--lab-line);
  background: rgba(255, 255, 255, .97);
  font-size: 12px;
  font-weight: 800;
}
.lab-popover-head small { color: var(--lab-muted); font-size: 9px; font-weight: 600; }
.lab-filter-panel { width: min(760px, calc(100vw - 24px)); max-height: min(70dvh, 590px); }
.lab-filter-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 9px; padding: 11px; }
.lab-filter-fields label, .lab-form label { display: flex; flex-direction: column; gap: 4px; color: var(--lab-muted); font-size: 10px; font-weight: 700; }
.lab-filter-fields input { width: 100%; min-width: 0; }
.lab-view-panel { width: min(370px, calc(100vw - 24px)); max-height: min(74dvh, 650px); }
.lab-view-section { margin: 0; padding: 11px 13px; border: 0; border-bottom: 1px solid var(--lab-line); }
.lab-view-section legend { padding: 0 0 7px; color: var(--lab-muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.lab-choice { display: inline-flex; align-items: center; gap: 6px; margin-right: 16px; font-size: 11px; }
.lab-choice input, .lab-check input { width: 15px; min-height: 0; height: 15px; margin: 0; }
.lab-view-columns { max-height: 330px; overflow: auto; }
.lab-view-section-head, .lab-view-column { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lab-view-section-head { position: sticky; top: 0; z-index: 1; padding-bottom: 7px; background: white; font-size: 11px; }
.lab-view-column { position: relative; min-height: 36px; border-top: 1px solid #edf1ee; }
.lab-view-column .lab-check { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lab-view-column-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 3px; }
.lab-column-order-handle, .lab-column-move, .lab-header-order-handle {
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 5px;
  color: #718078;
  background: transparent;
  cursor: grab;
  touch-action: none;
}
.lab-column-order-handle { width: 25px; height: 25px; font-size: 15px; }
.lab-column-move { width: 23px; height: 23px; cursor: pointer; }
.lab-column-order-handle:hover, .lab-column-order-handle:focus-visible,
.lab-column-move:hover, .lab-column-move:focus-visible,
.lab-header-order-handle:hover, .lab-header-order-handle:focus-visible { border-color: #9bc6aa; color: var(--lab-green); background: var(--lab-mint); }
.lab-column-order-handle:active, .lab-header-order-handle:active { cursor: grabbing; }
.lab-column-order-handle:disabled, .lab-column-move:disabled, .lab-header-order-handle:disabled { cursor: not-allowed; opacity: .4; }
.lab-pin-button { padding: 3px 7px; border: 0; border-radius: 5px; color: var(--lab-green); background: var(--lab-mint); font-size: 9px; font-weight: 800; cursor: pointer; }
.lab-pin-button:disabled { color: #9eaaa2; background: #eef1ef; cursor: not-allowed; }
.lab-view-footer { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 7px; padding: 10px 12px; background: white; }
.lab-more-panel { width: 190px; padding-bottom: 5px; }
.lab-menu-item { display: block; width: 100%; padding: 9px 12px; border: 0; color: var(--lab-ink); background: white; text-align: left; text-decoration: none; font-size: 11px; font-weight: 700; cursor: pointer; }
.lab-menu-item:hover, .lab-menu-item:focus { background: var(--lab-mint); }

.lab-filter-chips {
  display: flex;
  min-width: 0;
  gap: 5px;
  padding: 1px 2px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.lab-order-error { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 10px; border: 1px solid #dca4a4; border-radius: 7px; color: #7f2727; background: #fff1f1; font-size: 11px; font-weight: 700; }
.lab-filter-chip { flex: 0 0 auto; max-width: 230px; padding: 4px 8px; overflow: hidden; border: 1px solid #b8d5c2; border-radius: 999px; color: var(--lab-green-dark); background: var(--lab-mint); font-size: 9px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }

.lab-grid-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: auto;
  border: 1px solid var(--lab-line);
  border-radius: 11px;
  background: white;
  box-shadow: var(--lab-shadow);
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #aabbb0 #edf2ee;
  -webkit-overflow-scrolling: touch;
}
.lab-grid-wrap::-webkit-scrollbar { width: 11px; height: 11px; }
.lab-grid-wrap::-webkit-scrollbar-thumb { border: 3px solid #edf2ee; border-radius: 999px; background: #aabbb0; }
.lab-grid-wrap::-webkit-scrollbar-track { background: #edf2ee; }
.lab-grid { width: max-content; min-width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; }
.lab-grid th {
  position: sticky;
  top: 0;
  z-index: 5;
  min-height: 58px;
  padding: 4px 8px;
  overflow: visible;
  border-right: 1px solid #e5ebe7;
  border-bottom: 1px solid var(--lab-line-strong);
  color: var(--lab-ink-soft);
  background: #f2f6f3;
  text-align: left;
  vertical-align: middle;
  box-shadow: 0 2px 5px rgba(20, 34, 27, .04);
}
.lab-heading { display: flex; min-width: 0; align-items: flex-start; gap: 5px; }
.lab-column-filter {
  display: block;
  width: 100%;
  min-width: 0;
  height: 24px;
  margin-top: 4px;
  padding: 2px 5px;
  border: 1px solid #c8d4cc;
  border-radius: 5px;
  color: var(--lab-ink);
  background: white;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.2;
}
.lab-column-filter::placeholder { color: #8d9991; opacity: 1; }
.lab-column-filter:focus { outline: 2px solid rgba(47, 154, 101, .28); border-color: var(--lab-green-bright); }
.lab-grid th.lab-id .lab-column-filter { width: 100%; }
.lab-grid th.lab-reorderable { padding-left: 24px; }
.lab-grid th .lab-type-badge { flex: 0 0 auto; padding: 2px 4px; border-radius: 4px; color: #718078; background: #e3e9e5; font-size: 7px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; }
.lab-sort { min-width: 0; padding: 0; overflow: visible; border: 0; color: inherit; background: transparent; text-align: left; font-size: 10.5px; font-weight: 800; overflow-wrap: anywhere; white-space: normal; cursor: pointer; }
.lab-sort:hover { color: var(--lab-green); }
.lab-header-order-handle { position: absolute; top: 4px; left: 3px; z-index: 4; width: 19px; height: 26px; font-size: 14px; }
.lab-resize-handle {
  position: absolute;
  top: 0;
  right: -4px;
  z-index: 3;
  width: 9px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
}
.lab-resize-handle::after { position: absolute; top: 18%; right: 4px; width: 1px; height: 64%; background: #bcc9c0; content: ""; }
.lab-resize-handle:hover::after, .lab-resize-handle:focus::after { width: 2px; background: var(--lab-green-bright); }
.lab-grid td {
  height: auto;
  min-height: 35px;
  padding: 3px 7px;
  overflow: visible;
  border-right: 1px solid #edf1ee;
  border-bottom: 1px solid #edf1ee;
  color: var(--lab-ink-soft);
  background: white;
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
  white-space: normal;
  vertical-align: top;
}
.lab-grid tbody tr:nth-child(even) td { background: #fafcfb; }
.lab-grid tbody tr:hover td { background: #eef8f1; }
.lab-grid tr:last-child td { border-bottom: 0; }
.lab-grid th.lab-id, .lab-grid td.lab-id {
  position: sticky;
  left: 0;
  z-index: 7;
  width: 64px;
  max-width: 64px;
  min-width: 64px;
  background: #f1f5f2;
  box-shadow: 3px 0 7px rgba(20, 34, 27, .06);
}
.lab-grid th.lab-id { z-index: 12; }
.lab-grid td.lab-id { padding-left: 9px; color: #77857d; font-size: 9.5px; font-weight: 800; font-variant-numeric: tabular-nums; }
.lab-grid th.lab-pinned { z-index: 11; background: #eef5f0; box-shadow: 3px 0 7px rgba(20, 34, 27, .08); }
.lab-grid td.lab-pinned { z-index: 6; background: #f8fbf9; box-shadow: 3px 0 7px rgba(20, 34, 27, .07); }
.lab-grid tbody tr:nth-child(even) td.lab-id,
.lab-grid tbody tr:nth-child(even) td.lab-pinned { background: #f4f8f5; }
.lab-grid tbody tr:hover td.lab-id,
.lab-grid tbody tr:hover td.lab-pinned { background: #e6f3ea; }
.lab-data-cell[data-editable="true"] { cursor: cell; }
/* Include sticky cells; saved row status wins over stripes and ordinary hover. */
.lab-grid tbody tr.lab-priority-urgent > td:not(.editing):not(.saving) { background: #fee2e2; }
.lab-grid tbody tr.lab-priority-medium > td:not(.editing):not(.saving) { background: #fef3c7; }
.lab-grid tbody tr.lab-erledigt-empty > td:not(.editing):not(.saving) { background: #ffedd5; }
.lab-grid tbody tr.lab-erledigt-empty:hover > td:not(.editing):not(.saving) { background: #fed7aa; }
.lab-grid tbody tr.lab-erledigt-empty > td.lab-id,
.lab-grid tbody tr.lab-erledigt-empty .lab-cell-value.missing { color: #765239; }
/* Ulm missing-proof status colors only its cell; editors and error/focus outlines remain visible. */
.lab-grid tbody tr > td.lab-document-missing:not(.editing):not(.saving) { background: #fef3c7; color: #713f12; }
.lab-grid tbody tr:hover > td.lab-document-missing:not(.editing):not(.saving) { background: #fde68a; }
.lab-grid td.lab-document-missing .lab-cell-value.missing { color: #713f12; }


.lab-data-cell[data-editable="true"]:hover { box-shadow: inset 0 0 0 1px #9bc6aa; }
.lab-data-cell.editing { padding: 0; overflow: visible; background: white !important; box-shadow: inset 0 0 0 2px var(--lab-green) !important; }
.lab-data-cell.saving { background: var(--lab-mint) !important; }
.lab-data-cell.save-error { position: relative; box-shadow: inset 0 0 0 2px var(--lab-red); }
.lab-cell-error { position: absolute; top: 3px; right: 3px; display: grid; width: 15px; height: 15px; place-items: center; border-radius: 50%; color: white; background: var(--lab-red); font-size: 9px; font-weight: 900; }
.lab-cell-value { display: block; min-width: 0; overflow: visible; overflow-wrap: anywhere; white-space: pre-wrap; word-break: break-word; }
.lab-cell-value.missing { color: #a8b2ac; font-style: italic; }
.lab-boolean { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 999px; font-size: 9px; font-weight: 800; }
.lab-boolean::before { width: 5px; height: 5px; border-radius: 50%; content: ""; }
.lab-boolean.yes { color: #17623f; background: var(--lab-mint); }
.lab-boolean.yes::before { background: #2f9a65; }
.lab-boolean.no { color: #7b4a48; background: #f5eaea; }
.lab-boolean.no::before { background: #b56b67; }
.lab-cell-input { width: 100%; min-width: 0; height: 100%; min-height: 34px; padding: 4px 6px; border: 0; border-radius: 0; background: white; font-size: inherit; }
textarea.lab-cell-input { position: absolute; z-index: 20; top: 0; left: 0; min-width: 260px; min-height: 92px; resize: both; box-shadow: 0 8px 28px rgba(20, 34, 27, .2); white-space: normal; }
.lab-row-actions { width: 64px; min-width: 64px; text-align: center; }
.lab-link { padding: 4px; border: 0; color: var(--lab-green); background: transparent; font-size: 10px; font-weight: 750; cursor: pointer; }
.lab-link:hover { text-decoration: underline; }
.lab-link.danger { color: var(--lab-red); }
.lab-button.danger, .lab-menu-item.danger { color: var(--lab-red); border-color: var(--lab-red); }

#lab-tables-app[data-density="comfortable"] .lab-grid th { height: 44px; padding: 6px 9px; }
#lab-tables-app[data-density="comfortable"] .lab-grid td { height: auto; min-height: 43px; padding: 6px 9px; font-size: 13px; }
#lab-tables-app[data-density="comfortable"] .lab-cell-input { min-height: 42px; }

.lab-loading, .lab-empty {
  display: flex;
  min-height: 210px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 30px;
  color: var(--lab-muted);
  text-align: center;
}
.lab-loading { gap: 12px; }
.lab-grid td.lab-grid-status-cell { height: 210px; padding: 0; background: white; }
.lab-spinner { width: 25px; height: 25px; border: 3px solid var(--lab-mint); border-top-color: var(--lab-green); border-radius: 50%; animation: lab-spin .75s linear infinite; }
.lab-empty-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 10px; border-radius: 12px; color: var(--lab-green); background: var(--lab-mint); font-size: 22px; }
.lab-empty strong { color: var(--lab-ink); font-size: 18px; }
.lab-empty p { max-width: 420px; margin: 6px 0 0; font-size: 12px; }
.lab-pagination {
  position: sticky;
  bottom: 0;
  left: 0;
  z-index: 15;
  display: flex;
  width: max(100%, 340px);
  min-height: 43px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 4px 10px;
  border-top: 1px solid var(--lab-line);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(8px);
}
.lab-pagination span { min-width: 90px; color: var(--lab-muted); text-align: center; font-size: 10px; font-variant-numeric: tabular-nums; }
.lab-import-status { min-height: 22px; margin: 12px 0; color: var(--lab-muted); }
.lab-pdf-preview { margin-top: 14px; }
.lab-form.lab-pdf-review { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.lab-pdf-field { min-width: 0; }
.lab-pdf-field-heading { display: flex; min-height: 30px; align-items: flex-start; justify-content: space-between; gap: 8px; }
.lab-pdf-field-heading small { flex: 0 0 auto; padding: 2px 6px; border-radius: 999px; font-size: 8px; font-weight: 800; }
.lab-detected { color: #17623f; background: var(--lab-mint); }
.lab-missing-detection { color: #7b4a48; background: #f5eaea; }
.lab-pdf-warnings { grid-column: 1 / -1; padding: 10px 12px; border: 1px solid #e2c7a3; border-radius: 8px; color: #6f4d20; background: #fff8ec; font-size: 11px; }
.lab-pdf-warnings ul { margin: 6px 0 0; padding-left: 18px; }
.lab-pdf-confirm { grid-column: 1 / -1; }

.lab-modal-shade { position: fixed; inset: 0; z-index: 99999; display: grid; place-items: center; padding: 18px; background: rgba(8, 19, 12, .67); backdrop-filter: blur(5px); }
.lab-modal { width: min(920px, 100%); max-height: calc(100dvh - 36px); overflow: auto; border: 1px solid rgba(255, 255, 255, .4); border-radius: 15px; background: white; box-shadow: 0 32px 100px rgba(0, 0, 0, .3); }
.lab-modal-head { position: sticky; top: 0; z-index: 4; display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; border-bottom: 1px solid var(--lab-line); background: rgba(255, 255, 255, .97); backdrop-filter: blur(8px); }
.lab-modal-head h2 { margin: 0; font-size: 21px; font-weight: 650; }
.lab-icon-button { width: 34px; height: 34px; border: 0; border-radius: 50%; color: var(--lab-ink); background: #edf2ee; font-size: 21px; cursor: pointer; }
.lab-icon-button:hover { background: var(--lab-mint); }
.lab-modal-body { padding: 19px; }
.lab-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.lab-form button { align-self: end; }
.lab-column-list { margin-bottom: 22px; }
.lab-column-row, .lab-add-column { display: grid; grid-template-columns: minmax(150px, 2fr) minmax(115px, 1fr) auto auto auto; align-items: center; gap: 7px; padding: 9px 0; border-bottom: 1px solid #edf1ee; }
.lab-check { display: inline-flex; align-items: center; gap: 6px; color: var(--lab-ink); font-size: 11px; }
.lab-user-create { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 7px; margin: 16px 0 24px; }
.lab-user-card { margin-top: 12px; padding: 16px; border: 1px solid var(--lab-line); border-radius: 11px; background: #fcfdfc; }
.lab-user-card > header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.lab-user-card > header div { display: flex; flex-direction: column; }
.lab-user-card small { color: var(--lab-muted); }
.lab-permission { display: grid; grid-template-columns: repeat(4, auto) 1fr; gap: 10px; margin: 10px 0; padding: 12px; border: 1px solid var(--lab-line); border-radius: 8px; background: white; }
.lab-permission legend { padding: 0 6px; color: var(--lab-green); font-weight: 800; }
.lab-field-perms { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 13px; padding-top: 9px; border-top: 1px solid #edf1ee; }
.lab-field-perms small { flex-basis: 100%; }
.lab-user-footer { display: flex; align-items: center; gap: 7px; margin-top: 12px; }

.lab-login { display: grid; min-height: 100dvh; place-items: center; padding: 22px; overflow: auto; }
.lab-login-card { width: min(430px, 100%); padding: 34px; border: 1px solid rgba(255, 255, 255, .8); border-radius: 19px; background: white; box-shadow: var(--lab-shadow); }
.lab-login-card h1 { margin: 7px 0 12px; font-size: 30px; }
.lab-login-card form { display: grid; gap: 12px; margin-top: 23px; }
.lab-login-card label { display: grid; gap: 5px; color: var(--lab-muted); font-size: 11px; font-weight: 700; }
.lab-login-card .lab-button { width: 100%; margin-top: 5px; }
.lab-login-card .message { padding: 10px; border-radius: 7px; color: #7f2727; background: #f7e8e8; font-size: 12px; }
.lab-login-card .lab-eyebrow { color: var(--lab-green); }
.lab-toast { position: fixed; z-index: 100000; right: 18px; bottom: -100px; max-width: min(380px, calc(100vw - 36px)); padding: 11px 15px; border-radius: 9px; color: white; background: var(--lab-green-dark); box-shadow: 0 12px 35px rgba(0, 0, 0, .24); font-size: 12px; font-weight: 700; opacity: 0; transition: bottom .2s ease, opacity .2s ease; }
.lab-column-drag-ghost { position: fixed; z-index: 100001; max-width: 250px; padding: 7px 10px; border: 1px solid #8db79b; border-radius: 7px; color: var(--lab-green-dark); background: white; box-shadow: 0 10px 28px rgba(20, 34, 27, .22); font-size: 11px; font-weight: 800; pointer-events: none; }
.lab-grid th.lab-drop-before::before, .lab-grid th.lab-drop-after::after { position: absolute; z-index: 15; top: 0; bottom: 0; width: 3px; background: var(--lab-green-bright); content: ""; }
.lab-grid th.lab-drop-before::before { left: -2px; }
.lab-grid th.lab-drop-after::after { right: -2px; }
.lab-view-column.lab-drop-before::before, .lab-view-column.lab-drop-after::after { position: absolute; z-index: 4; right: 0; left: 0; height: 3px; background: var(--lab-green-bright); content: ""; }
.lab-view-column.lab-drop-before::before { top: -2px; }
.lab-view-column.lab-drop-after::after { bottom: -2px; }
.lab-toast.success, .lab-toast.error { bottom: 18px; opacity: 1; }
.lab-toast.error { background: #8f3030; }

@media (max-width: 1180px) {
  .lab-secondary-actions { display: none; }
  .lab-more-trigger { display: inline-flex !important; }
}

@media (max-width: 900px) {
  .lab-command { grid-template-columns: minmax(125px, auto) minmax(160px, 1fr) auto; }
  .lab-command-title .lab-subtitle { display: none; }
  .lab-count { display: none; }
  .lab-private-status { display: none; }
}

@media (max-width: 680px) {
  .lab-shell { grid-template-rows: 50px 38px minmax(0, 1fr); }
  .lab-header { gap: 9px; padding: 0 8px; }
  .lab-brand-copy small, .lab-identity-copy { display: none; }
  .lab-brand-copy strong { font-size: 12px; }
  .lab-identity { margin-left: auto; }
  .lab-avatar { width: 27px; height: 27px; }
  .lab-tabs { padding: 0 5px; }
  .lab-tabs button { height: 38px; padding: 0 10px; }
  .lab-main { gap: 5px; padding: 5px; }
  .lab-command { grid-template-columns: minmax(0, 1fr) auto; gap: 5px; padding: 6px; }
  .lab-command-title { display: none; }
  .lab-search { grid-column: 1 / -1; grid-row: 2; }
  .lab-command-actions { grid-column: 1 / -1; grid-row: 1; justify-content: flex-end; }
  .lab-command-actions::before { margin-right: auto; color: var(--lab-green-dark); content: "Table tools"; font-size: 11px; font-weight: 800; }
  .lab-button.compact { min-height: 32px; padding: 0 8px; font-size: 10px; }
  .lab-filter-panel { right: -98px; width: calc(100vw - 10px); max-height: 68dvh; }
  .lab-view-panel { right: -52px; width: min(350px, calc(100vw - 10px)); }
  .lab-filter-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; padding: 8px; }
  .lab-grid th { height: 40px; }
  .lab-resize-handle { right: -6px; width: 13px; }
  .lab-modal-shade { padding: 7px; }
  .lab-modal { max-height: calc(100dvh - 14px); border-radius: 11px; }
  .lab-modal-body { padding: 13px; }
  .lab-column-row, .lab-add-column { grid-template-columns: 1fr 1fr; }
  .lab-user-create { grid-template-columns: 1fr; }
  .lab-permission { grid-template-columns: repeat(2, 1fr); }
  .lab-user-footer { align-items: stretch; flex-direction: column; }
  .lab-form.lab-pdf-review { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
  .lab-brand-copy { display: none; }
  .lab-filter-fields { grid-template-columns: 1fr; }
  .lab-filter-panel { right: -98px; }
  .lab-view-panel { position: fixed; top: 55px; right: 5px; left: 5px; width: auto; max-height: calc(100dvh - 62px); }
  .lab-button.compact { padding: 0 7px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@keyframes lab-spin { to { transform: rotate(360deg); } }

/* Private photo controls coexist with the legacy bild text and priority row colors. */
.lab-photo-text { display: block; width: 100%; min-height: 20px; padding: 2px 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; }
button.lab-photo-text { cursor: cell; }
.lab-photo-open { display: flex; flex-wrap: wrap; max-width: 100%; align-items: center; gap: 5px; padding: 3px; margin-top: 3px; border: 1px solid #b8cbbf; border-radius: 5px; background: rgba(255,255,255,.55); color: var(--lab-green-dark); font: inherit; cursor: pointer; }
.lab-photo-thumb { width: 40px; height: 32px; object-fit: cover; border-radius: 3px; }
.lab-photo-dialog { width: min(900px, 100%); }
.lab-photo-preview { display: grid; place-items: center; min-height: 150px; background: #f2f4f3; border-radius: 8px; }
.lab-photo-full { display: block; max-width: 100%; max-height: 55dvh; object-fit: contain; }
.lab-photo-controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.lab-photo-picker { display: grid; gap: 8px; margin: 16px 0; font-size: 12px; }
.lab-photo-selection { display: flex; align-items: center; gap: 10px; margin: 8px 0; overflow-wrap: anywhere; }
.lab-photo-selection span { min-width: 0; }
.lab-photo-unavailable { min-height: 40px; font-size: 10px; }
@media (max-width: 600px) { .lab-photo-controls { justify-content: flex-start; } .lab-photo-full { max-height: 40dvh; } .lab-photo-selection { flex-wrap: wrap; } }

/* Administrator column access matrix. */
.lab-permission-matrix { grid-column: 1 / -1; min-width: 0; }
.lab-column-permissions { width: 100%; border-collapse: collapse; table-layout: fixed; }
.lab-column-permissions th, .lab-column-permissions td { padding: 8px; border-bottom: 1px solid var(--lab-border, #e2e8f0); text-align: center; overflow-wrap: anywhere; }
.lab-column-permissions th:first-child { width: 52%; text-align: left; }
.lab-column-permissions input { width: 18px; height: 18px; }
.lab-permission-bulk { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.lab-permission-matrix .lab-permission { display: block; min-width: 0; }
.lab-permission-matrix .lab-permission > .lab-check { display: inline-flex; margin: 4px 16px 4px 0; }
.lab-user-create > button[type="submit"] { grid-column: 1 / -1; justify-self: start; }
.lab-column-permissions thead th { white-space: nowrap; padding-inline: 4px; }

/* PDF attachments retain the grid's priority/pinned-cell backgrounds. */
.lab-document-open { display:block; max-width:100%; padding:6px 8px; margin-top:4px; border:1px solid #cbd5e1; border-radius:5px; color:#1e3a5f; background:#fff; cursor:pointer; text-align:left; white-space:normal; overflow-wrap:anywhere; }
.lab-document-dialog { width:min(900px, calc(100vw - 24px)); }
.lab-document-name { overflow-wrap:anywhere; }
.lab-document-preview { display:block; max-width:100%; width:auto; max-height:60vh; height:auto; border:1px solid #cbd5e1; margin:12px auto; object-fit:contain; }
.lab-document-dialog .lab-modal-body > .lab-button { margin:4px; }

/* Attachment state is independent of the row's saved priority background. */
.lab-document-open.lab-document-awaiting-signature,
.lab-document-open.lab-document-awaiting-signature:hover,
.lab-document-open.lab-document-awaiting-signature:focus-visible {
  background:#ffedd5; border-color:#ea580c; color:#9a3412;
}

.lab-open-documents-filter { display:flex; align-items:flex-start; gap:6px; margin-top:7px; font-size:11px; font-weight:500; line-height:1.4; white-space:normal; overflow-wrap:anywhere; cursor:pointer; }
.lab-open-documents-filter input { flex:0 0 auto; width:14px; height:14px; margin:1px 0 0; accent-color:#c2410c; }
.lab-signature-ready-filter input { min-height:0; padding:0; }

/* Top-level controls stay visible when the compact mobile title is hidden. */
.lab-open-records { grid-column:1 / -1; display:flex; flex-wrap:wrap; align-items:center; gap:8px 14px; font-size:12px; }
.lab-open-records label, .lab-open-records-legend { display:inline-flex; align-items:center; gap:6px; }
.lab-open-records label { cursor:pointer; }
.lab-open-records input { width:16px; height:16px; margin:0; accent-color:#c2410c; }
.lab-open-records-swatch { width:16px; height:16px; background:#ffedd5; border:1px solid #c2410c; border-radius:3px; }
.lab-missing-proof-swatch { background:#fef3c7; border-color:#a16207; flex-shrink:0; }

.lab-open-year-label select { width:auto; min-width:135px; max-width:100%; padding:4px 24px 4px 7px; font-size:12px; }
.lab-open-year-label select:disabled { opacity:.6; cursor:not-allowed; }

/* Signed PDF presence only; the row's Offen background remains visible. */
.lab-document-open.lab-document-signed { background: #166534; border-color: #14532d; color: #fff; }
.lab-document-open.lab-document-signed:hover { background: #14532d; color: #fff; }
.lab-document-open.lab-document-signed:focus-visible { background: #14532d; color: #fff; outline: 3px solid #2563eb; outline-offset: 3px; }
.lab-signed-pdf-swatch { background: #166534; border-color: #14532d; flex-shrink: 0; }
/* The hours preview is independent of sticky grid columns and remains scrollable on phones. */
.lab-hours-dialog { width: min(1100px, 96vw); }
.lab-hours-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0; }
.lab-hours-preview { overflow: auto; max-height: 48vh; border: 1px solid #cbd5e1; border-radius: 6px; }
.lab-hours-preview table { width: 100%; border-collapse: collapse; font-size: 13px; color: #0f172a; background: #fff; }
.lab-hours-preview th, .lab-hours-preview td { padding: 9px; text-align: left; vertical-align: top; border-bottom: 1px solid #e2e8f0; min-width: 95px; overflow-wrap: anywhere; }
.lab-hours-preview th { background: #f1f5f9; }
.lab-hours-preview:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }
