:root {
  --ink: #292237;
  --muted: #615a71;
  --line: #ded9e6;
  --canvas: #f6f4f9;
  --paper: #fff;
  --accent: #55378b;
  --accent-dark: #42266f;
  --rail: #282038;
  --rail-active: #48345f;
  --highlight: #f1eafa;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.topbar { background: var(--rail); border-bottom: 1px solid #493c5d; }
.topbar-content { width: calc(100% - 3rem); min-height: 3.55rem; }
.topbar a { color: #fff; }
.brand strong { letter-spacing: .12em; }
.brand span, .account span { color: #e3daef; }
.test-badge { border-color: #9a825d; color: #ffe3a4; }
.skip-link { position: fixed; top: .5rem; left: 1rem; z-index: 5; transform: translateY(-200%); background: var(--paper); padding: .55rem 1rem; }
.skip-link:focus { transform: none; }

.workspace-shell { display: grid; grid-template-columns: 12.6rem minmax(0, 1fr); min-height: calc(100vh - 3.55rem); }
.workspace-shell > .content { width: calc(100% - 3rem); max-width: 1480px; padding: 1.4rem 0 3rem; }
.workspace-side { background: var(--rail); }
.workspace-nav { position: sticky; top: 0; max-height: 100vh; overflow: auto; padding: .8rem .65rem 1.4rem; }
.workspace-nav-group + .workspace-nav-group { margin-top: 1rem; }
.workspace-nav-group p { color: #cbbeda; font-size: .78rem; font-weight: 680; padding: 0 .8rem .25rem; }
.workspace-nav-link { display: block; text-decoration: none; color: #fff; padding: .46rem .62rem; margin: .08rem 0; border-radius: .35rem; border-inline-start: 3px solid transparent; font-size: .9rem; }
.workspace-nav-link:hover { background: #382b4b; }
.workspace-nav-link[aria-current] { background: var(--rail-active); border-color: #d2b5ff; font-weight: 700; }
.workspace-nav :focus-visible, .topbar :focus-visible { outline-color: #e0cbff; outline-offset: 1px; }
.workspace-overview { font-weight: 680; }
.workspace-mobile { display: none; }

h1 { font-size: clamp(1.55rem, 3vw, 2rem); letter-spacing: -.025em; overflow-wrap: anywhere; }
.page-heading { margin-bottom: 1rem; }
:focus-visible { outline-color: var(--accent); }
.panel { border-radius: .55rem; }
.report-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .45rem 1rem; }
.report-heading > p { margin: 0; }
.report-note { padding: 0 1rem .75rem; font-size: .85rem; }
th { background: #f4f1f8; }
td, th { padding: .52rem .72rem; }
tbody tr:hover td { background-color: #faf8fd; }
.primary, .secondary { border-radius: .36rem; }
.field-note { color: var(--muted); font-size: .85rem; }

.device-shortcut { display: flex; align-items: end; gap: .6rem; background: var(--highlight); border: 1px solid #dfd2ed; border-radius: .55rem; padding: .8rem 1rem; margin-bottom: 1rem; }
.device-shortcut label { flex: 1; min-width: 0; }
.device-shortcut input { background: var(--paper); }
.device-numbers { margin: 0; display: flex; flex-wrap: wrap; gap: .5rem 1.75rem; padding: .9rem 1rem; }
.device-numbers dt { font-size: .83rem; }
.device-numbers dd { margin: .15rem 0 0; overflow-wrap: anywhere; }
.serial-timeline h2 { padding-block: .85rem; }
.serial-timeline > .muted, .serial-timeline details { padding-bottom: .65rem; }
.device-meta { margin-block: .65rem 1rem; }
.device-meta .state { margin-right: .45rem; }
.table-scroll:focus-visible { outline-offset: 2px; }

.stock-matrix { --frozen-column: clamp(9.5rem,23vw,19rem); }
.stock-matrix table { table-layout: fixed; min-width: 47rem; }
.stock-matrix thead th { white-space: normal; overflow-wrap: anywhere; }
.stock-matrix th:first-child { position: sticky; left: 0; z-index: 1; width: var(--frozen-column); min-width: var(--frozen-column); box-shadow: 1px 0 var(--line); }
.stock-matrix tbody th { background: var(--paper); font-size: .89rem; color: var(--ink); }
.stock-matrix tbody tr:hover th { background: #faf8fd; }
.stock-matrix td a { display: block; font-weight: 670; }
.stock-matrix .zero-stock { color: var(--muted); font-weight: 500; }
.category-filters { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr)); }
.category-picker-fields { grid-column: span 2; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.availability-actions { grid-column: 1 / -1; }
.availability-actions .availability-toggle { flex: 1 1 auto; }
.catalog-filter-actions { justify-content: flex-end; }
select:disabled { background: var(--canvas); color: var(--muted); }
.availability-toggle input { accent-color: var(--accent); }
.warehouse-summary > summary { padding: .85rem 1rem; cursor: pointer; font-weight: 650; }

.ledger-nav { display: flex; flex-wrap: wrap; gap: .45rem; margin: 0 0 .85rem; }
.ledger-nav [aria-current] { color: var(--accent-dark); background-color: var(--highlight); border-color: #c6b2dc; }
.doc-kind { font-size: .8rem; color: var(--muted); }
.document-list th, .document-list td { vertical-align: top; }
.document-list .numeric { white-space: nowrap; }

.checkout-form { background: none; border: 0; padding: 0; }
.checkout-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(15.5rem, 24%); gap: 1rem; align-items: start; }
.checkout-items .panel { padding: .85rem 1rem; }
.checkout-session { color: var(--muted); margin-top: .38rem; }
.checkout-scanner { background: var(--highlight); border-color: #dfd2ed; }
.checkout-scanner .actions { flex-wrap: nowrap; gap: .5rem; align-items: end; }
.checkout-scanner input { min-width: 0; }
.checkout-scanner button { flex-shrink: 0; }
#scan-status:not(:empty) { display: block; margin-top: .45rem; }
.checkout-summary { position: sticky; top: .85rem; padding: 1rem; }
.checkout-summary .checkout-total { display: block; padding: 0 0 .75rem; border-top: 0; border-bottom: 1px solid var(--line); margin: 0 0 .8rem; font-size: .95rem; }
.checkout-summary #checkout-amount { display: block; margin-top: .22rem; font-size: clamp(1.4rem, 3vw, 1.85rem); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.checkout-summary button { width: 100%; margin-top: .6rem; }
.checkout-summary h2 { margin-bottom: .7rem; }
.checkout-items #add-line { margin-top: .45rem; }
.checkout-items .line-row .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (max-width: 980px) {
  .workspace-shell > .content { width: calc(100% - 2rem); }
  .checkout-columns { grid-template-columns: minmax(0, 1fr); }
  .checkout-summary { position: static; }
}
@media (max-width: 740px) {
  .workspace-shell { display: block; }
  .topbar-content { width: calc(100% - 1.5rem); gap: .5rem; }
  .workspace-desktop { display: none; }
  .workspace-mobile { display: flex; align-items: center; justify-content: space-between; gap: .35rem; padding: .35rem .7rem; color: #fff; background: #382b4b; }
  .workspace-mobile > nav { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem; }
  .workspace-mobile > nav a, .workspace-mobile summary { display: block; color: inherit; text-decoration: none; padding: .58rem .45rem; font-size: .85rem; }
  .workspace-mobile summary { display: list-item; cursor: pointer; }
  .workspace-mobile :focus-visible { outline-color: #e0cbff; }
  .workspace-mobile .workspace-nav { position: absolute; right: .5rem; z-index: 3; width: min(16rem, 100% - 1rem); max-height: 70vh; background: var(--rail); border: 1px solid #79658c; border-radius: .45rem; }

  .workspace-shell > .content { width: calc(100% - 1.5rem); padding-top: .95rem; }
}
@media (max-width: 480px) {
  .category-filters, .category-picker-fields { grid-template-columns: minmax(0, 1fr); }
  .category-picker-fields, .availability-actions { grid-column: auto; }
  .catalog-filter-actions { justify-content: flex-start; }
  .device-shortcut { align-items: stretch; flex-direction: column; }
  .checkout-items .line-row .form-grid { grid-template-columns: minmax(0, 1fr); }
  .checkout-scanner .actions { align-items: stretch; flex-direction: column; }
}
@media print {
  .workspace-side, .skip-link { display: none !important; }
  .workspace-shell { display: block; }
  .workspace-shell > .content { width: auto; max-width: none; padding: 0; }
}

.catalog-product-link { display: flex; align-items: center; gap: .6rem; }
.catalog-product-link img, .product-picture { object-fit: contain; background: var(--paper); border: 1px solid var(--line); border-radius: .35rem; }
.catalog-product-link img { flex: none; }
.product-summary { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .85rem; padding: 1rem; }
.product-summary .document-meta { flex: 1 1 20rem; padding: 0; }
.product-picture { max-width: 100%; }
