* { box-sizing: border-box; }
:root { font-family: "Segoe UI", Arial, sans-serif; color: #24384a; background: #f3f5f6; font-size: 14px; }
body { margin: 0; }
a { color: #096a9b; }
button, input, select { font: inherit; }
button, select, input { border: 1px solid #b9c5cd; border-radius: 4px; background: white; color: inherit; padding: 8px 12px; }
button { cursor: pointer; }
button:hover:not(:disabled) { background: #eaf2f6; border-color: #54768b; }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #2594c9; outline-offset: 2px; }
input[type="search"]::-webkit-search-cancel-button { display: none; }
.app-shell { display: flex; flex-direction: column; height: 100dvh; }
.site-header { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; padding: 10px 13px 0; }
.header-brand { display: flex; align-items: center; min-height: 54px; padding-left: 10px; }
.header-brand img { display: block; max-height: 50px; }
.header-controls, .header-account { display: flex; align-items: center; min-height: 54px; }
.header-controls { min-width: 0; }
.header-account { white-space: nowrap; }
.account { display: flex; gap: 10px; align-items: center; }
main { flex: 1; min-height: 0; padding: 10px 13px 13px; }
.overview-page { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.overview-page.settings-open { height: auto; min-height: 100%; }
.settings-open .table-container { flex: none; }
h1 { font-size: 28px; font-weight: 500; margin: 0 0 4px; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 14px; }
p { margin: 7px 0 14px; }
.badge { color: #38664c; background: #e4f0e7; border: 1px solid #c2d9c9; padding: 3px 8px; border-radius: 12px; margin-left: 10px; }
.toolbar { display: flex; width: 100%; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.settings-button { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 36px; padding: 6px; }
.settings-button img { display: block; width: 22px; height: 22px; }
.global-search { flex: 1 1 200px; min-width: 150px; max-width: 360px; }
.table-container { flex: 1 1 auto; min-height: 0; overflow: auto; border: 1px solid #c6d1d8; border-radius: 5px; background: white; }
table { border-collapse: separate; border-spacing: 0; width: 100%; }
th, td { border-right: 1px solid #dce3e7; border-bottom: 1px solid #dce3e7; padding: 12px 10px; text-align: left; }
th { background: #f5f8f9; position: sticky; top: 0; z-index: 2; height: 60px; font-weight: 500; }
.sortable-column { padding: 0; }
.sort-button { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 100%; min-height: 59px; padding: 0 18px; border: 0; border-radius: 0; background: transparent; text-align: left; text-transform: capitalize; letter-spacing: .03em; }
.sort-indicator { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 16px; height: 16px; margin-left: 8px; }
.sort-indicator img { display: block; width: 16px; height: 16px; }
.file-column { padding-left: 18px; }
.column-resize-handle { position: absolute; top: 0; right: -12px; z-index: 3; width: 24px; height: 100%; padding: 0; border: 0; border-radius: 0; background: transparent; cursor: col-resize; touch-action: none; }
.column-resize-handle::after { position: absolute; top: 10px; bottom: 10px; left: 11px; width: 2px; border-radius: 2px; background: #a5bbc7; content: ""; }
.overview-table thead tr:first-child th:last-child .column-resize-handle { right: 0; }
.overview-table thead tr:first-child th:last-child .column-resize-handle::after { left: 21px; }
.column-resize-handle:hover:not(:disabled), .column-resize-handle:focus-visible { background: transparent; }
.column-resize-handle:hover::after, .column-resize-handle:focus-visible::after { background: #096a9b; }
.resizing-columns { user-select: none; cursor: col-resize; }
.overview-table td { max-width: none; }
.overview-table .selection-column { width: 44px; min-width: 44px; padding: 0; text-align: center; }
.overview-table .selection-cell { width: 44px; padding: 0; text-align: center; }
.selection-cell input { width: 18px; height: 18px; margin: 0; padding: 0; vertical-align: middle; cursor: pointer; }
.overview-table tbody tr:has(.selection-cell input:checked) td { background: #fff1bd; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.filters th { top: 60px; height: 50px; padding: 6px; background: white; }
.filters input, .filters select { width: 100%; min-width: 0; padding: 6px; }
.filter-control { display: flex; align-items: center; gap: 4px; }
.filter-control > input, .filter-control > select { flex: 1; min-width: 0; }
.specification-presence-toggle {
    display: inline-flex; flex: none; align-items: center; justify-content: center;
    width: 32px; height: 32px; padding: 5px; background: #f4f6f7;
}
.specification-presence-toggle img { display: block; width: 20px; height: 20px; filter: grayscale(1); opacity: .5; }
.specification-presence-toggle.active { border-color: #168548; background: #e5f4e9; }
.specification-presence-toggle.active img { filter: none; opacity: 1; }
.clear-filter { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border-radius: 50%; background: #e5eef3; }
.clear-filter img { display: block; width: 12px; height: 12px; }
.filters th:has(.sample-type-filter[open], .project-status-filter[open], .date-filter[open]) { z-index: 4; }
.sample-type-filter, .project-status-filter, .date-filter { position: relative; flex: 1; min-width: 0; }
.sample-type-filter summary, .project-status-filter summary, .date-filter summary { overflow: hidden; cursor: pointer; white-space: nowrap; text-overflow: ellipsis; }
.sample-type-options, .project-status-options { position: absolute; top: 100%; left: 0; min-width: 180px; max-height: min(320px, 50dvh); overflow: auto; padding: 6px; border: 1px solid #b9c5cd; border-radius: 4px; background: white; box-shadow: 0 4px 14px rgb(22 39 52 / 18%); }
.sample-type-options label, .project-status-options label { display: flex; align-items: center; gap: 6px; padding: 3px; white-space: nowrap; cursor: pointer; }
.sample-type-options input, .project-status-options input { width: auto; min-width: 0; margin: 0; }
.sample-type-options .select-all, .project-status-options .select-all { width: 100%; padding: 4px 3px; border: 0; border-bottom: 1px solid #dce3e7; border-radius: 0; background: transparent; color: #096a9b; font-weight: 600; text-align: left; }
.date-filter-options { position: absolute; top: 100%; left: 0; display: grid; gap: 6px; min-width: 210px; padding: 9px; border: 1px solid #b9c5cd; border-radius: 4px; background: white; box-shadow: 0 4px 14px rgb(22 39 52 / 18%); }
.date-filter-options label { display: grid; gap: 2px; }
.date-filter-options input { min-width: 0; }
td { padding: 2px 10px; max-width: 220px; overflow-wrap: break-word; }
.specification-display { display: flex; align-items: center; gap: 6px; }
.specification-editor { display: grid; grid-template-columns: max-content max-content; gap: 6px; }
.specification-display button, .specification-editor button { padding: 2px 6px; }
.specification-editor input { grid-column: 1 / -1; min-width: 0; width: 110px; padding: 2px 6px; }
.file-actions { display: flex; align-items: center; gap: 6px; }
.file-icon-button { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 5px; }
.file-icon-button:disabled { opacity: .3; }
.file-icon-button img { display: block; width: 22px; height: 22px; }
.file-cell small { display: block; margin-top: 4px; }
.file-item + .file-item { margin-top: 8px; }
.file-button { display: inline-block; padding: 5px 8px; border: 1px solid #b9c5cd; border-radius: 4px; background: white; text-decoration: none; }
.file-button:hover { background: #eaf2f6; border-color: #54768b; }
.file-item small { display: block; margin-top: 4px; color: #576978; }
.file-modal { width: min(520px, calc(100% - 32px)); max-height: calc(100vh - 48px); overflow: auto; padding: 20px; border: 1px solid #aebec8; border-radius: 6px; color: inherit; }
.file-modal-wide { width: min(760px, calc(100% - 32px)); }
.file-modal::backdrop { background: rgb(22 39 52 / 55%); }
.file-modal-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.file-modal-heading h2 { margin: 0; }
.file-modal .file-item { margin-top: 14px; }
.file-table-scroll { overflow-x: auto; margin-top: 16px; }
.file-table th, .file-table td { min-width: 0; max-width: none; height: auto; padding: 8px 10px; }
.file-table th { position: static; }
.file-table th:last-child, .file-table td:last-child { white-space: nowrap; }
.note-text { white-space: pre-wrap; }
tr:hover td { background: #f4f9fb; }
tr.late td { color: #b52f3a; }
.yes { color: #168548; font-size: 18px; }
.no { color: #b52f3a; font-size: 17px; }
.empty { text-align: center; padding: 45px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 7px 0; }
.pagination-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.pagination-controls > span[role="status"] { margin-right: 12px; }
.page-size { margin-left: auto; white-space: nowrap; }
.page-size select { margin-left: 8px; }
.toast-container { position: fixed; top: 16px; right: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid; border-radius: 5px; box-shadow: 0 4px 14px rgb(22 39 52 / 18%); pointer-events: auto; }
.toast-info { background: #e7f2ea; border-color: #bad5c0; }
.toast-error { background: #fff0ee; border-color: #e8b7b2; color: #982c25; }
.toast-content { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-close { flex: none; padding: 0; width: 24px; height: 24px; border: 0; background: transparent; font-size: 20px; line-height: 1; }
.column-picker { background: white; padding: 9px 11px; border: 1px solid #ccd7de; border-radius: 5px; margin-bottom: 9px; }
.settings-section + .settings-section { border-top: 1px solid #dce3e7; margin-top: 9px; padding-top: 9px; }
.column-option { display: flex; width: min(100%, 340px); align-items: center; gap: 8px; padding: 3px; border-radius: 4px; }
.column-option:has(.drag-handle):hover { background: #f1f6f8; }
.column-option.dragging { opacity: .5; }
.column-drop-placeholder { display: flex; align-items: center; justify-content: center; width: min(100%, 340px); height: 36px; margin: 3px 0; border: 2px dashed #3985a8; border-radius: 4px; background: #eaf5fa; color: #34627a; }
.column-option label { flex: 1; }
.drag-handle { width: 28px; height: 28px; padding: 0; border: 0; background: transparent; cursor: grab; font-size: 21px; line-height: 1; }
.drag-handle:active { cursor: grabbing; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.loading { padding: 30px; }
#blazor-error-ui { display: none; position: fixed; top: 16px; right: 16px; width: min(380px, calc(100vw - 32px)); padding: 12px; border: 1px solid #e8b7b2; border-radius: 5px; background: #fff0ee; color: #982c25; box-shadow: 0 4px 14px rgb(22 39 52 / 18%); z-index: 1001; }
@media (max-width: 700px) {
    main { padding: 7px; }
    .site-header { grid-template-columns: minmax(0, 1fr) auto; padding: 7px 7px 0; gap: 7px; }
    .header-controls { grid-column: 1 / -1; grid-row: 2; }
    .account span { max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
    .pagination { flex-wrap: wrap; }
}
