:root {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-synthesis: none;
  color-scheme: light;
  color: #1b2533;
  background: #f6f7f9;
  --paper: #fff;
  --muted: #566477;
  --line: #dde2e9;
  --ink: #182332;
  --selection: #eaf0f6;
  --accent: #a12f26;
  --accent-hover: #84271f;
  --focus: #426998;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input, select { font: inherit; }
button { cursor: pointer; color: inherit; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.icon { display: inline-block; width: 1rem; height: 1rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.button, .icon-button, .text-button { display: inline-flex; align-items: center; justify-content: center; gap: .4375rem; min-height: 2.375rem; padding: .375rem .6875rem; border: 1px solid #cfd7e1; border-radius: .3125rem; background: var(--paper); font-size: .875rem; font-weight: 600; white-space: nowrap; }
.button:hover, .icon-button:hover, .text-button:hover { background: #edf1f5; }
.button:disabled { cursor: wait; opacity: .75; }
.button-primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.button-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.icon-button, .text-button { border-color: transparent; background: transparent; }
.icon-button { padding: .375rem; color: var(--muted); }
.text-button { color: #3a4c62; min-height: 2.125rem; }
input:not([type="checkbox"]), select { display: block; width: 100%; min-width: 0; height: 2.375rem; padding: .375rem .625rem; color: inherit; background-color: #fff; border: 1px solid #cfd7e1; border-radius: .3125rem; }
input::placeholder { color: #5c6c82; }
input:focus, select:focus { border-color: var(--focus); outline: 2px solid #c3d2e4; outline-offset: 0; }
select { appearance: none; cursor: pointer; padding-right: 1.75rem; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23526176' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E") right .5rem center/1rem no-repeat; text-overflow: ellipsis; }

.sign-in { display: grid; grid-template-columns: minmax(0, 44%) minmax(0, 56%); min-height: 100vh; min-height: 100svh; padding: 1rem; background: #fff; }
.sign-in-main { display: grid; grid-template-rows: auto 1fr; justify-items: start; padding: 1.25rem clamp(1.25rem, 6.25vw, 7.75rem) 2rem; }
.sign-in-logo { display: block; width: 9.5rem; height: auto; margin-left: -.375rem; }
.sign-in-form { align-self: center; width: min(100%, 23.5rem); padding-block: 2rem 4rem; }
.sign-in-form h1 { margin: 0 0 2rem; font-size: clamp(2rem, 3.05vw, 3.125rem); font-weight: 700; letter-spacing: -.035em; line-height: 1.1; }
.sign-in-form label { display: block; margin: 0 0 .5rem; font-weight: 600; font-size: .875rem; }
.sign-in-form input:not([type="checkbox"]) { height: 3.125rem; padding-inline: .875rem; }
.sign-in-form > input { margin-bottom: 1.25rem; }
.password-control { position: relative; }
.password-control input:not([type="checkbox"]) { padding-right: 3rem; }
.password-control .icon-button { position: absolute; right: .3125rem; top: .3125rem; width: 2.5rem; height: 2.5rem; }
.sign-in-submit { width: 100%; min-height: 3.125rem; margin-top: 1.5rem; font-size: .9375rem; }
.sign-in-photo { min-width: 0; border-radius: .4375rem; background: #263244 url("./production.webp") center/cover no-repeat; }

.app-bar { background: var(--ink); color: #e9edf3; }
.app-bar-inner { display: flex; align-items: stretch; min-height: 4rem; width: min(100%, 99rem); margin: auto; padding-inline: clamp(1.25rem, 3.5vw, 3.75rem); gap: clamp(1.5rem, 3.5vw, 3.5rem); }
.app-brand { display: flex; align-items: center; gap: .75rem; color: #d2dae5; font-size: .875rem; font-weight: 600; white-space: nowrap; }
.app-brand img { display: block; width: 5rem; height: auto; margin-left: -.2rem; }
.app-nav { display: flex; align-items: stretch; }
.app-nav a, .logout { display: inline-flex; align-items: center; gap: .5rem; padding: .5rem .875rem; min-height: 2.625rem; color: #c3cdda; font-size: .875rem; white-space: nowrap; }
.app-nav a:hover, .logout:hover { background: #273549; color: #fff; }
.app-nav a[aria-current="page"] { background: #2b394c; color: #fff; font-weight: 650; }
.app-bar :focus-visible { outline-color: #a6bedf; }
.logout { align-self: center; margin-left: auto; border: 0; border-radius: .3125rem; background: transparent; }

.workspace { width: min(100%, 99rem); margin-inline: auto; padding: 1.875rem clamp(1.25rem, 3.5vw, 3.75rem) 1.875rem; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem 1.5rem; margin-bottom: 1.25rem; }
.page-heading h1 { margin: 0; font-size: clamp(1.75rem, 2.55vw, 2.375rem); letter-spacing: -.032em; line-height: 1.15; }
.page-actions, .command-actions { display: flex; align-items: center; gap: .75rem; }
.page-actions span { font-size: .8125rem; color: var(--muted); }
.report { min-width: 0; }
.command-bar { display: flex; gap: .75rem; align-items: center; min-width: 0; margin-bottom: .75rem; }
.status-switcher, .view-switcher { flex: none; display: flex; align-items: stretch; min-width: 0; }
.status-switcher { gap: .875rem; }
.status-switcher button, .view-switcher button { display: inline-flex; align-items: center; justify-content: center; gap: .4375rem; min-height: 2.375rem; border: 0; background: transparent; color: var(--muted); font-size: .875rem; font-weight: 550; white-space: nowrap; }
.status-switcher button { padding: .3125rem .25rem .1875rem; border-bottom: 2px solid transparent; }
.status-switcher button:hover { color: #172d49; }
.status-switcher button[aria-pressed="true"] { border-color: #284d73; color: #172d49; font-weight: 650; }
.view-switcher { border: 1px solid #cfd7e1; border-radius: .3125rem; background: var(--paper); }
.view-switcher button { min-height: 2.25rem; padding-inline: .6875rem; }
.view-switcher button + button { border-left: 1px solid #cfd7e1; }
.view-switcher button:first-child { border-radius: .25rem 0 0 .25rem; }
.view-switcher button:last-child { border-radius: 0 .25rem .25rem 0; }
.view-switcher button:hover { background: #f0f3f6; }
.view-switcher button[aria-pressed="true"] { background: #e7edf4; color: #162f4f; font-weight: 650; }
.count { flex: none; color: var(--muted); font-size: .8125rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.search-box { position: relative; min-width: 0; flex: 1 1 14rem; font-size: .875rem; }
.search-box .icon { position: absolute; left: .6875rem; top: .6875rem; color: var(--muted); pointer-events: none; }
.search-box input:not([type="checkbox"]) { padding-left: 2.25rem; }
.order-command .search-box { max-width: 22rem; margin-left: auto; }
.command-actions { flex: none; }
.order-filter-toggle { min-height: 2.375rem; }
.order-filter-toggle[aria-expanded="true"] { background: #e7edf4; color: #162f4f; }
.filter-panel { margin-bottom: .75rem; padding: .875rem; border: 1px solid var(--line); border-radius: .375rem; background: var(--paper); }
.filter-grid { display: grid; grid-template-columns: minmax(9rem, 1fr) repeat(4, minmax(0, 1.1fr)); gap: .75rem; }
.filter-grid label { display: grid; gap: .375rem; font-size: .875rem; }
.filter-footer { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .5rem; }
.check { display: flex; align-items: center; gap: .5rem; font-size: .875rem; cursor: pointer; }
.check input { margin: 0; width: 1rem; height: 1rem; accent-color: #234872; }

.order-workbench { display: grid; grid-template-columns: minmax(17rem, 28.5%) minmax(0, 1fr); min-height: 24rem; }
.order-workbench, .stock-workbench, .report > .data-panel { border: 1px solid var(--line); border-radius: .4375rem; background: var(--paper); }
.order-list, .order-detail, .data-panel, .group-index { min-width: 0; }
.order-list { overflow: auto; padding: .25rem .625rem .5rem; border-right: 1px solid var(--line); scrollbar-gutter: stable; }
.order-date { margin: 0; padding: .8125rem .625rem .4375rem; color: var(--muted); font-size: .8125rem; font-weight: 650; }
.order-entry { display: grid; gap: .25rem; width: 100%; min-width: 0; margin: .0625rem 0; padding: .625rem; border: 0; border-radius: .25rem; background: transparent; text-align: left; }
.order-entry:hover { background: #f2f5f8; }
.order-entry[aria-pressed="true"] { color: #173456; background: var(--selection); }
.entry-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9375rem; line-height: 1.35; }
.entry-meta { display: flex; align-items: center; justify-content: space-between; gap: .375rem; min-width: 0; color: var(--muted); font-size: .8125rem; line-height: 1.35; }
.entry-meta span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-meta .pending { color: #865613; }
.order-detail { overflow: auto; }
.detail-header { padding: 1.5rem clamp(1rem, 2.1vw, 2rem) 1.375rem; }
.detail-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .625rem; }
.order-id { margin: 0 0 .4375rem; color: var(--muted); font-size: .875rem; font-variant-numeric: tabular-nums; }
.detail-top h2 { margin: 0; font-size: clamp(1.375rem, 2vw, 1.875rem); line-height: 1.15; font-weight: 700; letter-spacing: -.026em; }
.order-status { flex: none; padding-block: .125rem; color: #3f556f; font-size: .875rem; font-weight: 600; }
.order-status.pending { color: #805314; }
.order-status.done { color: #2d5b40; }
.detail-facts { display: grid; grid-template-columns: minmax(9rem, .8fr) minmax(0, 1.2fr); gap: 1rem 1.25rem; margin: 1.5rem 0 0; }
.detail-facts dt { margin: 0 0 .25rem; color: var(--muted); font-size: .8125rem; }
.detail-facts dd { margin: 0; font-size: .9375rem; line-height: 1.35; }
.detail-facts .delivery { grid-column: 1 / -1; }
.detail-products { padding: 1.125rem clamp(1rem, 2.1vw, 2rem) 1.5rem; border-top: 1px solid var(--line); }
.detail-products h3 { margin: 0 0 .75rem; font-size: 1rem; }
.detail-products .table-scroll { border-block: 1px solid var(--line); }
.detail-table { min-width: 20rem; }
.detail-table col:last-child { width: 8.5rem; }

.data-panel { overflow: hidden; }
.table-scroll { overflow: auto; min-width: 0; min-height: 0; }
table { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; font-size: .875rem; line-height: 1.4; }
thead th { padding: .625rem .875rem; border-bottom: 1px solid var(--line); background: #f5f7fa; color: #435267; text-align: left; font-weight: 650; }
td { padding: .625rem .875rem; vertical-align: top; border-bottom: 1px solid #e7ebf1; overflow-wrap: anywhere; }
tbody tr:last-child td { border-bottom: 0; }
.numeric { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.product-name, .client-name { font-weight: 625; }
.meta, .unit { color: var(--muted); font-size: .8125rem; }
.meta { display: block; margin-top: .125rem; }
.order-table { min-width: 48rem; }
.order-product { width: 32%; }
.order-qty { width: 12%; }
.order-client { width: 32%; }
.order-org { width: 24%; }
.group-row th { padding: .4375rem .875rem; border-bottom: 1px solid var(--line); background: #edf1f6; color: #33475e; font-size: .875rem; font-weight: 650; text-align: left; }
.empty { padding: 2rem 1rem; color: var(--muted); text-align: center; font-size: .9375rem; }
.order-detail > .empty { padding-block: 3rem; }
.inline-field { display: flex; align-items: center; gap: .4375rem; font-size: .875rem; white-space: nowrap; color: #35465d; }
.inline-field select { min-width: 8rem; max-width: 13rem; }
.inline-field input[type="number"] { width: 5.5rem; }
.inline-field input[type="date"] { width: 9.75rem; }
.stock-workbench { display: grid; grid-template-columns: 13rem minmax(0, 1fr); min-width: 0; }
.group-index { padding: .875rem .625rem; border-right: 1px solid var(--line); }
.group-index h2 { margin: 0 0 .5rem; padding-inline: .5rem; color: #46576d; font-size: .8125rem; font-weight: 650; }
.group-index button { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 2.375rem; gap: .75rem; padding: .375rem .5rem; border: 0; border-radius: .25rem; background: transparent; font-size: .875rem; text-align: left; }
.group-index button:hover { background: #f4f7fa; }
.group-index button[aria-pressed="true"] { color: #173456; background: var(--selection); font-weight: 650; }
.results-toolbar { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .375rem .75rem .375rem .875rem; border-bottom: 1px solid var(--line); }
.results-toolbar p { margin: 0; color: var(--muted); font-size: .875rem; }
.results-toolbar .text-button .icon { width: 1rem; }
.results-toolbar .is-collapsed .icon { transform: rotate(180deg); }
.stock-table { min-width: 39rem; }
.stock-warehouse { width: 23%; }
.stock-percent { width: 20%; }
.stock-qty { width: 15%; }
.stock-item td { vertical-align: middle; }
.stock-item:hover td { background: #f7f9fc; }
.sort-button, .group-toggle { display: flex; align-items: center; gap: .375rem; padding: 0; background: transparent; border: 0; text-align: left; font: inherit; }
.sort-button .icon, .group-toggle .icon { width: .875rem; height: .875rem; }
.stock-table th:not([aria-sort]) .sort-button .icon { visibility: hidden; }
.stock-table th.numeric .sort-button { margin-inline-start: auto; }
[aria-sort="ascending"] .sort-button .icon, .group-toggle[aria-expanded="false"] .icon { transform: rotate(-90deg); }
[aria-sort="ascending"] .sort-button .icon { transform: rotate(180deg); }
.group-meta { margin-left: .125rem; color: var(--muted); font-size: .8125rem; font-weight: 450; }
.shelf { display: grid; grid-template-columns: minmax(1.5rem, 1fr) 2.5rem; gap: .5rem; align-items: center; max-width: 8rem; color: #215c47; font-size: .8125rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.shelf.low { color: #825312; }
.shelf.expired { color: #952d36; }
.shelf-track { width: 100%; height: .3125rem; border: 0; border-radius: .25rem; overflow: hidden; accent-color: #3e876e; }
.shelf.low .shelf-track { accent-color: #b98222; }
.shelf.expired .shelf-track { accent-color: #a5454e; }
.quantity-line { display: block; white-space: nowrap; }
.received-toggle { padding-inline: .25rem; }
.form-message { margin: .625rem 0 0; font-size: .875rem; }
.form-message.error { color: #852f30; }
.report-notice { flex: none; margin: 0 0 .75rem; overflow-wrap: anywhere; }

.workspace.account-workspace { height: auto; }
.account-layout { display: grid; grid-template-columns: minmax(0, 23rem) minmax(0, 1fr); align-items: start; gap: 1rem; }
.account-card { min-width: 0; padding: 1.125rem; }
.account-card h2 { margin: 0 0 1rem; font-size: 1rem; }
.account-form { display: grid; gap: .875rem; }
.account-form label { display: block; font-size: .875rem; font-weight: 550; }
.account-form .login-field > label { margin-bottom: .375rem; }
.account-form small { display: block; margin-top: .375rem; color: var(--muted); }
.account-form > button { justify-self: start; }
.account-status { margin: 0; font-size: .875rem; }
.account-status:empty { display: none; }
.accounts-table { width: 100%; min-width: 25rem; text-align: left; }
.accounts-table th, .accounts-table td { padding: .5rem; overflow-wrap: anywhere; }
.accounts-table td .text-button { display: block; min-height: 1.75rem; padding: .25rem 0; }
.report-access { display: grid; gap: .375rem; margin: 0; padding: .75rem; min-width: 0; border: 1px solid #cfd7e1; border-radius: .3125rem; }
.report-access legend { padding-inline: .25rem; font-size: .875rem; font-weight: 600; }
.report-access label { display: flex; align-items: center; gap: .5rem; min-height: 1.625rem; }
.account-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.edit-access { margin-top: 1rem; }

@media (max-width: 760px) {
  .account-layout { grid-template-columns: 1fr; }
  .app-nav:has(#admin-link:not([hidden])) { order: 1; margin-left: 0; flex-basis: 100%; }
  .app-nav:has(#admin-link:not([hidden])) + .logout { margin-left: auto; }
}

@media (min-width: 1010px) and (min-height: 730px) {
  .workspace { display: flex; flex-direction: column; height: calc(100vh - 4rem); height: calc(100svh - 4rem); }
  .page-heading, .command-bar, .filter-panel, .results-toolbar { flex: none; }
  .report { display: flex; flex-direction: column; flex: 1; min-height: 0; }
  .order-workbench, .stock-workbench { flex: 1; min-height: 0; }
  .order-list, .order-detail { min-height: 0; }
  .order-list { scroll-padding: 1rem; }
  .report > .data-panel, .stock-results { display: flex; flex-direction: column; min-height: 0; max-height: 100%; }
  .stock-workbench { grid-template-rows: minmax(0, 1fr); }
  .data-panel thead th { position: sticky; z-index: 1; top: 0; }
}
@media (max-width: 1009px) {
  .stock-command { flex-wrap: wrap; }
  .stock-command .search-box { flex-basis: 100%; }
  .order-command { flex-wrap: wrap; }
  .order-command .search-box { min-width: 11rem; }
  .order-workbench { grid-template-columns: minmax(14rem, 31%) minmax(0, 1fr); }
  .order-list { max-height: 42rem; }
}
@media (max-width: 760px) {
  .sign-in { grid-template-columns: 1fr; grid-template-rows: auto minmax(10rem, 25vh); padding: .75rem; }
  .sign-in-main { padding: .75rem 1rem 1rem; }
  .sign-in-logo { width: 7.25rem; }
  .sign-in-form { justify-self: center; padding-block: 2.5rem 1rem; }
  .sign-in-form h1 { margin-bottom: 1.5rem; }
  .app-bar-inner { flex-wrap: wrap; align-items: center; gap: .125rem .5rem; padding: .5rem .75rem; }
  .app-brand { gap: .625rem; }
  .app-brand img { width: 4.25rem; }
  .app-nav { margin-left: auto; }
  .logout span { display: none; }
  .app-nav a, .logout { padding-inline: .5rem; border-radius: .3125rem; }
  .logout { margin-left: 0; }
  .workspace { padding: 1.25rem .75rem 1.5rem; }
  .page-heading { flex-wrap: wrap; margin-bottom: .875rem; }
  .page-actions { justify-content: space-between; width: 100%; }
  .order-command { gap: .5rem; }
  .order-command .search-box { flex-basis: 100%; max-width: none; }
  .command-actions { flex: 1 1 100%; justify-content: space-between; }
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .order-workbench, .stock-workbench { grid-template-columns: minmax(0, 1fr); }
  .order-list, .group-index { border-right: 0; border-bottom: 1px solid var(--line); }
  .order-list { max-height: 17rem; }
  .order-detail { min-height: 12rem; }
  .detail-top { flex-wrap: wrap; }
  .detail-facts { grid-template-columns: 1fr 1fr; }
  .stock-command .inline-field { flex-wrap: wrap; flex: 1 1 7rem; }
  .stock-command .inline-field :is(input,select) { width: 100%; min-width: 0; max-width: none; }
  .group-index h2 { display: none; }
  #stock-groups { display: flex; gap: .25rem; overflow: auto; }
  .group-index button { flex: none; width: auto; gap: .375rem; }
}
@media (max-width: 360px) {
  .app-brand span { display: none; }
  .detail-facts { grid-template-columns: 1fr; }
}
