:root {
  color-scheme: light;
  --forest: #171717;
  --deep: #141414;
  --green: #252525;
  --mint: #f5e8bb;
  --ink: #222222;
  --muted: #585854;
  --line: #deded8;
  --paper: #fff;
  --background: #f5f5f3;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--background);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: #674b00; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid #a97900; outline-offset: 3px;
}
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.9rem, 4vw, 3rem); font-weight: 760; letter-spacing: -.047em; line-height: 1.1; }
h2 { font-size: 1.15rem; letter-spacing: -.02em; }
button, input, select { font: inherit; }
button, .button {
  align-items: center; background: var(--green); border: 1px solid var(--green);
  border-radius: 8px; color: white; cursor: pointer; display: inline-flex; font-size: .92rem;
  font-weight: 680; justify-content: center; min-height: 42px; padding: .55rem .9rem; text-decoration: none;
}
button:hover, .button:hover { filter: brightness(.89); }
.secondary { background: white; border-color: #aaa9a0; color: var(--forest); }
label { color: var(--muted); display: grid; font-size: .82rem; font-weight: 650; gap: .35rem; min-width: 0; }
input, select { background: white; border: 1px solid #b9b8b0; border-radius: 7px; color: var(--ink); min-height: 42px; padding: .45rem .65rem; width: 100%; }
.workspace-header {
  align-items: center; background: var(--forest); border-bottom: 4px solid #dba51b; color: #fff;
  display: grid; gap: .35rem .75rem; grid-template-columns: minmax(0,1fr) auto;
  padding: .4rem max(1.15rem,calc((100% - 1152px) / 2));
}
.brand { color: white; display: block; text-decoration: none; width: fit-content; }
.brand strong { color: #ffc525; font-size: 1.52rem; font-weight: 850; letter-spacing: -.055em; line-height: 1; }
nav { display: flex; flex-wrap: wrap; gap: .4rem; grid-column: 1 / -1; }
nav a { background: #fff; border-radius: 7px; color: #222; display: block; font-size: .86rem;
  font-weight: 620; padding: .5rem .68rem; text-decoration: none; }
nav a:hover, nav a[aria-current] { background: #dba51b; color: #171717; }
.account { align-items: center; display: flex; gap: .65rem; justify-content: flex-end; }
.account span { min-width: 0; overflow-wrap: anywhere; }
.account small { color: #e5dcc2; display: block; }
.workspace-header nav a { padding-block: .38rem; }
.account-exit { background: transparent; border-color: #82827b; min-height: 34px; }
.workspace main { margin-inline: auto; max-width: 1200px; padding: clamp(1rem,3vw,1.5rem); width: 100%; }
.page-heading { align-items: flex-end; display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; margin-bottom: 1.65rem; }
.page-heading h1:not(:first-child) { margin-top: .35rem; }
.page-heading p { color: var(--muted); margin-top: .4rem; }
.actions, .filters, .quantity { align-items: end; display: flex; flex-wrap: wrap; gap: .65rem; }
.filters select { min-width: 108px; }
.filter-panel { padding: 1.1rem; }
.filter-panel a { align-self: center; padding: .5rem; }
.metrics { display: grid; gap: 1rem; grid-template-columns: repeat(3,minmax(0,1fr)); margin-bottom: 1.25rem; }
.metrics article, .panel, .catalog article, .request-summary {
  background: var(--paper); border: 1px solid var(--line); border-radius: 13px;
  box-shadow: 0 2px 3px #15352608;
}
.metrics article { min-height: 116px; padding: 1.15rem; }
.metrics span { color: var(--muted); display: block; font-size: .9rem; font-weight: 620; }
.metrics strong { color: var(--forest); display: block; font-size: 2.45rem; letter-spacing: -.055em; line-height: 1.4; }
.panel-heading { align-items: center; border-bottom: 1px solid var(--line); display: flex; gap: .75rem; justify-content: space-between; padding: 1.15rem; }
.chart { padding: .55rem 1.05rem 1.05rem; }
.chart-row { align-items: center; border-radius: 8px; color: var(--ink); display: grid; gap: .75rem; grid-template-columns: minmax(105px, 1fr) minmax(55px, 4fr) minmax(22px,auto) 16px; min-height: 52px; padding: .45rem .55rem; text-decoration: none; }
.chart-row:hover { background: #fcf3d8; }
.chart-label { font-size: .9rem; font-weight: 650; overflow-wrap: anywhere; }
progress { accent-color: var(--green); appearance: none; background: #e7e7e2; border: none; border-radius: 8px; height: 13px; width: 100%; }
progress::-webkit-progress-bar { background: #e7e7e2; border-radius: 8px; }
progress::-webkit-progress-value { background: #39935d; border-radius: 8px; }
progress::-moz-progress-bar { background: #39935d; border-radius: 8px; }
.catalog { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill,minmax(min(100%,235px),1fr)); }
.catalog img { aspect-ratio: 4 / 3; background: #ffffff; display: block; object-fit: contain; width: 100%; }
.catalog article { overflow: hidden; }
.catalog article > div { padding: 1rem; }
.catalog p { color: var(--muted); margin: .45rem 0 .65rem; overflow-wrap: anywhere; }
.catalog dl { display: grid; font-size: .9rem; gap: .32rem .65rem; grid-template-columns: auto 1fr; margin: .7rem 0; }
dt { color: var(--muted); } dd { font-weight: 620; margin: 0; overflow-wrap: anywhere; }
.request-summary { align-items: center; display: flex; flex-wrap: wrap; gap: .75rem; justify-content: space-between; margin-bottom: 1rem; padding: 1rem; }
.request-summary span { color: var(--muted); display: block; margin-top: .25rem; }
.quantity input { max-width: 105px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; font-size: .88rem; text-align: left; width: 100%; }
th { background: #f4f4f1; color: #383833; font-weight: 700; white-space: nowrap; }
th, td { border-bottom: 1px solid var(--line); padding: .77rem 1rem; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.empty { color: var(--muted); padding: 1.1rem; }
.operation-forms { display: grid; gap: .65rem; margin-bottom: 1rem; }
summary { cursor: pointer; font-weight: 650; padding: .85rem 1rem; }
.admin-form { align-items: end; display: grid; gap: .65rem; grid-template-columns: repeat(auto-fit,minmax(min(100%,175px),1fr)); padding: .25rem 1rem 1rem; }
.login-layout { display: grid; grid-template-columns: 1fr 1fr; min-height: 100dvh; }
.login-cover { align-items: center; background: #171717; color: #fff; display: grid; padding: clamp(2rem,8vw,8rem); }
.login-identity { font-size: clamp(1.65rem, 4.1vw, 4.2rem); font-weight: 850; letter-spacing: -.055em; }
.login-identity span { display: block; }
.login-identity span:first-child { color: #ffc525; }
.login-identity span:last-child { color: #fff; }
.login-panel { align-items: center; display: grid; justify-items: center; padding: 2rem; }
.login-form { display: grid; gap: 1rem; max-width: 400px; width: 100%; }
.login-form h2 { font-size: 1.6rem; margin-bottom: .45rem; }
.notice { background: #f9e9e8; border-radius: 7px; color: #8f2824; padding: .6rem; }
.error { margin: 13vh auto; max-width: 510px; padding: 1.2rem; }
.error span { color: var(--muted); display: block; font-weight: 700; margin-bottom: .5rem; }
.error p { margin-top: .6rem; }
.error a { margin-top: 1rem; }
@media (max-width: 740px) {
  .workspace { display: block; }
  .metrics { gap: .5rem; }
  .metrics article { min-height: 92px; padding: .62rem; }
  .metrics span { font-size: .74rem; }
  .metrics strong { font-size: 1.7rem; }
  .login-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
}

.manual-section { margin-top: 2rem; }


.request-grid { grid-template-columns: repeat(auto-fit,minmax(min(100%,340px),1fr)); align-items: start; }
.request-grid td input { max-width: 5rem; min-width: 3rem; }
.request-grid .table-wrap { padding-inline: .5rem; }
.variant-color { color: var(--muted); display: block; }
.photo-button {
  background: #fff; border: 0; border-radius: 0; display: block; width: 100%; padding: 0; cursor: zoom-in;
}
.photo-button:hover { filter: none; }
#zoom { border: 0; border-radius: 12px; max-width: 92vw; padding: .8rem; }
#zoom::backdrop { background: #111a; }
#zoom img { display: block; max-height: 75vh; max-width: 84vw; margin-top: .65rem; object-fit: contain; }
.draft-bar {
  align-items: center; background: #171717; border-radius: 8px 8px 0 0; bottom: 0; color: #fff;
  display: flex; gap: .65rem; justify-content: space-between; margin-top: 1rem; padding: .8rem 1rem; position: sticky;
}
.draft-bar button { background: #dba51b; border-color: #dba51b; color: #171717; }

.admin-subnav { margin-bottom: 1rem; }

.page-heading h1 { font-size: clamp(1.45rem, 3vw, 2.15rem); }
.page-heading { margin-bottom: 1rem; }
.compact-operation { margin-bottom: .6rem; }
.compact-operation > form, .compact-operation + section, .stock-v103-panel { padding: .7rem; }
.compact-operation .filters { margin-bottom: .75rem; }
.compact-operation .request-grid { margin-block: .55rem; }
.compact-operation article h3 { padding: .5rem .65rem 0; margin: 0; }
.striped tbody tr:nth-child(even) { background: #f4f4f1; }
.striped td.negative-stock { background: #a32128; color: #fff; font-weight: 800; }

table { text-align: center; }
th, td { text-align: center; vertical-align: middle; padding: .42rem .55rem; }
tbody tr:nth-child(even) { background: #f4f4f1; }
th label { text-align: center; gap: .2rem; }
th select, th input, td input[type="number"] { text-align: center; min-height: 31px; padding: .2rem .35rem; }
.compact-consolidated .panel-heading { padding: .5rem .7rem; flex-wrap: wrap; }
.compact-consolidated .button, .operation-tabs a { min-height: 32px; padding: .32rem .55rem; }
.chart-row[aria-current] { background: #f7df9b; outline: 1px solid #967000; }
.admin-subnav { margin-bottom: .45rem; }
.operation-switch { margin: .35rem 0; }

@media (max-width: 500px) {
  .workspace-header { padding-inline: .65rem; }
  .workspace-header nav { gap: .28rem; }
  .workspace-header nav a { padding-inline: .42rem; font-size: .81rem; }
}

.movement-items { margin: .5rem 0; padding: .55rem; border: 1px solid var(--line); border-radius: .45rem; min-width: 0; }
.movement-items legend { font-weight: 700; }
.movement-items [data-qty] { width: 6rem; }
.compact-operation label[hidden] { display: none; }
.movement-check { display: flex; align-items: center; }
.movement-check input { width: auto; min-height: auto; }
.movement-preview { width: 6rem; height: 4rem; object-fit: contain; margin: .2rem 0; }

.order-lookup, .order-receipt { padding: 1rem; }
.order-lookup .filters { margin-top: .75rem; }
.receipt-heading, .receipt-percent { text-align: center; }
.receipt-heading h1 { margin: .3rem 0; font-size: 1.6rem; }
.receipt-info { display: flex; gap: .6rem 1.3rem; flex-wrap: wrap; justify-content: center; text-align: center; }
.receipt-info dd { margin: 0; }
.receipt-token { background: #f7efcf; margin: .7rem 0; padding: .6rem; text-align: center; }
.receipt-token code { display: block; font-size: 1rem; overflow-wrap: anywhere; padding: .25rem 0; }
.receipt-actions { justify-content: center; }
@media print {
  .workspace-header, .receipt-actions, dialog { display: none !important; }
  .workspace main { padding: 0; }
  .order-receipt { border: 0; box-shadow: none; }
  .order-receipt .table-wrap { overflow: visible; }
  tr, .receipt-token { break-inside: avoid; }
}

.request-entry { justify-content: start; align-items: end; }
.request-entry label { flex: 0 1 14rem; }
.request-entry label:has([name="token"]) { flex-basis: 17rem; }
.request-entry input[name="token"] { text-transform: uppercase; }
.request-lookup-notice { margin-bottom: .65rem; }
@media (max-width: 650px) {
  .request-entry label { flex: 1 1 calc(50% - .75rem); }
  .request-entry label:has([name="token"]) { flex: 1 1 55%; }
}

.dashboard-metrics { grid-template-columns: repeat(2,minmax(0, 1fr)); }
tr.quantity-selected > td, .movement-entry.quantity-selected {
  background: #DCEEDD;
  color: #326B39;
}
tr.quantity-selected .variant-color, .movement-entry.quantity-selected label { color: #326B39; }
.quantity-selected [data-highlight-quantity], .quantity-selected .selected-quantity {
  color: #326B39; font-weight: 750;
}
.quantity-selected [data-highlight-quantity] { background: #DCEEDD; }
.movement-entry { border-radius: 7px; padding: .35rem; }

.receipt-heading p { color: var(--muted); }
.receipt-info { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .65rem; }
.receipt-info > div { padding: .6rem; border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.receipt-info dd { overflow-wrap: anywhere; }
.receipt-token { margin: 0; }
.receipt-token dd { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: .35rem; }
.receipt-token button { min-height: 30px; padding: .2rem .45rem; }
.receipt-copy-status { font-size: .8rem; flex-basis: 100%; }
.receipt-state { margin-bottom: .45rem; }
.receipt-cards { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .6rem; }
.receipt-cards > div { text-align: center; border: 1px solid var(--line); border-radius: 8px; padding: .5rem; }
.receipt-cards strong { display: block; font-size: 1.45rem; }
.receipt-delivered { background: #dceedd; color: #326b39; }
.receipt-pending { background: #fbefca; color: #684f13; }
.receipt-percent { display: grid; gap: .35rem; margin: .75rem 0; }
.receipt-percent progress { max-width: 26rem; justify-self: center; }
.receipt-history { margin: .9rem 0 .85rem; }
.receipt-history-header { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.receipt-history-row {
  display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); align-items: center;
  width: 100%; text-align: center; background: #fff; color: #242424;
  border: 1px solid var(--line); margin-top: .25rem;
}
.receipt-history-row[aria-pressed="true"] { background: #dceedd; color: #326b39; border-color: #a9c6ad; }
.order-receipt table caption { font-weight: 750; padding: .45rem; text-align: center; }
.order-receipt :is(th,td) { text-align: center; vertical-align: middle; }
.receipt-note { color: var(--muted); text-align: center; font-size: .85rem; margin: .75rem 0; }
@media (max-width: 550px) {
  .receipt-info { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .receipt-info .receipt-token { grid-column: 1 / -1; }
}
@page receipt-a4 { size: A4 portrait; margin: 12mm; }
@media print {
  .order-receipt { page: receipt-a4; color: #111; background: #fff; padding: 0; }
  .order-receipt .receipt-token button, .receipt-copy-status, .receipt-history { display: none !important; }
  .receipt-info { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .receipt-info .receipt-token { grid-column: auto; }
  thead { display: table-header-group; }
  .receipt-info, .receipt-cards, .receipt-percent { break-inside: avoid; }
}

.selected-quantity input { width: 5.5rem; text-align: center; color: inherit; font-weight: inherit; }

.supplier-print-heading { display: none; }
.supplier-report h1 { font-size: 1.2rem; margin-block: .5rem; }
.supplier-report :is(th, td) { text-align: center; vertical-align: middle; padding: .45rem; }
.supplier-report th label { display: grid; gap: .25rem; white-space: nowrap; }
.supplier-report th input { min-width: 5rem; width: 100%; padding: .25rem .4rem; }
.supplier-report tfoot { font-weight: 700; }
.supplier-report-actions, .supplier-report-meta { display: flex; gap: .5rem 1rem; flex-wrap: wrap; align-items: center; }
.supplier-report-actions { margin-block: .5rem; }
.supplier-report-meta dt { font-weight: 700; }
.supplier-report-meta dd { margin: 0; overflow-wrap: anywhere; }
@media print {
  .supplier-report { color: #111; background: #fff; border: 0; }
  .supplier-print-heading { display: block; font-weight: 750; }
  .supplier-report .table-wrap { overflow: visible; }
  .supplier-report :is(.supplier-report-actions, th input) { display: none; }
}

.catalog-print-actions { display: flex; align-items: center; gap: .55rem .9rem; flex-wrap: wrap; }

.consultation-indicators { margin-bottom: .8rem; }
.consultation-history { margin-bottom: 1rem; }
.consultation-history h2 { font-size: 1.05rem; }
.consultation-row { cursor: pointer; }
.consultation-row[data-selected] > td { background: #e7f1e8; color: #264b2c; }
.consultation-row[data-selected] > td.receipt-delivered,
.supplier-report td.receipt-delivered { background: #dceedd; color: #326b39; }
.consultation-row[data-selected] > td.receipt-pending,
.supplier-report td.receipt-pending { background: #fbefca; color: #684f13; }
.consultation-history th input, .supplier-report th input, .order-receipt th input {
  min-width: 4rem; width: 100%; padding: .2rem .35rem;
}
.order-receipt th label, .receipt-history-filters label { display: grid; gap: .2rem; }
.receipt-history-filters { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); align-items: end; gap: .3rem; text-align: center; }
.receipt-history-filters button { grid-column: 1 / -1; justify-self: start; }
.receipt-history-row:nth-of-type(even):not([aria-pressed="true"]) { background: #f4f4f1; }
.receipt-filter-actions { margin-top: .4rem; }
@media print {
  .supplier-report :is(.consultation-history, .consultation-indicators),
  .order-receipt :is(th input, .receipt-filter-actions) { display: none !important; }
}

.filterable-table :is(th,td) { vertical-align: middle; text-align:center; }
.filterable-table > tbody > tr:nth-child(even) { background:#f4f4f1; }
.filterable-table tr[hidden] { display:none!important; }
.column-filter-trigger {
  padding:.12rem .25rem; min-height:1.6rem; display:inline-flex; gap:.3rem;
  align-items:center; justify-content:center; color:inherit; background:transparent; font:inherit;
}
.column-filter-icon { display:inline-block; width:.68rem; height:.68rem; background:currentColor;
  clip-path:polygon(0 0,100% 0,63% 48%,63% 86%,37% 100%,37% 48%); opacity:.55; }
.column-filter-active { background:#f4df9d; color:#563900; }
.column-filter-active .column-filter-icon { opacity:1; }
.column-filter-menu {
  position:fixed; inset:auto; margin:0; width:min(17rem,calc(100vw - 16px)); box-sizing:border-box;
  padding:.6rem; background:white; color:#252525; border:1px solid #c8b77e; border-radius:8px;
  box-shadow:0 6px 24px #0003; text-align:left;
}
.column-filter-options { display:flex; justify-content:space-between; gap:.25rem; margin-bottom:.35rem; }
.column-filter-options button { min-height:1.8rem; padding:.15rem .4rem; font-size:.82rem; }
.column-filter-menu input[type=search] { width:100%; margin-bottom:.35rem; }
.column-filter-list { max-height:min(15rem,40vh); overflow:auto; }
.filterable-table th .column-filter-list label { display:flex; align-items:center; gap:.45rem; padding:.2rem; white-space:normal; font-weight:400; }
.column-filter-list input { width:auto!important; min-width:0!important; margin:0; accent-color:#a57500; }
@media print {
  .column-filter-icon,.column-filter-menu { display:none!important; }
  .column-filter-trigger { padding:0; background:transparent!important; color:inherit!important; }
}
.receipt-delivery-link { background:transparent; color:inherit; min-height:1.65rem; padding:.15rem .3rem; text-decoration:underline; }
@media print {
  body:has([data-consolidated]) .dashboard-metrics,
  body:has([data-consolidated]) .chart,
  [data-consolidated] .actions,
  [data-column-scope] .actions { display:none!important; }
}

.report-menu-trigger:not([hidden]) {
  display: inline-grid; place-items: center; align-self: stretch; min-height: 0;
  padding: .2rem .5rem; border: 1px solid #796b44; background: transparent; color: #ffc525;
}
.report-menu-trigger[aria-expanded="true"] { background: #ffc525; color: #171717; }
.report-menu {
  position: fixed; inset: auto; margin: 0; box-sizing: border-box; width: 176px; padding: .25rem;
  background: #fff; border: 1px solid #c8b77e; border-radius: 8px; box-shadow: 0 6px 22px #0004;
}
.report-menu :is(a,button) {
  display: block; width: 100%; min-height: 0; padding: .46rem .55rem;
  background: transparent; border: 0; border-radius: 4px; color: #242424;
  text-align: left; font: inherit; font-size: .86rem; text-decoration: none;
}
.report-menu :is(a,button):is(:hover,:focus-visible) { background: #fbefca; }
.report-print-title, .column-print-label { display: none; }
@media print {
  .active-print-branch > :not(.active-print-branch,.active-print-region) { display: none !important; }
  .active-print-region { width: 100%; max-height: none; box-shadow: none; }
  .active-print-region :is(.table-wrap,[data-query-scroll]) { overflow: visible; max-height: none; }
  .active-print-region :is(button,input,select,textarea,.operation-forms,.report-print-hidden),
  .report-menu, .column-filter-trigger { display: none !important; }
  .active-print-region .report-print-title, .column-print-label { display: inline; }
  .active-print-region thead { display: table-header-group; }
}

@media (max-width: 500px) {
  .workspace-header nav:has(.report-menu-trigger:not([hidden])) {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: .23rem;
  }
  .workspace-header nav:has(.report-menu-trigger:not([hidden])) > a {
    flex: 0 0 auto; padding-inline: .31rem; white-space: nowrap;
  }
  .report-menu-trigger:not([hidden]) { flex: 0 0 auto; padding-inline: .35rem; }
}
