:root { color-scheme: light; --ink: #18373c; --muted: #53676a; --line: #d6e1df; --green: #176b56; }
[hidden] { display: none !important; }
button:disabled { opacity: .55; cursor: not-allowed; }
button.secondary { background: white; border-color: var(--line); color: var(--ink); }
.scanner { max-width: 1000px; }
.transfer-options { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
.scan-entry { display: flex; gap: 12px; }
#scan-input { font-size: 22px; min-height: 58px; }
.scan-status { margin-top: 24px; padding: 18px; border-radius: 8px; background: #eaf0ee; font-weight: 650; }
.scan-good { color: #165439; background: #daf2e4; }
.scan-bad { color: #8a222a; background: #ffe3e4; }
.flash-good { animation: flash-good .45s ease-out; }
.flash-bad { animation: flash-bad .45s ease-out; }
@keyframes flash-good { from { box-shadow: 0 0 0 8px #57bb86; } to { box-shadow: 0 0 0 0 transparent; } }
@keyframes flash-bad { from { box-shadow: 0 0 0 8px #e67b83; } to { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .flash-good, .flash-bad { animation: none; } }
.source-choice { display: block; margin-top: 12px; text-align: left; }
.po-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; }
.po-line-form input[type=checkbox] { display: block; }
.shipment-row, .notice-row { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 12px 0; flex-wrap: wrap; }
.notice-row { padding: 14px 18px; }
.shipment-row + .shipment-row { border-top: 1px solid var(--line); }
.shipment-summary { margin-bottom: 12px; overflow-wrap: anywhere; }
.label-link { display: inline-flex; align-items: center; min-height: 44px; }
.barcode-label { display: block; background: white; color: black; border: 1px dashed #888; padding: 4mm; margin: 8mm 0; break-inside: avoid; page-break-inside: avoid; box-sizing: border-box; }
.barcode-label strong { display: block; font-size: 14pt; }
.barcode-label p { font-size: 9pt; overflow-wrap: anywhere; margin: 2mm 0; }
.barcode-label img { display: block; max-width: none; }
.label-code { font: 11pt ui-monospace, monospace; overflow-wrap: anywhere; }
.print-controls { max-width: 900px; }
@page { margin: 10mm; }
@media print {
  .app-header, .main-nav, .skip, footer, .print-controls { display: none !important; }
  body, main { background: white; margin: 0; padding: 0; max-width: none; }
  .barcode-label { margin: 0 0 5mm; }
}
@media (max-width: 600px) { .transfer-options { grid-template-columns: 1fr; gap: 0; } .scan-entry { flex-wrap: wrap; } }
* { box-sizing: border-box; }
body { margin: 0; background: #f3f6f5; color: var(--ink); font: 16px/1.5 system-ui, sans-serif; }
a { color: #145f61; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button, .button { display: inline-flex; justify-content: center; align-items: center; min-height: 46px; padding: 10px 18px; border: 1px solid var(--green); border-radius: 7px; background: var(--green); color: white; font-weight: 650; text-decoration: none; cursor: pointer; }
button:hover, .button:hover { filter: brightness(.93); }
.button.secondary { background: white; border-color: var(--line); color: var(--ink); }
button.danger { background: #a02c30; border-color: #a02c30; }
:focus-visible { outline: 3px solid #e0a936; outline-offset: 3px; }
.skip { position: absolute; top: -100px; padding: 12px; background: white; z-index: 5; }
.skip:focus { top: 0; }
.app-header { background: #163a41; color: white; padding: 20px 32px; display: flex; justify-content: space-between; gap: 24px; align-items: center; flex-wrap: wrap; }
.brand { display: inline-flex; flex: 0 1 auto; align-items: center; max-width: 100%; min-height: 64px; padding: 6px 0; color: white; text-decoration: none; border-radius: 8px; }
.brand crate-logo { display: inline-flex; max-width: 100%; font-size: 22px; --crate-cap: #fffaf2; --crate-rest: #fffaf2; --crate-accent: linear-gradient(90deg, #d1b7df, #d4db6a); }
.brand crate-logo::part(bot) { width: 44px; height: 44px; }
.brand crate-logo::part(character) { filter: drop-shadow(1px 0 0 #fffaf2) drop-shadow(-1px 0 0 #fffaf2) drop-shadow(0 1px 0 #fffaf2) drop-shadow(0 -1px 0 #fffaf2); }
@media (max-width: 719px) {
  .brand crate-logo { font-size: 18px; }
  .brand crate-logo::part(bot) { width: 38px; height: 38px; }
}
.theme-refined .account small { color: #eee2f5; }
.account { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.account a { color: white; min-height: 44px; display: inline-flex; align-items: center; }
.account small { color: #c2d5d4; }
.quiet { background: transparent; border-color: #779296; }
.main-nav { padding: 0 24px; background: white; border-bottom: 1px solid var(--line); display: flex; gap: 8px; overflow-x: auto; }
.main-nav a { min-height: 56px; display: flex; align-items: center; padding: 12px 18px; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; }
.main-nav a[aria-current] { color: var(--green); border-bottom-color: var(--green); font-weight: 700; }
main { max-width: 1440px; padding: 32px; margin: auto; }
footer { padding: 24px 32px; font-size: 13px; color: var(--muted); }
h1 { font-size: clamp(28px, 4vw, 38px); letter-spacing: -.03em; line-height: 1.2; margin: 4px 0 12px; }
p { margin: 12px 0; }
.eyebrow { color: var(--green); text-transform: uppercase; font-size: 12px; font-weight: 750; letter-spacing: .09em; margin: 0 0 8px; }
.muted, small, .help { color: var(--muted); }
small { display: block; font-size: 13px; font-weight: 400; margin-top: 4px; }
.page-heading { display: flex; justify-content: space-between; gap: 24px; align-items: center; margin-bottom: 24px; }
.panel { background: white; border: 1px solid var(--line); border-radius: 10px; padding: 24px; margin-bottom: 24px; }
.form-panel { max-width: 720px; }
.auth-panel { max-width: 460px; margin: 36px auto; }
.field { margin-bottom: 20px; min-width: 0; }
label { display: block; font-size: 14px; font-weight: 650; margin-bottom: 7px; }
input:not([type=checkbox]):not([type=hidden]), select, textarea { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #9aafae; border-radius: 6px; color: var(--ink); background: white; }
textarea { resize: vertical; }
input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--green); margin: 0; }
.checkbox { display: flex; gap: 10px; align-items: center; min-height: 44px; }
.help { font-size: 13px; margin-top: 6px; }
.help ul { padding-left: 20px; }
.error { color: #982e32; margin: 8px 0; font-size: 14px; }
.error ul { list-style: none; padding: 0; margin: 0; }
.invalid input, .invalid select, .invalid textarea { border-color: #982e32; }
.notice { border: 1px solid #a2ccba; background: #e9f5ee; border-radius: 7px; padding: 14px 18px; margin-bottom: 20px; }
.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.search-bar { display: flex; gap: 14px; align-items: center; }
.search-bar label { white-space: nowrap; margin: 0; }
.search-bar input { max-width: 500px; }
.filters { display: grid; grid-template-columns: minmax(220px, 2fr) minmax(160px, 1fr) auto auto; gap: 18px; align-items: end; }
.filters .field { margin: 0; }
.filters .error { grid-column: 1 / -1; }
.table-wrap { padding: 0; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: 14px; }
th, td { padding: 18px 20px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead { background: #eaf0ee; }
thead th { font-size: 12px; color: #526666; text-transform: uppercase; letter-spacing: .045em; white-space: nowrap; }
tbody tr:last-child > * { border-bottom: 0; }
tbody th { min-width: 170px; font-weight: 650; }
.row-actions { display: flex; gap: 12px; }
.row-actions a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; }
.badge { display: inline-block; padding: 5px 10px; border-radius: 5px; font-size: 12px; font-weight: 650; background: #e7edeb; white-space: nowrap; }
.low { color: #855108; background: #fff0d0; }
.good { color: #246045; background: #e6f3eb; }
.quantity { font-size: 23px; font-weight: 750; }
.code, .code-line { font-family: ui-monospace, monospace; overflow-wrap: anywhere; }
.code-line { display: block; }
summary { min-height: 44px; min-width: 120px; cursor: pointer; color: #145f61; padding: 10px 4px; font-weight: 600; }
.serials { list-style: none; padding: 0; margin: 0; }
.serials li { padding: 10px 4px; border-top: 1px solid var(--line); }
.empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.pagination { display: flex; gap: 20px; align-items: center; justify-content: center; margin: 24px 0; }
@media (max-width: 1000px) { .filters { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) {
  .stock-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .stock-table tbody { display: block; }
  .stock-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); border-bottom: 2px solid var(--line); }
  .stock-table tbody tr:last-child { border-bottom: 0; }
  .stock-table tbody th, .stock-table td { min-width: 0; border: 0; padding: 12px 20px; overflow-wrap: anywhere; }
  .stock-table tbody th { grid-column: 1 / -1; background: #eaf0ee; font-size: 17px; }
  .stock-location, .stock-serials, .stock-table .empty { grid-column: 1 / -1; }
  .stock-table td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: 12px; font-weight: 600; margin-bottom: 6px; }
}
@media (max-width: 600px) {
  main { padding: 20px 14px; }
  .app-header { padding: 18px; }
  .main-nav { padding: 0 8px; }
  .main-nav a { padding: 12px; }
  .account { gap: 12px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .panel { padding: 18px; }
  .table-wrap { padding: 0; }
  .search-bar { flex-wrap: wrap; }
  .search-bar label { width: 100%; }
  .filters { grid-template-columns: 1fr; }
  .auth-panel { margin: 12px auto; }
}

.project-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1rem; margin: 1rem 0; }
.project-metrics small { display: block; }
.allocation-row { border-top: 1px solid var(--border); padding: 1rem 0; }
.allocation-row input[type=number] { max-width: 120px; }

.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px; margin: 20px 0; }
.report-grid .panel { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.metric { display: block; text-decoration: none; }
.metric strong { display: block; font-size: 2rem; }
.audit-json { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }

#navigation-toggle { display: none; }
.appearance-form input[type=radio] { width: 22px; min-height: 22px; height: 22px; padding: 0; flex-shrink: 0; accent-color: var(--green); margin: 0 10px 0 0; }
.appearance-form label:has(input[type=radio]) { display: flex; align-items: center; min-height: 46px; }
.layout-preview { height: 160px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; display: grid; background: #f4f5f8; }
.layout-preview > div { background: #163a41; grid-column: 1 / -1; }
.layout-preview > aside { background: white; }
.layout-preview > section { display: flex; gap: 8px; padding: 15px; }
.layout-preview i { flex: 1; border: 1px solid #e1dce7; border-radius: 5px; background: white; }
.preview-classic { grid-template-rows: 30px 22px 1fr; }
.preview-refined { grid-template-columns: 44px 1fr; grid-template-rows: 30px 1fr; }
.preview-refined > div, .preview-refined > aside { background: #4a2361; }
.theme-refined { --ink: #302a38; --muted: #66606e; --line: #e1dce7; --green: #4a2361; background: #f5f4f8; }
.theme-refined.has-navigation { display: grid; grid-template-columns: 232px minmax(0, 1fr); grid-template-rows: auto 1fr auto; min-height: 100dvh; }
.theme-refined .app-header { grid-column: 1 / -1; padding: 22px 30px; background: #4a2361; box-shadow: 0 2px 8px #24102f15; }
.theme-refined a { color: #4a2361; }
.theme-refined .brand, .theme-refined .account a, .theme-refined .button:not(.secondary) { color: #fff; }
.theme-refined .quiet { color: white; border-color: #ac8bbf; }
.theme-refined .main-nav { grid-column: 1; grid-row: 2 / 4; position: sticky; top: 0; align-self: start; flex-direction: column; gap: 4px; height: calc(100dvh - 140px); min-height: 300px; max-height: 100dvh; padding: 20px 12px; background: #4a2361; border: 0; border-radius: 0 0 14px 0; overflow-y: auto; overflow-x: hidden; scrollbar-color: #b698c8 #4a2361; }
.theme-refined .main-nav a { min-height: 46px; flex-shrink: 0; padding: 11px 16px; border: 0; border-radius: 6px; color: #f7effc; font-size: 14px; font-weight: 550; }
.theme-refined .main-nav a:hover { background: #623b77; color: white; }
.theme-refined .main-nav a[aria-current] { color: #4a2361; background: #fff; box-shadow: 0 2px 5px #23102e18; font-weight: 750; }
.theme-refined.has-navigation main { grid-column: 2; grid-row: 2; width: 100%; min-width: 0; padding: 30px clamp(20px, 3vw, 44px); margin: 0; max-width: 1680px; }
.theme-refined.has-navigation footer { grid-column: 2; grid-row: 3; }
.theme-refined .panel { border-radius: 10px; box-shadow: 0 3px 14px #34213e05; }
.theme-refined .button.secondary, .theme-refined button.secondary { color: #4a2361; border-color: #cfc0d9; }
.theme-refined thead { background: #eee8f3; }
.theme-refined thead th { color: #554062; }
.theme-refined tbody tr:hover { background: #faf8fc; }
.theme-refined .badge:not(.low):not(.good) { background: #eee8f3; color: #4a2361; }
.theme-refined .stock-table tbody th { background: #f4f0f7; }
.theme-refined .page-heading h1 { font-weight: 650; }
@media (min-width: 720px) and (max-width: 1050px) {
  .theme-refined.has-navigation { grid-template-columns: 190px minmax(0, 1fr); }
  .theme-refined .main-nav { padding: 16px 8px; }
  .theme-refined .main-nav a { padding: 10px 12px; }
  .theme-refined .filters { grid-template-columns: minmax(0, 1fr); }
  .theme-refined .page-heading { align-items: flex-start; flex-direction: column; }
  .theme-refined .transfer-options { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 719px) {
  .theme-refined.has-navigation { display: block; }
  .theme-refined .app-header { padding: 18px; gap: 16px; }
  .theme-refined.navigation-ready #navigation-toggle { display: inline-flex; }
  .theme-refined .main-nav { position: static; height: auto; min-height: 0; max-height: 65dvh; border-radius: 0; }
  .theme-refined.navigation-ready:not(.navigation-open) .main-nav { display: none; }
  .theme-refined.has-navigation main { padding: 22px 16px; }
  .theme-refined .filters, .theme-refined .transfer-options { grid-template-columns: minmax(0, 1fr); }
}
@media print {
  .theme-refined.has-navigation { display: block; }
  .theme-refined.has-navigation main { padding: 0; margin: 0; max-width: none; }
  #navigation-toggle { display: none !important; }
}

/* Compact workspace navigation shared by both themes. */
.nav-icon { width: 20px; height: 20px; flex: 0 0 20px; vertical-align: middle; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.app-header, .theme-refined .app-header { padding: 12px 24px; gap: 18px; }
.account { gap: 14px; font-size: 12px; }
.account small { font-size: 11px; margin-top: 0; }
.account .quiet { min-height: 38px; padding: 6px 12px; font-size: 12px; }
.header-search { display: flex; flex: 1 1 240px; max-width: 520px; align-items: center; border-radius: 7px; background: white; overflow: hidden; }
.header-search input[type=search] { min-height: 40px; min-width: 0; border: 0; border-radius: 0; background: white; color: #302a38; font-size: 14px; }
.header-search button { min-height: 40px; padding: 8px 12px; border: 0; border-radius: 0; }
.header-search:focus-within { outline: 3px solid #e0a936; outline-offset: 2px; }
.main-nav { overflow: visible; flex-wrap: wrap; }
.main-nav a { gap: 10px; }
.nav-group { position: relative; }
.nav-group summary { min-height: 56px; padding: 12px 18px; display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; color: var(--muted); }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary:hover { background: #f1edf4; color: #4a2361; }
.nav-chevron { margin-left: auto; }
.nav-group[open] .nav-chevron { transform: rotate(180deg); }
.nav-children { position: absolute; top: 100%; left: 0; min-width: 220px; z-index: 30; padding: 6px; background: white; border: 1px solid var(--line); border-radius: 0 0 8px 8px; box-shadow: 0 5px 15px #302a3815; }
.nav-children a { min-height: 44px; font-size: 13px; border-radius: 5px; }
.nav-children .nav-icon { width: 16px; height: 16px; flex-basis: 16px; }
.theme-refined .main-nav { height: calc(100dvh - 98px); flex-wrap: nowrap; overflow-y: auto; overflow-x: hidden; }
.theme-refined .nav-group { flex-shrink: 0; }
.theme-refined .nav-group summary { min-height: 46px; padding: 11px 16px; color: #f7effc; font-size: 14px; font-weight: 550; border-radius: 6px; }
.theme-refined .nav-group summary:hover { color: white; background: #623b77; }
.theme-refined .nav-group[open] summary { background: #623b77; color: white; }
.theme-refined .nav-children { position: static; min-width: 0; padding: 4px 0 6px 10px; border: 0; background: transparent; box-shadow: none; }
.theme-refined .nav-children a { font-size: 13px; min-height: 44px; padding-left: 10px; white-space: normal; }
.section-card { display: flex; align-items: center; gap: 14px; min-height: 90px; text-decoration: none; }
.section-card > span:last-child { margin-left: auto; }
.permissions-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 24px; }
.permissions-form > .error, .permissions-form > button { grid-column: 1 / -1; }
@media (max-width: 1100px) { .header-search { order: 3; flex-basis: 100%; max-width: none; } }
@media (max-width: 719px) {
  .app-header, .theme-refined .app-header { padding: 12px 16px; gap: 12px; }
  .theme-refined .main-nav { height: auto; }
  .theme-classic .main-nav { display: block; }
  .theme-classic .nav-children { position: static; box-shadow: none; border: 0; padding-left: 20px; }
}
@media print { .header-search { display: none; } }

main th, main td { padding: 7px 10px; line-height: 1.35; }
main table > tbody > tr:nth-child(odd) { background: #fff; }
main table > tbody > tr:nth-child(even) { background: #f2f3f5; }
main table > tbody > tr:hover { background: #ece8f0; }
main table small { font-size: 12px; margin-top: 2px; }
main table p { margin: 3px 0; }
main table .badge { padding: 2px 6px; }
main table .quantity { font-size: 17px; }
main table summary { min-width: 0; padding: 5px 0; }
.table-action { display: inline-flex; align-items: center; min-height: 32px; }
.button.danger { background: #a02c30; border-color: #a02c30; color: #fff; }
main table .button, main table button { min-height: 32px; padding: 4px 8px; font-size: 12px; }
main table input[type=number] { min-height: 32px; padding: 4px 6px; max-width: 100px; }
main table .actions { gap: 6px; }
main table .allocation-row { padding: 6px 0; min-width: 220px; }
.project-table { min-width: 980px; }
.project-table th:first-child { width: 20%; }
.project-table td:last-child { min-width: 230px; }
.supply-summary + .supply-summary { border-top: 1px solid var(--line); padding-top: 5px; margin-top: 5px; }
.shipment-summary { margin-bottom: 4px; }
#po-line-forms .po-line-form { padding: 8px 12px; margin: 0; border-radius: 0; border-bottom: 0; }
#po-line-forms .po-line-form:last-child { border-bottom: 1px solid var(--line); margin-bottom: 16px; }
#po-line-forms .po-line-form:nth-child(even) { background: #f2f3f5; }
.po-line-form .po-filters { grid-template-columns: minmax(200px, 1fr) 120px 70px; gap: 12px; align-items: end; }
.po-line-form .field { margin: 0; }
.po-line-form .error:empty { display: none; }
.po-line-form label { margin-bottom: 2px; font-size: 12px; }
.po-line-form input:not([type=checkbox]):not([type=hidden]), .po-line-form select { min-height: 34px; padding: 5px 8px; }
.page-heading { margin-bottom: 14px; }
@media (pointer: coarse) {
  main table button, main table .button, main table summary, .table-action { min-height: 44px; }
  .po-line-form input:not([type=checkbox]):not([type=hidden]), .po-line-form select { min-height: 44px; }
}
@media (max-width: 600px) { .po-line-form .po-filters { grid-template-columns: minmax(160px, 1fr) 75px 50px; gap: 6px; } #po-line-forms { overflow-x: auto; } }

main .stock-table tbody th, .theme-refined main .stock-table tbody th { background: inherit; }

/* Compact project actions share the app's button language. */
.project-table.project-bom .button, .project-table.project-bom button { padding: .35rem .6rem; min-height: 30px; font-size: .82rem; line-height: 1.2; border-radius: .5rem; text-decoration: none; }
.project-bom details > summary { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .6rem; margin: .25rem 0; border: 1px solid currentColor; border-radius: .5rem; font-size: .82rem; font-weight: 600; cursor: pointer; text-decoration: none; }
.project-bom details > summary::before { content: '+'; }
.project-bom details[open] > summary::before { content: '−'; }
.project-bom .allocation-row { margin: .35rem 0; padding: .5rem; border-inline-start: 3px solid currentColor; }

/* Integration settings keep each provider in a compact, expandable section. */
.integration-form { max-width: 68rem; }
.integration-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); gap: .75rem 1.5rem; padding-top: 1rem; }
.integration-fields .field { min-width: 0; }
.integration-fields input { max-width: 100%; }

.stock-page-actions { margin-left:auto; justify-content:flex-end; }
