:root { font-family: system-ui, sans-serif; color: #183b2c; background: #f3f6f1; }
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
header { display: flex; align-items: center; gap: 1rem; padding: 1rem clamp(1rem, 5vw, 4rem); background: #193e2e; color: #fff; }
header strong { letter-spacing: .08em; }
header span { font-size: .9rem; opacity: .85; }
main { max-width: 76rem; margin: auto; padding: clamp(1rem, 4vw, 3rem); }
h1 { font-size: clamp(1.8rem, 5vw, 2.5rem); margin: 0 0 .6rem; line-height: 1.15; }
h2 { margin: 0 0 1rem; font-size: 1.15rem; }
p { line-height: 1.55; }
.intro, .muted { color: #506855; }
.narrow { max-width: 34rem; margin: 1rem auto; }
.card { padding: 1.25rem; border: 1px solid #d5e2d4; background: #fff; border-radius: .9rem; }
.columns { display: grid; grid-template-columns: minmax(16rem, 1fr) minmax(0, 2fr); gap: 1rem; align-items: start; }
.columns.readonly { grid-template-columns: minmax(0, 1fr); }
.toolbar { display: flex; justify-content: space-between; gap: .8rem; align-items: start; flex-wrap: wrap; margin-bottom: 1.25rem; }
.toolbar p { margin: .25rem 0; }
label { display: block; font-weight: 650; margin: .9rem 0 .3rem; }
input, select, button { font: inherit; min-height: 2.8rem; border-radius: .45rem; }
input, select { width: 100%; padding: .55rem .7rem; border: 1px solid #9db39f; background: #fff; color: #173b2b; }
input[readonly] { background: #f0f4ef; }
button { cursor: pointer; padding: .55rem .85rem; color: white; background: #255d3b; border: 1px solid #255d3b; font-weight: 650; }
button.secondary { color: #255d3b; background: #fff; }
button:disabled { cursor: wait; opacity: .55; }
:focus-visible { outline: 3px solid #ad7400; outline-offset: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.toolbar .actions { margin-top: 0; }
.message { min-height: 1.3rem; margin: .8rem 0; font-size: .92rem; color: #255d3b; }
.message[data-error="true"] { color: #9b2620; }
.note { padding: .75rem 1rem; border-left: 3px solid #c39c43; background: #fff7e4; color: #644b18; font-size: .9rem; }
.badge { font-size: .8rem; border-radius: 1rem; background: #e4eee3; padding: .3rem .65rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .92rem; }
th, td { padding: .7rem .5rem; border-bottom: 1px solid #e3ebe1; overflow-wrap: anywhere; }
th { background: #f3f6f1; }
.count { color: #506855; font-size: .9rem; }
.module-nav { display: flex; gap: .35rem; flex-wrap: wrap; margin: 0 0 1.1rem; padding: .4rem; background: #fff; border: 1px solid #d5e2d4; border-radius: .75rem; }
.module-nav button { border-color: transparent; }
.module-nav button.secondary:hover { background: #edf4eb; }
.home-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(14rem, 18rem); gap: 1rem; align-items: start; }
.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.quick-grid button { display: grid; gap: .3rem; min-height: 6rem; text-align: left; background: #fff; color: #173b2b; border-color: #d5e2d4; padding: 1rem; }
.quick-grid button:hover { background: #edf4eb; border-color: #9db39f; }
.quick-grid span { color: #506855; font-weight: 400; }
.quick-links button { display: block; width: 100%; margin-top: .55rem; text-align: left; }
.table-actions { white-space: nowrap; }
.table-actions button + button { margin-left: .4rem; }
.commerce-scope { display: flex; flex-wrap: wrap; gap: .8rem; align-items: end; margin-bottom: .8rem; }
.commerce-scope > div { min-width: min(100%, 12rem); }
.sale-columns { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }
.sale-columns > .card { min-width: 0; }
.lookup-results { padding: 0; list-style: none; }
.lookup-results li { display: flex; gap: .7rem; align-items: center; justify-content: space-between; padding: .55rem 0; border-top: 1px solid #e3ebe1; }
.lookup-results li button { flex-shrink: 0; }
#cart-rows input { min-width: 5rem; }
.sale-total { font-size: 1.35rem; font-weight: 750; margin-bottom: .2rem; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .65rem; }
.metric { display: grid; gap: .3rem; }
.metric strong { font-size: 1.25rem; }
dialog { max-width: min(92vw, 36rem); border: 1px solid #9db39f; border-radius: .8rem; padding: 1.2rem; color: #183b2c; }
dialog::backdrop { background: #173b2b99; }
.scanner-dialog video { display: block; width: min(72vw, 30rem); min-height: 6rem; max-height: 52vh; max-height: 52dvh; object-fit: contain; background: #101d16; }
.label-print { display: grid; justify-items: center; text-align: center; gap: .25rem; }
.label-print p { margin: 0; }
.stock-forms { margin-top: 1rem; }
.stock-forms > .card { min-width: 0; }
.stock-section { margin-top: 1rem; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
[hidden] { display: none !important; }
@media (max-width: 52rem) { .columns, .home-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 32rem) { table { min-width: 28rem; } header { align-items: start; flex-direction: column; gap: .2rem; } }
@media (max-width: 27rem) { .quick-grid { grid-template-columns: minmax(0, 1fr); } }
@media print {
  body:has(.label-dialog[open]) > :not(.label-dialog) { display: none !important; }
  .label-dialog[open] { position: static; border: 0; padding: 0; margin: 0; color: #000; }
  .label-dialog[open] > :not(.label-print) { display: none !important; }
  .label-dialog::backdrop { display: none; }
}
