@font-face {
  font-family: "DM Sans";
  src: url("/assets/dm-sans-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  font-family: "DM Sans", "Segoe UI", system-ui, sans-serif;
  color: #18241f;
  background: #f8f3e8;
  font-synthesis: none;
  --display-font: Georgia, Cambria, "Times New Roman", serif;
  --panel-title-size: clamp(1.33rem, 1.9vw, 1.7rem);
  --forest: #132b22;
  --green: #2e624b;
  --soft-green: #e7efdf;
  --paper: #fffdf7;
  --ivory: #f8f3e8;
  --ink: #18241f;
  --muted: #59625b;
  --line: #ded4c2;
  --trf: #2e6c53;
  --egf: #8a5b42;
  --radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
h1, h2, p { margin: 0; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #3b8c67; outline-offset: 3px; }
[id] { scroll-margin-top: 18px; }

.visually-hidden, .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link:focus {
  position: fixed;
  z-index: 5;
  inset: 12px auto auto 12px;
  padding: 12px 18px;
  border-radius: 8px;
  color: white;
  background: var(--forest);
}

.button, .text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 650;
  font-size: 0.875rem;
  white-space: nowrap;
  transition: background-color 150ms ease, border-color 150ms ease;
}
.button.primary { color: white; background: var(--forest); }
.button.primary:hover { background: var(--green); }
.button.quiet { color: #334a3d; border-color: var(--line); background: var(--paper); }
.button.quiet:hover, .text-button:hover { background: #eff4ed; border-color: #c4d6c8; }
.button:disabled { cursor: default; opacity: 0.5; }
.text-button { min-height: 34px; padding: 6px 11px; color: var(--green); border-color: #d6e4d8; background: #f9fcf7; }
.eyebrow { display: block; font-size: 0.72rem; font-weight: 750; letter-spacing: 0.11em; text-transform: uppercase; }
.wordmark { display: inline-flex; align-items: center; gap: 11px; color: #fffefa; font-size: 1.04rem; font-weight: 760; line-height: 1.04; text-decoration: none; }
.profile-mark { display: inline-grid; flex: none; place-items: center; width: 37px; height: 37px; border-radius: 10px; color: #184631; background: #dcebdd; font-weight: 760; font-size: 0.88rem; }

.login-layout { min-height: 100vh; min-height: 100svh; display: grid; grid-template-columns: minmax(0, 1.16fr) minmax(0, 1fr); }
.login-intro {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 70px;
  min-height: 600px;
  padding: clamp(24px, 5vw, 74px);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: white;
  background: radial-gradient(ellipse at 98% 100%, #2b5f40 3%, transparent 58%), linear-gradient(140deg, #0f2b22, #153c2c);
}
.login-intro::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 420px;
  aspect-ratio: 1;
  bottom: -242px;
  right: -150px;
  border: 1px solid #aecea753;
  border-radius: 50%;
  box-shadow: 0 0 0 33px #98c69117, 0 0 0 67px #98c69116, 0 0 0 102px #98c69112;
}
.login-intro .eyebrow { margin-bottom: 15px; color: #bde0be; }
.login-intro h1 { font-size: clamp(2.3rem, 4.5vw, 4.5rem); letter-spacing: -0.06em; line-height: 1.03; font-weight: 730; }
.login-source-note { color: #c5decb; font-size: 0.84rem; }
.login-card { display: grid; place-items: center; padding: clamp(24px, 5vw, 72px); background: #f7f7ef; }
.login-form-wrap { width: min(100%, 390px); }
.login-form-wrap h2 { font-size: clamp(1.8rem, 3.1vw, 2.6rem); letter-spacing: -0.055em; line-height: 1.12; }
.login-form-wrap .form-error { margin-top: 10px; padding: 11px 14px; border: 1px solid #ecc9c0; border-radius: 8px; color: #86372a; background: #fff0ea; line-height: 1.5; }
.login-form-wrap form { display: grid; gap: 9px; margin-top: 28px; }
.login-form-wrap input { min-height: 46px; }
.login-form-wrap button { min-height: 46px; margin-top: 7px; }

.nav-link { display: flex; gap: 11px; align-items: center; border: 1px solid transparent; text-decoration: none; white-space: nowrap; }

.main-shell { min-width: 0; }
.topbar { min-height: 46px; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px clamp(18px, 3vw, 42px); }
.topbar-brand { display: none; }
.topbar-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-left: auto; }
#main { width: min(100%, 1520px); margin: 0 auto; padding: 13px clamp(18px, 3vw, 42px) 36px; }
#main:focus { outline: none; }
.overview, .filterbar, .panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.overview { align-items: center; margin-bottom: 17px; }
.overview h1 { font-size: clamp(2rem, 4vw, 3.2rem); letter-spacing: -0.062em; font-weight: 760; line-height: 1.03; }
.snapshot { position: relative; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 5px 12px; color: var(--muted); font-size: 0.78rem; }
.snapshot-status { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 9px; }
.data-details { position: relative; }
.data-details > summary, .stock-target-details > summary {
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  text-underline-offset: 0.2em;
}
.data-details > summary:hover, .stock-target-details > summary:hover { text-decoration: underline; }
.data-facts { position: absolute; z-index: 4; top: 100%; right: 0; width: min(280px, 85vw); margin: 7px 0 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); box-shadow: 0 8px 22px #17382519; }
.data-facts > div { display: grid; grid-template-columns: auto 1fr; gap: 5px 10px; }
.data-facts > div + div { margin-top: 7px; }
.data-facts dt { color: var(--muted); }
.data-facts dd { margin: 0; color: var(--ink); text-align: right; font-weight: 650; }
.data-badge { display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px; border-radius: 999px; background: #f8edce; color: #654a18; font-size: 0.73rem; line-height: 1.2; font-weight: 750; }
.data-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #946718; }
.live-badge { color: #214935; background: #e0eee2; }
.live-badge::before { background: #377454; }
.coverage-note { margin: 0 0 16px; padding: 9px 12px; border: 1px solid #e6ddc7; border-radius: 9px; background: #fdf8ec; color: #604c2c; font-size: 0.82rem; line-height: 1.5; }
.coverage-note.is-neutral { border-color: #dbe5db; background: #f9fbf8; color: var(--muted); }
.filterbar { align-items: flex-end; flex-wrap: wrap; justify-content: flex-start; gap: 9px 13px; margin-bottom: 13px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; background: #f8fbf7; }
.filter-field { display: grid; justify-items: start; gap: 4px; min-width: 0; }
.filter-field select { width: 100%; }
.filter-label { color: var(--muted); font-size: 0.74rem; font-weight: 720; }
.filter-context { margin-left: auto; align-self: center; color: var(--muted); font-size: 0.78rem; }
.filter-context strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.active-product-filters { display: flex; flex: 1 0 100%; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; padding-top: 6px; border-top: 1px solid var(--line); color: var(--ink); font-size: 0.8rem; }
.active-product-filters[hidden], .active-product-filters [hidden] { display: none; }
.active-product-filters > span { font-weight: 650; overflow-wrap: anywhere; }
.active-product-filters .text-button { margin-left: auto; }
.advanced-filters { position: relative; }
.advanced-filters > summary { display: flex; align-items: center; min-height: 38px; gap: 6px; padding: 5px 9px; color: var(--green); font-size: 0.81rem; font-weight: 670; cursor: pointer; }
.advanced-filters > summary:hover { text-decoration: underline; }
.advanced-filters > summary::after { content: ""; width: 5px; height: 5px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-1px) rotate(45deg); }
.advanced-filters[open] > summary::after { transform: translateY(1px) rotate(225deg); }
.advanced-filter-fields { position: absolute; z-index: 4; top: 100%; right: 0; display: grid; gap: 9px; width: min(245px, 85vw); padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); box-shadow: 0 8px 22px #17382519; }
.advanced-filter-fields > [hidden] { display: none; }
.segments { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: #edf0e8; }
.segments button { padding: 6px 13px; min-height: 32px; border: 1px solid transparent; border-radius: 7px; color: #4c6255; background: transparent; font-size: 0.84rem; font-weight: 650; white-space: nowrap; }
.segments button:hover { color: var(--forest); background: #e0eadf; }
.segments button[aria-pressed="true"] { color: var(--forest); background: var(--paper); border-color: #dbe2d8; box-shadow: 0 1px 3px #19392812; }
.catalog-tools { display: flex; align-items: center; gap: 8px; }
.product-picker { position: relative; min-width: 0; }
.product-picker > summary {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid #d5ded4;
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.875rem;
  cursor: pointer;
  list-style: none;
}
.product-picker > summary::-webkit-details-marker { display: none; }
.product-picker > summary::after { content: ""; flex: none; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.product-picker[open] > summary::after { transform: translateY(1px) rotate(225deg); }
#product-selection-summary { min-width: 0; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-picker-panel {
  position: absolute;
  z-index: 3;
  inset: calc(100% + 5px) 0 auto auto;
  display: grid;
  gap: 8px;
  width: min(350px, calc(100vw - 32px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--paper);
  box-shadow: 0 12px 30px #17382525;
}
.product-picker-options { max-height: 240px; overflow-y: auto; }
.product-picker-options label { display: flex; align-items: flex-start; gap: 8px; min-height: 34px; padding: 6px 4px; cursor: pointer; overflow-wrap: anywhere; }
.product-picker-options label:hover { background: #f0f4eb; }
.product-picker-options input[type="checkbox"] { flex: none; width: 1rem; min-height: 1rem; margin: 2px 0 0; padding: 0; accent-color: var(--green); }
.product-picker-option-text { min-width: 0; }
.product-picker-option-text strong, .product-picker-option-text > span { display: block; }
.product-picker-option-text > span { margin-top: 2px; color: var(--muted); font-size: 0.74rem; font-weight: 500; }
#clear-product-selection { justify-self: start; }
input, select { width: 100%; min-width: 0; padding: 8px 11px; min-height: 38px; border: 1px solid #d5ded4; border-radius: 8px; color: var(--ink); background: var(--paper); font-size: 0.875rem; }
select { padding-right: 26px; }
input::placeholder { color: #5b6c61; }
label { color: var(--ink); font-size: 0.86rem; font-weight: 680; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; margin-bottom: 14px; }
.metric, .panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: 0 2px 4px #23342908; }
.metric { min-height: 102px; display: flex; flex-direction: column; align-items: flex-start; padding: 13px 15px 11px; }
.metric:first-child { background: #e9f3ea; border-color: #d1e4d4; }
.metric-label { color: #364f42; font-size: 0.86rem; font-weight: 690; }
.metric strong { margin: 3px 0 3px; font-size: clamp(1.75rem, 3vw, 2.55rem); font-weight: 750; line-height: 1.08; letter-spacing: -0.065em; font-variant-numeric: tabular-nums; }
.metric-note { color: var(--muted); font-size: 0.75rem; line-height: 1.3; }
.stock-review-links { display: flex; flex-wrap: wrap; gap: 3px 9px; margin-top: 5px; }
.stock-review-links:not(:has(> a:not([hidden]))) { display: none; }
.stock-review-links a { color: var(--green); font-size: 0.75rem; font-weight: 650; text-underline-offset: 0.16em; }
.stock-review-links [hidden] { display: none; }
.alert-metric.has-shortage { background: #fff6e5; border-color: #eddfc2; }
.alert-metric.has-shortage .restock-quantity { color: #7b4a17; }
.restock-quantity { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 5px; }
.restock-quantity > span { font-size: 0.77rem; font-weight: 650; }

.insights { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); align-items: start; gap: 13px; margin-bottom: 15px; }
.panel { padding: 17px; }
.panel-heading h2 { font-size: 1.22rem; font-weight: 740; line-height: 1.24; letter-spacing: -0.032em; }
.panel-heading p { margin-top: 4px; color: var(--muted); font-size: 0.82rem; line-height: 1.46; }
.chart-unit { color: var(--muted); font-size: 0.75rem; font-weight: 620; }
.chart-region { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 7px; margin-top: 15px; }
.chart-region[hidden], .chart-product-scroll[hidden] { display: none; }
#chart-scale { min-width: 24px; margin-top: -5px; color: var(--muted); font-size: 0.69rem; font-variant-numeric: tabular-nums; text-align: end; }
#chart { display: grid; min-width: 0; min-height: 156px; align-items: stretch; column-gap: 0; }
#chart > .empty-state { grid-column: 1 / -1; }
.chart-day { display: grid; grid-template-rows: 138px 18px; min-width: 0; }
.bars { display: flex; justify-content: center; align-items: flex-end; gap: clamp(1px, 0.32vw, 4px); min-width: 0; padding: 0 1px; border-bottom: 1px solid #93aa99; background: repeating-linear-gradient(to top, transparent 0 calc(25% - 1px), #e8ece3 calc(25% - 1px) 25%); }
.bar { width: min(22px, 43%); display: block; flex-shrink: 1; border-radius: 4px 4px 0 0; }
.bar.trf, .dot.trf { background: var(--trf); }
.bar.egf, .dot.egf { background: repeating-linear-gradient(135deg, var(--egf) 0 4px, #758bb1 4px 6px); }
.bar.is-missing { height: 4px; border-top: 2px dotted #64786c; border-radius: 0; background: transparent; }
.signed-sales .bars, .signed-sales .bar { position: relative; }
.signed-sales .bars::after { content: ""; position: absolute; inset-inline: 0; bottom: var(--sales-zero); border-top: 1px solid #708776; }
.signed-sales .chart-day:first-child .bars::before { content: "0"; position: absolute; right: calc(100% + 6px); bottom: var(--sales-zero); transform: translateY(50%); color: var(--muted); font-size: 0.69rem; }
.chart-label { padding-top: 4px; justify-self: center; white-space: nowrap; font-size: 0.67rem; color: var(--muted); }
.chart-day:first-child .chart-label { justify-self: start; }
.chart-day:last-child .chart-label { justify-self: end; }
.legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin: 12px 0 0 31px; color: #465c50; font-size: 0.73rem; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-daily { margin-top: 12px; font-size: 0.8rem; }
.chart-daily summary { width: fit-content; color: var(--green); cursor: pointer; font-weight: 700; }
.chart-daily table { min-width: 0; margin-top: 8px; }
.chart-daily th { white-space: normal; }
.chart-daily tbody td { font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 3px; }

.queue-panel { border-top: 3px solid #c78536; }
.queue-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 8px; }
.queue-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 5px 10px; margin-top: 8px; color: var(--muted); font-size: 0.79rem; }
.queue-footer a { color: var(--green); font-weight: 720; text-underline-offset: 0.2em; }
.queue-footer [hidden] { display: none; }
#queue { margin-top: 5px; }
#queue .empty-state { margin-top: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #f8fbf7; text-align: left; }
.queue-row { display: flex; align-items: center; justify-content: space-between; gap: 7px; padding: 8px 0; }
.queue-row + .queue-row { border-top: 1px solid #e7ebe3; }
.queue-main, .product-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.queue-details, .product-details { min-width: 0; }
.queue-name, .product-name { display: block; color: var(--ink); font-weight: 700; font-size: 0.84rem; line-height: 1.3; overflow-wrap: anywhere; }
.queue-meta, .product-meta { display: block; margin-top: 3px; color: var(--muted); font-size: 0.72rem; line-height: 1.4; }
.queue-gap { color: #805019; font-size: 0.84rem; font-weight: 760; font-variant-numeric: tabular-nums; }
.product-mark { display: inline-grid; width: 32px; height: 32px; place-items: center; flex: none; border-radius: 9px; background: #e0eee3; color: #225d35; font-size: 0.83rem; font-weight: 770; }
.tone-gold { background: #f7edcb; color: #79561c; }
.tone-iris { background: #ede6f6; color: #644981; }
.tone-clay { background: #fae7de; color: #884a33; }
.empty-state { padding: 20px 10px; color: var(--muted); font-size: 0.87rem; text-align: center; }

.catalog-panel { margin-bottom: 17px; padding: 0; }
.catalog-heading { align-items: center; padding: 15px 16px 9px; }
.inventory-view { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 10px; }
.inventory-view > span { color: var(--muted); font-size: 0.8rem; font-weight: 700; }
.catalog-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 7px 15px; padding: 0 16px 11px; }
.catalog-context { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 9px; color: var(--muted); font-size: 0.79rem; }
.catalog-context > :first-child { color: var(--ink); font-weight: 700; }
.stock-target-control { display: grid; grid-template-columns: auto auto; align-items: center; justify-content: start; gap: 5px 9px; }
.stock-target-control select { width: auto; min-height: 33px; padding-block: 4px; }
.stock-target-control label { font-size: 0.76rem; }
.stock-target-note { grid-column: 1 / -1; max-width: 55ch; color: var(--muted); font-size: 0.78rem; line-height: 1.45; }
.stock-target-details { width: fit-content; }
.stock-target-details[open] { flex: 1 1 100%; }
.stock-target-details[open] p { margin-top: 5px; }
.inventory-note { flex-basis: 100%; color: var(--muted); font-size: 0.81rem; line-height: 1.45; }
.inventory-note:empty { display: none; }
.catalog-tools { margin-left: auto; }
.catalog-tools input { width: min(19vw, 210px); }
.catalog-tools select { width: auto; }
.table-wrap { position: relative; overflow-x: auto; margin: 0 1px 3px; }
table { width: 100%; min-width: 630px; border-collapse: collapse; font-size: 0.85rem; text-align: left; }
th { padding: 11px 10px; border-block: 1px solid #e7ebe3; color: #465d4e; background: #f7f8f3; font-size: 0.74rem; font-weight: 700; white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid #ebeee8; color: #253d31; }
th:first-child, td:first-child { padding-left: 18px; }
th:last-child, td:last-child { padding-right: 18px; text-align: right; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8faf5; }
td:nth-child(4), td:nth-child(5) { font-variant-numeric: tabular-nums; }
#products table { min-width: 670px; }
#products th { white-space: normal; }
#products tbody th .product-details { max-width: 25ch; }
#products .status-pill { white-space: normal; overflow-wrap: anywhere; }
#products td { vertical-align: top; padding-block: 12px; }
#products th:last-child, #products td:last-child { text-align: left; }
#products .empty-state { text-align: center; }
.inventory-listing { display: grid; justify-items: start; align-content: start; gap: 8px; }
.inventory-stats { display: grid; grid-template-columns: repeat(2, minmax(64px, auto)); gap: 6px 12px; }
.inventory-stat { display: flex; flex-direction: column; gap: 2px; }
.inventory-stat-label { color: var(--muted); font-size: 0.72rem; line-height: 1.3; }
.inventory-stat-value { color: var(--ink); font-size: 1rem; font-weight: 720; font-variant-numeric: tabular-nums; line-height: 1.2; }
.inventory-unlisted { color: var(--muted); font-size: 0.8rem; line-height: 1.45; }
.inventory-store-tags { display: grid; gap: 8px; font-size: 0.78rem; }
.inventory-coverage-row, .inventory-location-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 7px; }
.inventory-coverage-sku { flex-basis: 100%; margin-top: 0; }
.inventory-rollup-label { display: none; }
.inventory-rollup-number { font-variant-numeric: tabular-nums; }
.inventory-rollup-gaps .status-pill { margin: 0 4px 4px 0; }
.inventory-location-actions { margin-block-start: 5px; }
.inventory-listing .inventory-location-actions { margin-block-start: 0; }
.status-pill { display: inline-block; padding: 4px 7px; border-radius: 6px; font-size: 0.73rem; font-weight: 700; white-space: nowrap; }
.status-healthy { color: #205535; background: #e6f1e5; }
.status-low { color: #744d0c; background: #faefd2; }
.status-out { color: #903e2d; background: #fae9e0; }
.status-unknown, .status-historical { color: #4c5a51; background: #edf0eb; }

dialog { width: min(540px, calc(100% - 28px)); max-height: calc(100% - 28px); padding: 25px; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); background: var(--paper); box-shadow: 0 18px 60px #0a231d43; }
dialog::backdrop { background: #071c15a6; }
dialog h2 { margin-right: 39px; font-size: 1.57rem; letter-spacing: -0.04em; overflow-wrap: anywhere; }
dialog p { margin-top: 7px; color: var(--muted); line-height: 1.5; font-size: 0.88rem; }
.dialog-close { position: absolute; top: 14px; right: 14px; }
.dialog-close .button { width: 34px; min-height: 34px; padding: 0; font-size: 1.2rem; }

@media (max-width: 1080px) {
  #main, .topbar { padding-inline: 22px; }
  .filter-context { margin-left: 0; }
}

@media (max-width: 900px) {
  .insights { grid-template-columns: 1fr; }
  .queue-row { padding-block: 8px; }
  .catalog-tools input { width: 160px; }
}

@media (max-width: 700px) {
  .login-layout { grid-template-columns: 1fr; align-content: start; }
  .login-intro { min-height: auto; gap: 26px; padding: 23px 24px; }
  .login-intro h1 { font-size: clamp(2rem, 8vw, 3rem); }
  .login-intro .eyebrow { margin-bottom: 9px; }
  .login-card { padding: 32px 24px; }
  .topbar { min-height: 45px; padding: 5px 13px; border-bottom: 1px solid var(--line); background: var(--paper); }
  .topbar-brand { display: inline-flex; gap: 7px; color: var(--forest); font-size: 0.79rem; }
  .topbar-actions { flex-wrap: nowrap; gap: 7px; }
  .topbar-actions .button { min-height: 31px; padding: 4px 8px; font-size: 0.74rem; }
  #main { padding: 15px 13px 25px; }
  .overview { flex-direction: column; align-items: flex-start; gap: 5px; margin-bottom: 10px; }
  .overview h1 { font-size: clamp(2rem, 10vw, 2.7rem); }
  .snapshot { justify-content: flex-start; gap: 4px 9px; }
  .data-facts { right: auto; left: 0; }
  .filterbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.28fr); gap: 6px 8px; padding: 7px 9px; margin-bottom: 9px; }
  .filterbar .filter-field { grid-template-columns: minmax(0, 1fr); justify-items: stretch; }
  .active-product-filters { grid-column: 1 / -1; }
  .filterbar .segments { width: 100%; }
  .filterbar .segments button { flex: 1 1 auto; min-width: 0; padding: 4px 3px; min-height: 28px; font-size: 0.76rem; }
  .filterbar select { min-height: 35px; padding-block: 5px; font-size: 0.79rem; }
  .filterbar .store-field select { padding-inline: 6px 18px; }
  .filterbar .product-picker > summary { min-height: 34px; padding: 5px 7px; font-size: 0.79rem; }
  .filterbar .advanced-filters > summary { min-height: 33px; padding: 3px 2px; }
  .filterbar .product-picker-field:has(.product-picker[open]), .filterbar .advanced-filters[open] { grid-column: 1 / -1; }
  .advanced-filter-fields { position: static; width: 100%; margin-top: 4px; gap: 7px; box-shadow: none; }
  .filter-context { grid-column: 1 / -1; }
  .product-picker > summary { justify-content: space-between; }
  .product-picker[open] { grid-column: 1 / -1; }
  .product-picker-panel { position: static; width: 100%; margin-top: 5px; box-shadow: none; }
  .product-picker-options { max-height: 200px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-bottom: 10px; }
  .metrics > .metric { min-height: 73px; padding: 7px 9px; }
  .metric-label { font-size: 0.78rem; }
  .metric strong { font-size: 1.7rem; }
  .metric-note { font-size: 0.7rem; }
  .insights { gap: 10px; }
  .panel { padding: 12px; }
  .coverage-note { margin-bottom: 10px; padding: 7px 9px; }
  .catalog-panel { padding: 0; }
  .catalog-heading { flex-wrap: wrap; gap: 7px; padding: 12px; }
  .catalog-toolbar { padding: 0 12px 9px; }
  .inventory-view { width: 100%; justify-content: space-between; }
  .inventory-view .segments button { padding-inline: 9px; }
  .catalog-tools { width: 100%; }
  .catalog-tools input { flex: 1; width: 0; }
  .catalog-tools select { max-width: 55%; }
  #products table[data-inventory-view] { display: block; min-width: 0; }
  #products table[data-inventory-view] thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  #products table[data-inventory-view] tbody { display: block; }
  #products table[data-inventory-view] tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    padding: 11px 12px;
    border-top: 1px solid var(--line);
  }
  #products table[data-inventory-view] tbody tr > * {
    min-width: 0;
    padding: 0;
    border: 0;
    background: transparent;
  }
  #products table[data-inventory-view] tbody th,
  #products table[data-inventory-view] .inventory-category,
  #products table[data-inventory-view="combined"] .inventory-rollup-coverage,
  #products table[data-inventory-view="combined"] .inventory-rollup-gaps,
  #products table[data-inventory-view] .empty-state { grid-column: 1 / -1; }
  #products table[data-inventory-view="combined"] .inventory-rollup-value { padding: 6px 8px; border-radius: 7px; background: #f0f5ef; }
  #products table[data-inventory-view="side"] [data-inventory-store] { padding: 7px; border-radius: 7px; background: #f0f5ef; }
  #products table[data-inventory-view="side"] [data-inventory-store]::before { display: block; margin-bottom: 5px; content: attr(data-inventory-store); font-size: 0.78rem; font-weight: 760; }
  #products table[data-inventory-view="side"] .inventory-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
  #products table[data-inventory-view="side"] .status-pill { white-space: normal; }
  #products table[data-inventory-view] .product-meta { overflow-wrap: anywhere; }
  .inventory-rollup-label { display: block; margin-bottom: 3px; color: var(--muted); font-size: 0.77rem; }
  .inventory-rollup-number { color: var(--ink); font-size: 1rem; font-weight: 720; }
}

@media (max-width: 360px) {
  .filterbar { grid-template-columns: minmax(0, 1fr) minmax(0, 1.39fr); }
  .filterbar .store-field { grid-column: 1 / -1; }
  .filterbar .segments button { padding-inline: 2px; font-size: 0.73rem; }
  dialog { padding: 20px 15px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0s !important; }
}

.chart-panel-heading { flex-wrap: wrap; gap: 8px 14px; }
.chart-mode-switch { flex: 0 0 auto; }
.chart-mode-switch button { padding-inline: 10px; }
.chart-panel .legend[hidden], .chart-panel .legend [hidden] { display: none; }
.chart-product-scroll { max-height: 320px; margin-top: 12px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.chart-product-table { width: 100%; min-width: 0; }
.chart-product-table thead th { position: sticky; top: 0; z-index: 1; white-space: normal; }
.chart-product-table th, .chart-product-table td { padding: 8px 10px; }
.chart-product-table tbody th { border-top: 0; background: transparent; white-space: normal; }
.chart-product-name, .chart-product-source { display: block; overflow-wrap: anywhere; }
.chart-product-name { color: var(--ink); font-size: 0.83rem; font-weight: 700; }
.chart-product-source { margin-top: 2px; color: var(--muted); font-size: 0.72rem; font-weight: 500; }
.chart-product-units { display: block; white-space: nowrap; color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-product-rail { position: relative; display: block; height: 5px; margin-top: 4px; overflow: hidden; border-radius: 3px; background: #edf0e9; }
.chart-product-rail::after { position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: #83988b; content: ""; }
.chart-product-bar { position: absolute; top: 0; bottom: 0; left: 50%; border-radius: 0 3px 3px 0; background: var(--trf); }
.chart-product-bar.is-negative { right: 50%; left: auto; border-radius: 3px 0 0 3px; background: #a95541; }

.catalog-overview { align-items: flex-end; }
.catalog-vendor { color: var(--muted); font-size: .87rem; font-weight: 650; margin-bottom: 4px; }
.dashboard-return, .visibility-scope a { color: var(--green); font-weight: 650; text-underline-offset: .2em; }
.dashboard-return { font-size: .87rem; padding-block: 6px; }
.visibility-scope { margin: -3px 0 12px; color: var(--muted); font-size: .81rem; }
.management-panel { padding: 0; overflow: hidden; }
.management-intro, .management-toolbar, .management-product { padding: 17px 20px; }
.management-intro h2, .catalog-empty-dashboard h2 { font-size: 1.18rem; }
.management-intro p, .catalog-empty-dashboard p { margin-top: 5px; max-width: 76ch; color: var(--muted); font-size: .89rem; line-height: 1.5; }
.management-intro .management-source { margin-top: 9px; font-size: .79rem; }
.catalog-empty-dashboard a { margin-top: 14px; text-decoration: none; }
.management-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 18px; padding-block: 12px; background: #f5f8f3; border-block: 1px solid var(--line); }
.catalog-totals, .management-identity, .management-status { display: grid; gap: 4px; justify-items: start; align-content: start; min-width: 0; }
.catalog-totals strong { font-size: .97rem; }
.catalog-totals span, .management-identity span, .management-reason { color: var(--muted); font-size: .78rem; line-height: 1.4; }
.management-controls { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; }
.management-controls label { display: grid; gap: 3px; font-size: .74rem; }
.management-controls input, .management-controls select { min-height: 38px; font-size: .86rem; }
.management-list { margin: 0; padding: 0; list-style: none; }
.management-product { display: grid; align-items: center; grid-template-columns: minmax(0, 1.25fr) minmax(0, 2.3fr) minmax(0, .76fr) minmax(7.5rem, .75fr); gap: 10px 18px; }
.management-facts { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); align-items: start; gap: 10px 14px; margin: 0; }
.management-facts dt, .management-facts small { color: var(--muted); font-size: .75rem; line-height: 1.4; }
.management-facts dd { margin: 3px 0 0; font-size: .86rem; font-weight: 650; line-height: 1.4; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.management-facts small { display: block; margin-top: 2px; font-weight: 400; }
.sale-stores abbr { text-decoration: none; }
.sale-stores abbr + abbr::before { content: " · "; }
.management-product + .management-product { border-top: 1px solid var(--line); }
.management-product:target { background: #f2f8f1; }
.management-product:focus-visible { outline-offset: -3px; }
.management-identity strong, .management-identity span { overflow-wrap: anywhere; }
.management-identity strong { font-size: .93rem; }
.visibility-actions { display: flex; align-items: center; justify-content: flex-end; gap: 5px 9px; flex-wrap: wrap; }
.visibility-actions .button { min-width: 57px; min-height: 40px; font-size: .81rem; }
.secondary-action { padding: 5px 2px; min-height: 40px; border: 0; color: var(--green); background: transparent; text-decoration: underline; text-underline-offset: .2em; font-weight: 650; font-size: .79rem; }
.catalog-feedback { margin: 0 20px 12px; padding: 8px 12px; border-radius: 6px; background: var(--soft-green); color: var(--forest); font-size: .86rem; }
.catalog-feedback.form-error { color: #813b2d; background: #fcebe5; }
.catalog-results { padding: 8px 20px 0; font-size: .8rem; color: var(--muted); }
.catalog-results:empty, .management-controls[hidden], .management-product[hidden], .catalog-no-results[hidden] { display: none; }
.catalog-no-results { padding: 22px; text-align: center; }
.catalog-no-results p { margin-bottom: 8px; color: var(--muted); }
@media (min-width: 701px) and (max-width: 1100px) {
  .management-product { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 11px 18px; }
}
@media (max-width: 700px) {
  .catalog-overview { flex-direction: row; align-items: flex-end; margin-bottom: 14px; }
  .management-panel { padding: 0; }
  .management-intro, .management-product, .management-toolbar { padding: 13px; }
  .management-toolbar { align-items: stretch; }
  .management-controls { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); width: 100%; }
  .management-controls input, .management-controls select { width: 100%; }
  .management-product { grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 10px; }
  .management-identity, .management-facts { grid-column: 1 / -1; }
  .management-facts { padding-block: 9px; border-block: 1px solid var(--line); }
  .visibility-actions { gap: 2px 7px; }
  .visibility-actions button { min-height: 44px; }
  .catalog-feedback { margin-inline: 13px; }
  .catalog-results { padding-inline: 13px; }
}

/* Vendor overview and shared dashboard controls */
.dashboard-page { background: var(--ivory); }
#main {
  width: min(100%, 1520px);
  padding: clamp(18px, 2.4vw, 36px) clamp(16px, 3.3vw, 54px) 52px;
}
#overview {
  position: relative;
  isolation: isolate;
  min-height: 157px;
  margin-bottom: 14px;
  padding: 21px clamp(18px, 2.8vw, 40px);
  color: #fffaf0;
  border: 1px solid #285043;
  border-radius: 16px;
  background: linear-gradient(110deg, #122c23 4%, #204436 72%, #2d5542 100%);
}
#overview::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(135deg, transparent 63%, #dbc18a23 63.15%, transparent 63.4%),
    linear-gradient(135deg, transparent 70%, #dbc18a35 70.15%, transparent 70.4%),
    linear-gradient(135deg, transparent 77%, #dbc18a25 77.15%, transparent 77.4%);
}
.overview-kicker { color: #e1c58e; margin-bottom: 4px; }
.overview-title-group h1 {
  color: #fffaf0;
  font: 700 clamp(2.35rem, 4.2vw, 4rem)/.99 var(--display-font);
  letter-spacing: -.045em;
}
.overview-stores {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 13px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  color: #e4ecdf;
  font-size: .82rem;
}
.overview-stores li {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.overview-stores .portal-icon { width: 13px; height: 13px; color: #d5bc84; }
#overview .snapshot {
  display: grid;
  justify-items: start;
  min-width: min(260px, 100%);
  padding: 12px 15px;
  border: 1px solid #d2c4a53d;
  border-radius: 11px;
  color: #edf1e8;
  background: #102a22d9;
}
#overview .snapshot-status { display: grid; gap: 3px 10px; }
#overview .live-badge {
  justify-self: start;
  padding: 3px 8px;
  margin-bottom: 3px;
  color: #173e30;
  border: 1px solid #c4debf;
  background: #e4f0db;
}
#overview .live-badge::before { background: #357652; }
#overview .data-details > summary { color: #f1d8a5; }
#overview :focus-visible { outline-color: #f0d39b; }
#overview .data-facts { color: var(--ink); right: 0; left: auto; }
#overview #refresh-stock { min-height: 30px; }
.snapshot-cutoff { font-variant-numeric: tabular-nums; }
.panel { box-shadow: 0 3px 14px -13px #362c1d7a; }
.panel-heading h2 {
  color: var(--forest);
  font: 600 var(--panel-title-size)/1.12 var(--display-font);
  letter-spacing: -.025em;
}
:focus-visible { outline-color: var(--green); }
.button.quiet { color: var(--forest); background: var(--paper); border-color: #c9d5c5; }
.button.quiet:hover, .text-button:hover { color: var(--forest); border-color: #a2b49d; background: var(--soft-green); }
select, input:not([type=checkbox]), .product-picker > summary {
  border-color: #d4cbb8;
  border-radius: 8px;
  color: var(--ink);
}
input::placeholder { color: var(--muted); }
.segments { background: #efe9db; border-color: var(--line); }
.segments button { color: var(--muted); }
.segments button:hover { color: var(--forest); background: #e7e9d9; }
.segments button[aria-pressed=true] { color: #fffdf7; border-color: var(--forest); background: var(--forest); }
.data-facts, .advanced-filter-fields, .product-picker-panel { box-shadow: 0 12px 28px #26382a24; }
.product-picker-options label:hover { background: #edf2e6; }
.coverage-note.is-neutral { background: var(--paper); border-color: var(--line); }

.filterbar {
  align-items: end;
  gap: 8px 15px;
  padding: 10px 14px;
  margin: 0 0 13px;
  border-radius: 10px;
  background: #fffdf7;
}
.filterbar-title {
  align-self: center;
  color: var(--forest);
  font-weight: 760;
  font-size: .84rem;
}
.filter-label { font-size: .71rem; color: var(--muted); }
.filterbar .segments { padding: 2px; }
.filterbar .filter-context { margin: 0; }
.dashboard-scope { display: grid; align-self: center; justify-items: end; gap: 3px; margin-left: auto; }
.hidden-count-link { font-size: .75rem; font-weight: 680; color: var(--green); text-underline-offset: 3px; }

.metrics {
  grid-template-columns: 1.22fr 1fr 1fr 1.08fr;
  gap: clamp(8px, 1.2vw, 18px);
  margin: 0 0 16px;
}
.metrics > .metric {
  --metric-accent: #295945;
  --metric-tint: #e6ede0;
  min-width: 0;
  min-height: 145px;
  padding: 14px 16px;
  overflow: hidden;
  border-top: 3px solid #cec3ab;
  border-radius: 13px;
  background: var(--paper);
  box-shadow: none;
}
.metrics > .week-metric {
  --metric-accent: #e3eccf;
  --metric-tint: #ffffff19;
  color: #fffaf0;
  border-color: #295241;
  border-top-color: #acbf8d;
  background: linear-gradient(139deg,#214638,#18372b 72%);
}
.metrics > .sales-metric { border-top-color: #81a485; }
.metrics > .stock-metric { border-top-color: #aeaf81; }
.metrics > .alert-metric.has-shortage {
  --metric-accent: #864725;
  --metric-tint: #f0e2d1;
  border-top-color: #ba8d62;
  background: #fcf0e3;
}
.metric-heading, .metric-amount { display: flex; align-items: center; gap: 8px; }
.metric-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 29px;
  height: 29px;
  color: var(--metric-accent);
  border-radius: 7px;
  background: var(--metric-tint);
}
.metric-icon svg { width: 16px; height: 16px; }
.metric-label { color: var(--ink); font-size: .83rem; font-weight: 730; line-height: 1.23; }
.metric-amount, .restock-quantity { align-items: baseline; gap: 5px; color: var(--ink); margin: 7px 0 4px; }
.metrics .metric strong {
  margin: 0;
  font-size: clamp(2.1rem, 3vw, 3rem);
  font-weight: 740;
  letter-spacing: -.065em;
  line-height: 1;
}
.metric-amount > span, .restock-quantity > span { color: var(--muted); font-size: .74rem; font-weight: 620; }
.metric .metric-note { color: var(--muted); font-size: .76rem; line-height: 1.35; }
.week-metric :is(.metric-amount, .metric-label) { color: #fffaf0; }
.week-metric :is(.metric-amount > span, .metric-note) { color: #e1ecdf; }
.alert-metric.has-shortage .restock-quantity { color: #824621; }
.restock-jump {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: auto;
  padding-top: 5px;
  color: #783f22;
  font-size: .75rem;
  font-weight: 740;
  text-underline-offset: 3px;
}
.restock-jump[hidden] { display: none; }
.restock-jump .portal-icon { width: 13px; height: 13px; }
.stock-review-links { margin-top: auto; gap: 3px 10px; padding-top: 7px; }
.stock-review-links a { color: var(--green); }
.week-track {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  width: 100%;
  gap: 5px;
  margin-top: auto;
  padding-top: 7px;
}
.week-track span { border-top: 2px solid #afc2ac66; padding-top: 3px; font-size: .64rem; font-weight: 650; color: #d5e1d4; }
.week-track .covered { border-color: #e0c28c; color: #ffead0; }
#period-sparkline { width: 100%; height: 20px; margin-top: auto; color: var(--trf); }
#period-sparkline path { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
#period-sparkline circle { fill: currentColor; }
.insights { grid-template-columns: minmax(0, 1.64fr) minmax(295px, 1fr); gap: clamp(12px, 1.45vw, 22px); margin: 0 0 18px; }

@media (max-width: 960px) {
  .insights { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  #main { padding: 13px 12px 38px; }
  #overview { min-height: auto; align-items: start; gap: 10px; padding: 15px 15px 12px; }
  .overview-title-group h1 { font-size: 2.65rem; }
  .overview-stores { margin-top: 7px; }
  #overview .snapshot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 7px 9px; width: 100%; gap: 3px 10px; }
  #overview .snapshot-status { flex: 1 1 auto; display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: .72rem; }
  #overview .snapshot-status .live-badge { align-self: center; margin: 0; }
  #overview .data-facts { right: auto; left: 0; width: min(265px, 70vw); }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .metrics > .metric { min-height: 130px; padding: 10px; }
  .metric-heading { gap: 5px; }
  .metric-label { font-size: .76rem; }
  .metric-icon { width: 24px; height: 24px; }
  .metric-icon svg { width: 14px; height: 14px; }
  .metrics .metric strong { font-size: 2.1rem; }
  .metric .metric-note { font-size: .72rem; }
  .filterbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); padding: 8px 9px; gap: 7px 10px; }
  .filterbar-title { grid-column: 1 / -1; }
  .filterbar .filter-field { justify-items: stretch; }
  .filterbar .segments { width: 100%; }
  .filterbar .segments button { flex: 1; padding-inline: 2px; font-size: .75rem; }
  .filterbar .product-picker-field:has(.product-picker[open]), .filterbar .advanced-filters[open] { grid-column: 1 / -1; }
  .dashboard-scope { grid-column: 1 / -1; display: flex; justify-content: space-between; margin: 0; gap: 8px; }
}
@media (min-width: 701px) and (max-width: 760px) {
  #overview { flex-direction: column; }
}
@media (max-width: 359px) {
  #overview .snapshot-status { flex-basis: 100%; }
  .metrics > .metric { padding-inline: 8px; }
}
