:root {
  --ink: #1d3129;
  --muted: #66776e;
  --paper: #f7f5ef;
  --surface: #ffffff;
  --line: #dbe3dd;
  --primary: #176b4e;
  --primary-dark: #10533c;
  --accent: #d69a38;
  --accent-soft: #fff5df;
  --danger: #a33b37;
  --danger-soft: #fff0ee;
  --shadow: 0 12px 32px rgba(22, 54, 39, .09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); }
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.topbar {
  min-height: 72px; padding: 10px max(24px, calc((100vw - 1280px) / 2));
  display: flex; align-items: center; gap: 26px; background: #123c2e; color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}
.brand { display: inline-flex; align-items: center; gap: 9px; flex: 0 0 auto; color: #fff; font-weight: 750; line-height: 1.05; letter-spacing: .01em; }
.brand:hover { color: #fff; text-decoration: none; }
.brand small { color: #c9dfd3; font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.brand-mark { display: grid; place-items: center; width: 37px; height: 37px; border: 1px solid rgba(255,255,255,.45); border-radius: 11px; background: var(--accent); color: #50350c; font-size: .85rem; font-weight: 900; }
.topbar nav { display: flex; align-items: center; flex: 1; gap: 2px; overflow-x: auto; scrollbar-width: thin; }
.topbar nav a { padding: 9px 10px; border-radius: 8px; color: #d9e9e0; white-space: nowrap; font-size: .88rem; font-weight: 650; }
.topbar nav a:hover, .topbar nav a.active { color: #fff; background: rgba(255,255,255,.14); text-decoration: none; }
.user-menu { display: flex; align-items: center; gap: 12px; color: #d9e9e0; font-size: .85rem; white-space: nowrap; }
.user-menu form { margin: 0; }
.link-button { border: 0; padding: 5px; background: transparent; color: #fff; font-weight: 700; }
.link-button:hover { text-decoration: underline; }

.shell { max-width: 1280px; margin: 0 auto; padding: 32px 24px 48px; }
.hero { display: flex; justify-content: space-between; align-items: end; gap: 28px; padding: 34px; border-radius: 19px; background: linear-gradient(125deg, #164c39, #1b7657); color: #fff; box-shadow: var(--shadow); }
.hero h1, .page-heading h1 { margin: 5px 0 8px; font-size: clamp(1.65rem, 3vw, 2.45rem); line-height: 1.08; letter-spacing: -.035em; }
.hero p:last-child { max-width: 610px; margin: 0; color: #d8ebe1; line-height: 1.55; }
.eyebrow { margin: 0; color: var(--accent); font-size: .69rem; font-weight: 850; letter-spacing: .13em; }
.quick-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.quick-actions a { padding: 11px 13px; border-radius: 9px; background: #fff; color: var(--primary-dark); font-size: .86rem; font-weight: 800; white-space: nowrap; }
.quick-actions a:hover { background: #f7ead1; text-decoration: none; }

.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 13px; margin: 20px 0; }
.metrics article { min-height: 101px; padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 3px 12px rgba(30, 53, 42, .04); }
.metrics small { display: block; min-height: 30px; color: var(--muted); font-size: .77rem; font-weight: 650; }
.metrics strong { font-size: 1.35rem; letter-spacing: -.035em; }
.metrics .attention { border-color: #eccd8e; background: var(--accent-soft); }

.grid { display: grid; gap: 20px; margin-top: 20px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.two-wide { grid-template-columns: minmax(310px, .86fr) minmax(450px, 1.14fr); }
.panel { min-width: 0; padding: 24px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: 0 4px 15px rgba(30, 53, 42, .045); }
.panel + .panel { margin-top: 20px; }
.grid .panel + .panel { margin-top: 0; }
.panel h2 { margin: 0 0 18px; font-size: 1.12rem; letter-spacing: -.02em; }
.panel-title { display: flex; align-items: start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.panel-title h2 { margin: 4px 0 0; }
.panel-title > a { padding-top: 6px; font-size: .83rem; font-weight: 750; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 19px; }
.page-heading h1 { color: var(--ink); }
.page-heading p:last-child { max-width: 720px; margin: 0; color: var(--muted); line-height: 1.5; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; align-items: end; }
.field { display: grid; gap: 6px; min-width: 0; color: var(--ink); font-size: .84rem; font-weight: 720; }
.field > span { min-height: 18px; }
.field input, .field select, .field textarea { width: 100%; min-height: 42px; padding: 10px 11px; border: 1px solid #bfcfc4; border-radius: 9px; outline: none; background: #fff; color: var(--ink); font-size: .95rem; font-weight: 500; transition: border-color .16s, box-shadow .16s; }
.field textarea { min-height: unset; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(23, 107, 78, .14); }
.field small { color: var(--muted); font-size: .74rem; font-weight: 500; line-height: 1.35; }
.field.full { grid-column: 1 / -1; }
.picker-field { align-content: start; }
.picker-trigger { width: 100%; min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 11px; border: 1px solid #bfcfc4; border-radius: 9px; background: #fff; color: var(--muted); text-align: left; font-size: .95rem; font-weight: 500; }
.picker-trigger.selected { color: var(--ink); }
.picker-trigger:hover, .picker-trigger:focus-visible { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(23, 107, 78, .14); outline: 0; }
.picker-trigger > span:last-child { color: var(--primary); font-size: 1.05rem; }
.checkbox-field { display: flex; flex-wrap: wrap; align-items: start; gap: 5px 9px; align-self: end; min-height: 42px; padding: 10px 11px; border: 1px dashed #9ebbad; border-radius: 9px; background: #f6fbf8; color: var(--ink); font-size: .84rem; font-weight: 750; }
.checkbox-field input { width: 17px; height: 17px; margin: 0; accent-color: var(--primary); }
.checkbox-field small { flex-basis: calc(100% - 26px); margin-left: 26px; color: var(--muted); font-size: .71rem; font-weight: 500; line-height: 1.3; }
.file-field { padding: 10px; border: 1px dashed #9ebbad; border-radius: 10px; background: #f6fbf8; }
.file-field input { min-height: unset; padding: 0; border: 0; border-radius: 0; background: transparent; font-size: .82rem; }
.file-field.has-file { border-color: var(--primary); background: #eaf7f0; }
.inline-link { grid-column: 1 / -1; margin-top: -8px; font-size: .82rem; font-weight: 700; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 10px 15px; border: 1px solid transparent; border-radius: 9px; font-size: .9rem; font-weight: 800; line-height: 1.1; text-decoration: none; }
.button:hover { text-decoration: none; }
.button.primary { background: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-dark); }
.button.secondary { border-color: #bbd2c4; background: #f4faf6; color: var(--primary-dark); }
.button.secondary:hover { background: #e5f1e9; }
.button.wide { width: 100%; margin-top: 3px; }
.button.compact { min-height: 32px; padding: 7px 9px; font-size: .76rem; }
.inline-form { margin: 0; }
.callout { background: linear-gradient(145deg, #fffaf0, #fff); border-color: #ebd5a5; }
.callout p:not(.eyebrow) { margin: 0 0 20px; color: #645b4d; line-height: 1.55; }
.scan-panel { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 20px; background: linear-gradient(135deg, #f2faf5, #fff); }
.scan-panel h2 { margin: 5px 0 6px; }
.scan-panel p:not(.eyebrow) { max-width: 680px; margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.45; }
.scan-form { display: flex; align-items: end; gap: 10px; width: min(100%, 450px); }
.scan-form .field { flex: 1; }
.quick-product { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.quick-product summary { margin-bottom: 16px; }
.initial-stock-layout { align-items: stretch; }
.initial-stock-layout .panel { display: flex; flex-direction: column; align-items: flex-start; }
.initial-stock-layout h2 { margin: 5px 0 9px; }
.initial-stock-layout p:not(.eyebrow) { margin: 0 0 20px; color: var(--muted); line-height: 1.5; }
.initial-stock-form { display: grid; width: 100%; gap: 16px; margin-top: auto; }
.initial-stock-form .button { justify-self: start; }
.initial-stock-list { display: grid; gap: 9px; margin: 22px 0 0; padding: 16px 0 0 20px; border-top: 1px solid var(--line); color: #53685c; font-size: .84rem; line-height: 1.45; }
.initial-stock-fields { margin-top: 20px; }
.catalog-table, .report-panel { margin-top: 20px; }
.report-tabs { flex-wrap: wrap; }
.entry-tabs { display: inline-flex; gap: 4px; margin: 0 0 20px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: #eef4ef; }
.entry-tabs a { padding: 8px 11px; border-radius: 7px; color: var(--primary-dark); font-size: .84rem; font-weight: 800; }
.entry-tabs a:hover { background: #e2efe7; text-decoration: none; }
.entry-tabs a.active { background: var(--surface); box-shadow: 0 1px 5px rgba(27, 62, 44, .13); }
.option-combobox { position: relative; }
.option-search { width: 100%; min-height: 42px !important; padding: 9px 10px !important; border-color: #bfcfc4 !important; background: #fff !important; font-size: .92rem !important; }
.option-search:focus { border-color: #177456 !important; box-shadow: 0 0 0 3px rgba(23, 116, 86, .12); outline: 0; }
.option-search-select { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); border: 0; white-space: nowrap; }
.field .option-search-select { display: none; }
.option-search-results { position: absolute; z-index: 30; top: calc(100% + 5px); right: 0; left: 0; display: grid; max-height: 250px; overflow: auto; padding: 5px; border: 1px solid #b7cebd; border-radius: 9px; background: #fff; box-shadow: 0 10px 24px rgba(20, 56, 39, .18); }
.option-search-result { width: 100%; min-height: 38px; padding: 8px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); text-align: left; font: inherit; font-size: .85rem; line-height: 1.35; }
.option-search-result:hover, .option-search-result:focus { background: #e9f4ec; color: var(--primary-dark); outline: 0; }
.option-search-empty { margin: 3px; padding: 8px 10px; color: var(--muted); font-size: .84rem; }
.return-mode-switch { display: inline-flex; gap: 4px; width: fit-content; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: #eef4ef; }
.return-mode-switch button { min-height: 34px; padding: 7px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--primary-dark); font-size: .8rem; font-weight: 800; }
.return-mode-switch button:hover { background: #e2efe7; }
.return-mode-switch button.active { background: var(--surface); box-shadow: 0 1px 5px rgba(27, 62, 44, .13); }
.return-mode-panel { padding: 16px; border: 1px solid #d7e4da; border-radius: 11px; background: #fbfdfb; }
.return-details { padding-top: 4px; }
.entry-main { min-width: 0; }
.entry-document-title { align-items: center; }
.entry-detail-actions { display: flex; justify-content: flex-end; gap: 9px; margin: -8px 0 4px; }
.entry-audit { margin-top: 20px; scroll-margin-top: 88px; }
.entry-form { display: grid; gap: 20px; }
.entry-header { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.entry-items-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.entry-items-heading h3 { margin: 0 0 3px; font-size: 1rem; }
.entry-items-heading p { margin: 0; color: var(--muted); font-size: .8rem; }
.entry-items { display: grid; gap: 12px; }
.entry-item { padding: 15px; border: 1px solid #ccddd1; border-radius: 12px; background: #fbfdfb; }
.entry-item-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; color: var(--primary-dark); font-size: .84rem; }
.remove-entry-item { display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid #e6c2bf; border-radius: 7px; background: #fff7f6; color: var(--danger); font-size: 1.25rem; line-height: 1; }
.remove-entry-item:hover { background: #feecea; }
.entry-item-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; }
.entry-item-grid .item-product { grid-column: span 2; min-width: 0; }
.entry-item-grid .checkbox-field { min-height: 42px; }
.outgoing-item-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(180px, 1fr); gap: 12px; align-items: end; }
.outgoing-history-table td { white-space: nowrap; }
.outgoing-history-table td small { display: block; margin-top: 3px; color: var(--muted); font-size: .76rem; }
.outgoing-history-table .audit-notes { min-width: 180px; max-width: 320px; white-space: normal; line-height: 1.35; }
.entry-summary { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; padding: 14px 16px; border-radius: 10px; background: #eaf6ee; color: var(--primary-dark); }
.entry-summary span { font-size: .85rem; font-weight: 750; }
.entry-summary strong { font-size: 1.2rem; }
.entry-summary small { flex-basis: 100%; color: #5d7566; font-size: .76rem; }
.entry-submit { justify-self: start; min-width: 220px; }
.panel-description { max-width: 650px; margin: -9px 0 0; color: var(--muted); font-size: .85rem; line-height: 1.45; }
.history-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 0 0 16px; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: #f7fbf8; }
.history-filters .field { flex: 1 1 250px; }
.history-filter-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.entry-history-table td { white-space: nowrap; }
.entry-history-table td:first-child { min-width: 210px; white-space: normal; }
.entry-link { display: grid; gap: 3px; color: var(--ink); }
.entry-link:hover { color: var(--primary-dark); text-decoration: none; }
.entry-link small, .entry-history-table td small { display: block; margin-top: 3px; color: var(--muted); font-size: .76rem; }
.entry-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0 0 22px; }
.entry-meta div { min-width: 0; padding: 11px 12px; border: 1px solid #e2ebe3; border-radius: 9px; background: #fbfdfb; }
.entry-meta dt { margin-bottom: 4px; color: var(--muted); font-size: .7rem; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.entry-meta dd { margin: 0; color: var(--ink); font-size: .9rem; font-weight: 750; overflow-wrap: anywhere; }
.section-subtitle { margin: 0 0 13px; font-size: .97rem; }
.entry-observations { display: grid; align-content: start; gap: 11px; }
.entry-observations h2 { margin: 0; }
.entry-observation-form { display: grid; gap: 15px; margin-top: 5px; }
.product-dialog { width: min(94vw, 710px); }
.modal-product-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; padding: 20px 24px 24px; }
.modal-product-form .field:first-of-type { grid-column: 1 / -1; }
.modal-form-actions { display: flex; justify-content: flex-end; gap: 10px; grid-column: 1 / -1; margin-top: 3px; }
.form-error { grid-column: 1 / -1; margin: 0; padding: 10px 11px; border: 1px solid #efb5b0; border-radius: 8px; background: var(--danger-soft); color: #8a2f2b; font-size: .82rem; font-weight: 650; }
.picker-dialog { width: min(94vw, 620px); max-height: min(82vh, 700px); padding: 0; border: 0; border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: 0 22px 70px rgba(8, 34, 24, .28); }
.picker-dialog.product-dialog { width: min(94vw, 710px); }
.picker-dialog::backdrop { background: rgba(13, 36, 27, .52); backdrop-filter: blur(2px); }
.dialog-header { display: flex; align-items: start; justify-content: space-between; gap: 16px; padding: 23px 24px 15px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 5px 0 0; font-size: 1.18rem; }
.dialog-close { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-size: 1.45rem; line-height: 1; }
.dialog-close:hover { background: #f1f5f1; }
.picker-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; max-height: 330px; overflow: auto; padding: 20px 24px; }
.picker-options.units { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.picker-choice { min-height: 44px; padding: 9px 11px; border: 1px solid #c9d8cd; border-radius: 9px; background: #fff; color: var(--ink); text-align: left; font-size: .88rem; font-weight: 700; }
.picker-choice:hover { border-color: var(--primary); background: #edf8f1; color: var(--primary-dark); }
.dialog-divider { border-top: 1px solid var(--line); }
.modal-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; padding: 20px 24px 24px; }

.list { display: grid; }
.list > div { display: grid; gap: 3px; padding: 13px 0; border-bottom: 1px solid #edf1ed; }
.list > div:first-child { padding-top: 0; }
.list > div:last-child { padding-bottom: 0; border-bottom: 0; }
.list strong { font-size: .91rem; }
.list span, .list time { color: var(--muted); font-size: .82rem; line-height: 1.35; }
.list time.due { color: #a46418; font-weight: 750; }
.empty { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th { padding: 0 11px 9px; border-bottom: 1px solid var(--line); color: var(--muted); text-align: left; font-size: .71rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
td { padding: 12px 11px; border-bottom: 1px solid #edf1ed; vertical-align: middle; }
td:first-child, th:first-child { padding-left: 0; }
td:last-child, th:last-child { padding-right: 0; }
td small { display: block; margin-top: 3px; color: var(--muted); font-size: .77rem; }
.text-warning { color: #aa6919; font-weight: 850; }
.status { display: inline-flex; padding: 4px 7px; border-radius: 999px; background: #eef3ef; color: #4d6456; font-size: .74rem; font-weight: 800; }
.status.aberto { background: #e4f4ea; color: #236442; }
.status.encerrado { background: #f1f2ef; color: #626962; }
.status.cancelado { background: var(--danger-soft); color: var(--danger); }

.flash { margin: 0 0 18px; padding: 12px 14px; border-radius: 10px; border: 1px solid; font-size: .9rem; font-weight: 650; }
.flash.success { border-color: #a9d4b8; background: #edf9f0; color: #175d38; }
.flash.error { border-color: #efb5b0; background: var(--danger-soft); color: #8a2f2b; }
.ocr-result { margin-top: 20px; }
.ocr-result h2 { margin-top: 5px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips span, .ocr-suggestion { padding: 8px 10px; border: 1px solid transparent; border-radius: 999px; background: #e8f5ed; color: #1c5d3e; font-size: .85rem; font-weight: 750; }
.ocr-suggestion:hover { border-color: #7bb996; background: #dff1e6; }
.chips small { margin-left: 4px; color: #537864; }
details { margin-top: 18px; }
summary { cursor: pointer; color: var(--primary-dark); font-size: .85rem; font-weight: 750; }
pre { max-height: 250px; overflow: auto; padding: 12px; border-radius: 8px; background: #f3f5f2; color: #425148; white-space: pre-wrap; font: .78rem/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; }

.login-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: radial-gradient(circle at top left, #e5f3e9, transparent 40%), var(--paper); }
.login-card { width: min(100%, 410px); display: grid; gap: 17px; padding: 32px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: var(--shadow); }
.brand-login { display: flex; align-items: center; gap: 11px; padding-bottom: 7px; }
.brand-login strong, .brand-login small { display: block; }
.brand-login strong { font-size: 1.12rem; }
.brand-login small { margin-top: 3px; color: var(--muted); font-size: .82rem; }

@media (max-width: 1050px) {
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .topbar { gap: 14px; }
  .user-menu > span { display: none; }
}
@media (max-width: 760px) {
  .topbar { align-items: center; min-height: 64px; padding: 9px 16px; gap: 12px; }
  .topbar nav { order: 3; flex-basis: 100%; margin: 0 -16px -9px; padding: 0 16px 9px; }
  .topbar nav a { padding: 7px 8px; font-size: .81rem; }
  .user-menu { margin-left: auto; }
  .shell { padding: 20px 15px 36px; }
  .hero { align-items: start; flex-direction: column; padding: 24px; }
  .quick-actions { justify-content: start; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .metrics article { min-height: 88px; padding: 14px; }
  .grid.two, .grid.two-wide { grid-template-columns: 1fr; gap: 15px; }
  .panel { padding: 18px; border-radius: 13px; }
  .form-grid { grid-template-columns: 1fr; }
  .scan-panel, .scan-form { align-items: stretch; flex-direction: column; }
  .scan-form { width: 100%; }
  .history-filters { align-items: stretch; }
  .history-filter-actions { width: 100%; }
  .entry-item-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .outgoing-item-grid { grid-template-columns: 1fr; }
  .picker-options, .picker-options.units { grid-template-columns: 1fr; }
  .modal-form, .modal-product-form { grid-template-columns: 1fr; }
  .modal-product-form .field:first-of-type { grid-column: auto; }
  .entry-meta { grid-template-columns: 1fr; }
  .initial-stock-form .button { width: 100%; }
  .field.full, .inline-link { grid-column: auto; }
  .page-heading { margin: 0 0 16px; }
  .page-heading h1 { font-size: 1.6rem; }
}
@media (max-width: 520px) { .entry-item-grid { grid-template-columns: 1fr; } .entry-item-grid .item-product { grid-column: auto; } .entry-items-heading, .entry-document-title { align-items: start; flex-direction: column; } .entry-tabs, .return-mode-switch { display: grid; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); } .report-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); } .entry-tabs a, .return-mode-switch button { text-align: center; } .entry-detail-actions { justify-content: stretch; margin: -6px 0 4px; } .entry-detail-actions .button { width: 100%; } .modal-form-actions { justify-content: stretch; flex-direction: column-reverse; } .modal-form-actions .button { width: 100%; } .entry-submit { width: 100%; } }
@media (max-width: 400px) { .metrics { grid-template-columns: 1fr; } }

.expiry-alert-link { display: block; margin-top: 8px; font-weight: 700; text-decoration: underline; }
.lot-details-button { margin-top: 6px; }
.item-lots-dialog { width: min(94vw, 760px); }
.item-lots-body { padding: 16px 24px 24px; }
.item-lots-body > p { margin: 0 0 16px; }
.item-lots-body > .button { margin-top: 16px; }

/* Compact entry rows, shared by new entries and entry editing. */
.entry-item { position: relative; padding: 12px 50px 12px 14px; }
.entry-item-title { position: absolute; right: 12px; bottom: 19px; margin: 0; }
.entry-item-title strong { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.entry-item-grid { grid-template-columns: minmax(210px, 2.4fr) minmax(85px, .8fr) minmax(155px, 1.25fr) minmax(125px, 1fr) minmax(110px, 1fr) minmax(115px, 1fr); gap: 10px; align-items: end; }
.entry-item-grid .item-product { grid-column: auto; }
.entry-item-grid > .field { min-width: 0; }
.entry-item-grid .field > span { font-size: .8rem; }
.entry-item-grid .field input, .entry-item-grid .field select { min-width: 0; height: 42px; padding: 8px 10px; font-size: .85rem; }
.entry-item-grid .field > small { display: none; }
.entry-item-grid .item-expiry-option { min-height: 42px; padding: 6px 8px; gap: 6px; font-size: .75rem; line-height: 1.2; }
.entry-item-grid .item-expiry-option input { flex-shrink: 0; }
.option-search-results[hidden] { display: none; }
.entry-item input[aria-invalid="true"] { border-color: var(--danger); background: #fff2f1; box-shadow: 0 0 0 2px rgba(180, 40, 30, .12); }
.entry-item-total { display: grid; gap: 7px; min-width: 0; color: var(--primary-dark); }
.entry-item-total > span { font-size: .8rem; font-weight: 700; }
.entry-item-total > output { display: flex; align-items: center; min-height: 42px; padding: 8px 10px; border-radius: 8px; background: #eaf6ee; font-size: .9rem; font-weight: 750; overflow-wrap: anywhere; }
.entry-form > .entry-summary { position: sticky; bottom: 12px; z-index: 10; border: 1px solid #ccddd1; box-shadow: 0 4px 16px rgba(20, 56, 39, .1); }
@media (min-width: 1151px) {
  .entry-item-grid { grid-template-columns: minmax(180px, 2fr) minmax(75px, .7fr) minmax(145px, 1.2fr) minmax(115px, .9fr) minmax(95px, .8fr) minmax(100px, .9fr) minmax(110px, 1fr); }
}
@media (max-width: 1150px) {
  .entry-item-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .entry-item-grid .item-product { grid-column: auto; }
}
@media (max-width: 760px) {
  .entry-item-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .entry-item-grid .item-product { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .entry-item { padding: 12px 14px; }
  .entry-item-title { top: 12px; bottom: auto; }
  .entry-item-grid { grid-template-columns: 1fr; }
  .entry-item-grid .item-product { grid-column: auto; padding-right: 36px; }
}
