:root {
  --green: #0c9b5b;
  --green-dark: #087947;
  --green-soft: #e8f7ef;
  --ink: #14231c;
  --muted: #78847f;
  --line: #e6ebe8;
  --surface: #ffffff;
  --canvas: #f4f7f5;
  --orange: #ef8b3a;
  --orange-soft: #fff4e9;
  --blue: #397fdb;
  --blue-soft: #edf4ff;
  --red: #dc5c5c;
  --shadow: 0 12px 36px rgba(30, 74, 51, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif; font-size: 14px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
small { font-size: 12px; line-height: 1.5; }
button { border: 0; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(12, 155, 91, .2); outline-offset: 2px; }

.app-shell { display: flex; min-height: calc(100vh - 48px); }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 224px; background: #14221c; color: #dce8e1; display: flex; flex-direction: column; z-index: 10; }
.brand-mark { height: 76px; display: flex; align-items: center; gap: 11px; padding: 0 24px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: #fff; background: var(--green); font-weight: 800; letter-spacing: .5px; }
.brand-text { display: flex; flex-direction: column; gap: 4px; }
.brand-text strong { color: #fff; font-size: 16px; }
.brand-text small { color: #8ea399; font-size: 12px; }
.main-nav { padding: 20px 12px; display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 13px; min-height: 47px; padding: 0 15px; color: #b8c9c0; background: transparent; border-radius: 9px; text-align: left; transition: .2s ease; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: var(--green); color: #fff; box-shadow: 0 9px 20px rgba(12, 155, 91, .18); }
.nav-icon { width: 20px; text-align: center; font-size: 19px; line-height: 1; }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: #df6e55; font-size: 12px; }
.sidebar-bottom { margin-top: auto; padding: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.user-mini { display: flex; align-items: center; gap: 10px; padding: 15px 7px 4px; color: #fff; }
.user-mini small { display: block; margin-top: 3px; color: #8ea399; font-size: 12px; }
.avatar, .top-avatar { display: grid; place-items: center; border-radius: 50%; background: #d5eee1; color: var(--green-dark); font-weight: 700; }
.avatar { width: 32px; height: 32px; }
.more-button { margin-left: auto; color: #95a89e; background: transparent; font-size: 17px; }

.main-content { width: calc(100% - 224px); margin-left: 224px; }
.topbar { height: 76px; padding: 0 36px; display: flex; align-items: center; justify-content: space-between; background: var(--surface); border-bottom: 1px solid var(--line); }
.breadcrumb { display: flex; align-items: center; gap: 12px; color: #68766f; }
.breadcrumb i { color: #b4beb9; font-style: normal; }
.breadcrumb strong { color: var(--ink); }
.top-actions { display: flex; align-items: center; gap: 12px; }
.global-search { width: 264px; height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid transparent; border-radius: 8px; background: #f5f7f6; color: #93a09a; }
.global-search:focus-within { border-color: #b6dec8; background: #fff; }
.global-search input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.outline-button, .primary-button, .ghost-button { height: 38px; padding: 0 15px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 600; white-space: nowrap; }
.outline-button { color: var(--green-dark); border: 1px solid #9ad4b5; background: #fff; }
.outline-button:hover { background: var(--green-soft); }
.primary-button { color: #fff; background: var(--green); }
.primary-button:hover { background: var(--green-dark); }
.ghost-button { color: #5f6f67; background: #f2f5f3; }
.ghost-button:hover { background: #e6ece8; }
.round-button { position: relative; width: 36px; height: 36px; border-radius: 50%; color: #6b7c73; background: transparent; font-size: 20px; }
.notify-dot { position: absolute; top: 1px; right: 1px; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--red); font-size: 12px; font-weight: 500; }
.top-avatar { width: 35px; height: 35px; }
.mobile-menu { display: none; background: transparent; font-size: 20px; color: var(--ink); }

.page-container { max-width: 1450px; margin: 0 auto; padding: 30px 36px 48px; }
.site-footer { width:calc(100% - 224px); min-height:48px; margin-left:224px; display:flex; align-items:center; justify-content:center; padding:8px 16px; border-top:1px solid var(--line); background:#fff; color:#66756d; font-size:12px; line-height:1.5; text-align:center; }
.site-footer a { color:#53675c; text-decoration:underline; text-underline-offset:2px; }
.site-footer a:hover { color:var(--green-dark); }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 23px; }
.page-heading h1 { margin: 0; font-size: 26px; }
.page-heading p { margin: 8px 0 0; color: var(--muted); }
.page-heading-actions { display: flex; gap: 10px; }
.section-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.card-title { margin: 0; font-size: 16px; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.card-title-row a, .link-button { color: var(--green); background: transparent; font-weight: 600; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat-card { position: relative; padding: 19px 20px; min-height: 142px; overflow: hidden; }
.stat-card::after { content: ""; position: absolute; width: 95px; height: 95px; right: -24px; bottom: -28px; border-radius: 50%; border: 18px solid rgba(255,255,255,.5); }
.stat-card.green { background: #e8f7ef; }
.stat-card.blue { background: var(--blue-soft); }
.stat-card.orange { background: var(--orange-soft); }
.stat-card.lilac { background: #f2efff; }
.stat-label { color: #5d6b64; font-size: 13px; }
.stat-value { margin: 13px 0 7px; font-size: 29px; font-weight: 750; letter-spacing: .2px; }
.stat-value { display: block; }
.stat-value small { font-size: 14px; font-weight: 500; }
.stat-foot { color: var(--muted); font-size: 12px; }
.stat-foot strong { color: var(--green-dark); font-weight: 600; }
.stat-icon { position: absolute; top: 18px; right: 20px; width: 35px; height: 35px; border-radius: 10px; display: grid; place-items: center; color: var(--green-dark); background: rgba(255,255,255,.74); font-size: 18px; }
.stat-card.blue .stat-icon { color: #3a70bf; }
.stat-card.orange .stat-icon { color: #c56d26; }
.stat-card.lilac .stat-icon { color: #6b5cb5; }

.dashboard-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 16px; margin-top: 16px; }
.dashboard-card { padding: 22px; }
.chart-tabs { display: flex; gap: 17px; }
.chart-tabs button { color: var(--muted); background: transparent; padding-bottom: 5px; border-bottom: 2px solid transparent; }
.chart-tabs button.active { color: var(--green); border-color: var(--green); }
.sales-chart { height: 220px; padding-top: 16px; display: flex; align-items: flex-end; gap: clamp(9px, 2vw, 21px); border-bottom: 1px solid var(--line); background-image: linear-gradient(#eaf0ed 1px, transparent 1px); background-size: 100% 25%; }
.bar-wrap { height: 100%; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; }
.bar { width: min(34px, 75%); height: var(--h); min-height: 10px; border-radius: 5px 5px 0 0; background: var(--green); }
.bar:nth-child(odd) { background: #7bcda3; }
.bar-label { color: var(--muted); font-size: 12px; }
.legend { display: flex; justify-content: flex-end; gap: 18px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.legend span::before { content: ""; width: 8px; height: 8px; display: inline-block; margin-right: 5px; border-radius: 50%; background: var(--green); }
.legend span:last-child::before { background: #cbd7d0; }
.legend span:only-child::before { background: var(--green); }

.alert-list { display: grid; gap: 12px; }
.alert-item { display: flex; align-items: center; gap: 12px; padding: 12px; background: #fafcfb; border: 1px solid var(--line); border-radius: 8px; }
.alert-symbol { width: 32px; height: 32px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; background: var(--orange-soft); color: var(--orange); font-weight: 700; }
.alert-item.red .alert-symbol { color: var(--red); background: #fff0f0; }
.alert-item strong { display: block; font-size: 14px; }
.alert-item small { display: block; margin-top: 4px; color: var(--muted); }
.alert-count { margin-left: auto; color: var(--orange); font-weight: 700; }
.alert-item.red .alert-count { color: var(--red); }

.recent-card { padding: 22px; margin-top: 16px; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 13px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table th { color: #7c8882; font-size: 13px; font-weight: 600; background: #fafcfb; }
.product-table { min-width: 1120px !important; }
.supplier-cell { max-width: 300px; white-space: normal !important; overflow-wrap: anywhere; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td { color: #34433b; }
.data-table .number { color: var(--ink); font-weight: 700; }
.order-link { color: var(--green); font-weight: 700; background: transparent; }
.status-tag { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 5px; font-size: 12px; }
.status-tag.pending { color: #b56c14; background: #fff4df; }
.status-tag.out { color: #2871b4; background: #eaf4ff; }
.status-tag.done { color: var(--green-dark); background: var(--green-soft); }

.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 11px; padding: 16px; margin-bottom: 16px; }
.filter-bar input, .filter-bar select, .form-field input, .form-field select, .form-field textarea { height: 38px; padding: 0 11px; border: 1px solid #dbe3de; border-radius: 6px; outline: 0; color: var(--ink); background: #fff; }
.filter-bar input:focus, .filter-bar select:focus, .form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: #87cca7; }
.filter-bar input { min-width: 210px; }
.table-card { overflow: hidden; }
.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 19px 20px; border-bottom: 1px solid var(--line); }
.table-scroll { overflow-x: auto; }
.table-scroll .data-table { min-width: 830px; }
.empty-state { padding: 55px; text-align: center; color: var(--muted); }
.empty-state strong { display: block; margin-bottom: 5px; color: #58675f; }
.stock-table .low-stock { color: var(--red); font-weight: 700; }
.product-name { display: flex; align-items: center; gap: 10px; }
.product-thumb { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 8px; background: var(--green-soft); color: var(--green); font-size: 19px; }

.modal-backdrop { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(14, 33, 24, .45); z-index: 30; }
.modal { width: min(610px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 26px; border-radius: 12px; background: #fff; box-shadow: 0 24px 70px rgba(0,0,0,.22); }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; font-size: 19px; }
.modal-header p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.modal-close { width: 31px; height: 31px; border-radius: 50%; color: #78847f; background: #f3f6f4; font-size: 18px; }
.modal-body { padding-top: 19px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 15px; }
.school-price-form { align-items: start; }
.school-price-form .form-field { min-width: 0; align-content: start; }
.school-price-form input, .school-price-form select { width: 100%; min-width: 0; }
.school-price-form .checkbox-label input { width: 16px; height:16px; min-width:16px; margin:0; }
.form-field { display: flex; flex-direction: column; align-items: stretch; gap: 7px; min-width: 0; }
.form-field.full { grid-column: 1/-1; }
.form-field label { color: #506057; font-size: 13px; font-weight: 600; line-height: 20px; }
.form-field textarea { height: 78px; padding-top: 10px; resize: vertical; }
.category-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.category-chip { display: inline-flex; padding: 4px 9px; border: 1px solid var(--line); border-radius: 16px; color: var(--muted); font-size: 12px; }
.order-lines { display: grid; gap: 10px; margin-top: 14px; }
.order-line { display: grid; grid-template-columns: minmax(0,1fr) 74px 72px 30px; align-items: center; gap: 8px; padding: 9px; border: 1px solid var(--line); border-radius: 7px; }
.order-line select, .order-line input { width: 100%; height: 34px; padding: 0 7px; border: 1px solid #dbe3de; border-radius: 5px; }
.order-line .line-total { text-align: right; font-weight: 700; }
.remove-line { width: 26px; height: 26px; color: var(--red); background: #fff0f0; border-radius: 50%; }
.modal-footer { display: flex; justify-content: flex-end; gap: 9px; padding-top: 21px; margin-top: 19px; border-top: 1px solid var(--line); }
.modal-total { margin-right: auto; align-self: center; color: var(--muted); }
.modal-total strong { color: var(--ink); font-size: 18px; }
.helper-row { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; color: var(--muted); font-size: 12px; }

.toast { position: fixed; left: 50%; bottom: 30px; z-index: 50; transform: translate(-50%, 20px); padding: 12px 18px; border-radius: 8px; color: #fff; background: #1d2d25; box-shadow: 0 12px 30px rgba(0,0,0,.18); opacity: 0; pointer-events: none; transition: .25s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.eyebrow { display: block; margin-bottom: 9px; color: #91a299; font-size: 12px; font-weight: 600; }
.inline-demo { display: inline-block; padding: 3px 8px; margin-left: 8px; border-radius: 4px; background: #e8eee9; color: #637b6c; font-size: 12px; vertical-align: middle; }
.demo-indicator { padding: 9px 14px 1px; color: #7bb49a; font-size: 12px; }
.card-subtitle { color: #8b9890; margin: 6px 0 0; font-size: 12px; }
.stat-icon { font-weight: 700; }
.chart-scale { color: #8b9890; font-size: 12px; }
.sales-chart { padding-top: 10px; }
.bar-amount { font-size: 12px; color: #93a198; }
.bar-wrap .bar { background: #a5dabc; }
.bar-wrap .bar.today { background: var(--green); box-shadow: 0 -4px 14px #0c9b5b15; }
.bar-label { white-space: nowrap; padding-bottom: 5px; }
.alert-item { width: 100%; text-align: left; }
.alert-item:hover { border-color: #bdd9c9; background: #f3f9f5; }
.alert-copy { flex: 1; }
.alert-count { font-size: 21px; text-align: right; }
.alert-count small { font-size: 12px; font-weight: 500; }
.alert-symbol { flex-shrink: 0; }
.muted-count { font-size: 12px; color: var(--muted); margin-left: 9px; font-weight: 400; }
.table-summary { color: var(--muted); font-size: 12px; }
.table-summary b { color: var(--ink); margin-left: 7px; }
.cell-note { display: block; font-size: 12px; color: #92a097; margin-top: 5px; font-weight: 400; }
.text-clip { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.product-name small { display: block; color: #92a097; font-size: 12px; margin-top: 5px; }
.status-tag.neutral { background: #f0f2f1; color: #89928d; }
.low-stock { color: var(--red) !important; }
.search-input { display: flex; gap: 9px; align-items: center; background: #fff; border: 1px solid #dbe3de; border-radius: 6px; padding-left: 11px; color: #a2afa7; }
.search-input input { border: 0; min-width: 230px; box-shadow: none; }
.search-input:focus-within { border-color: #87cca7; }
.unit { font-size: 12px; font-weight: 400; color: var(--muted); }
.inventory-card { margin-top: 20px; }
.view-tabs { display: flex; gap: 24px; }
.view-tabs button { border-bottom: 2px solid transparent; background: transparent; color: var(--muted); padding: 8px 0; }
.view-tabs button.active { color: var(--green); font-weight: 700; border-color: var(--green); }
.inset-filter { padding: 14px 20px; margin: 0; border-bottom: 1px solid var(--line); }
.checkbox-label { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.filter-bar .checkbox-label input { width: 15px; height: 15px; min-width: 0; accent-color: var(--green); }
.wide-modal { width: min(780px, 100%); }
.form-error { padding: 11px 12px; background: #fff1ee; color: #bc4a38; font-size: 12px; line-height: 1.6; margin-bottom: 16px; border-radius: 6px; }
.form-hint, .field-hint { color: var(--muted); font-size: 12px; line-height: 1.8; }
.form-hint { margin-top: 16px; }
.form-field input[readonly], .form-field select:disabled { background: #f5f7f6; color: #78847f; }
.lines-header { margin-top: 21px; padding: 0 10px; display: grid; grid-template-columns: minmax(170px, 1fr) 68px 85px minmax(100px, .72fr) 70px 28px; gap: 8px; font-size: 12px; color: var(--muted); }
.order-lines { margin-top: 8px; }
.order-line { grid-template-columns: minmax(170px, 1fr) 68px 85px minmax(100px, .72fr) 70px 28px; gap: 8px; background: #fafcfb; }
.order-line select { background: #fff; }
.line-remark { min-width: 0; font-size: 12px; }
.line-stock { display: block; font-size: 12px; color: #94a097; margin: 5px 2px 0; }
.line-total { font-size: 12px; }
.note-field { margin-top: 20px; }
.modal-open { overflow: hidden; }
.detail-heading { display: flex; justify-content: space-between; align-items: center; font-size: 18px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0; font-size: 12px; color: var(--muted); }
.detail-grid strong { display: block; color: var(--ink); font-size: 13px; margin-top: 6px; font-weight: 500; }
.detail-grid .full { grid-column: 1 / -1; }
.detail-table { min-width: 500px !important; }
.detail-table .detail-sequence { width:48px; min-width:48px; text-align:center; color:var(--muted); font-size:12px; }
.detail-table.detail-resizable { table-layout:fixed; }
.detail-table.detail-resizable .detail-sequence { width:auto; min-width:0; }
.detail-table.detail-resizable th { position:sticky; top:0; z-index:1; padding-right:16px; }
.detail-table.detail-resizable td { white-space:normal; overflow-wrap:anywhere; }
.detail-table.detail-resizable .cell-note { white-space:normal; }
.detail-column-resize { position:absolute; top:0; right:0; bottom:0; width:10px; cursor:col-resize; touch-action:none; user-select:none; border-right:1px solid #dbe3de; }
.detail-column-resize:hover, .detail-column-resize:focus-visible, .detail-table.is-resizing .detail-column-resize { background:#d8eee3; outline:none; }
.detail-column-resize:focus-visible { box-shadow:inset 0 0 0 2px #15945e; }
.detail-table.is-resizing { user-select:none; cursor:col-resize; }
.detail-resize-tools { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:6px; padding:0 0 10px; }
.detail-resize-tools small { font-size: 12px; color:var(--muted); }
.detail-resize-tools .link-button { font-size:12px; }
.detail-remark { color: var(--muted); font-size: 12px; line-height: 1.8; }
.detail-total { padding: 17px 0 0; text-align: right; color: var(--muted); font-size: 12px; }
.detail-modal { display: flex; flex-direction: column; overflow: hidden; }
.detail-modal #modalForm { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; overflow: hidden; }
.detail-modal .modal-body { display: flex; flex: 1 1 auto; flex-direction: column; min-height: 0; overflow: hidden; }
.detail-modal .detail-items-scroll { flex: 1 1 auto; min-height: 100px; overflow: auto; overscroll-behavior: contain; }
.detail-modal .detail-fixed-header, .detail-modal .detail-fixed-summary { flex: 0 0 auto; }
.detail-modal .modal-footer { flex: 0 0 auto; padding-bottom: 2px; background: #fff; }
.detail-modal .modal-header, .order-entry-modal .modal-header { flex: 0 0 auto; }
.detail-modal .form-error, .order-entry-modal .form-error { flex:0 0 auto; }
.order-entry-modal { display:flex; flex-direction:column; overflow:hidden; max-height:calc(100dvh - 40px); }
.order-entry-modal #modalForm, .order-entry-modal .modal-body { display:flex; flex:1 1 auto; flex-direction:column; min-height:0; overflow:hidden; }
.order-entry-fixed-header { flex:0 0 auto; }
.order-items-scroll { flex:1 1 auto; min-height:80px; overflow:auto; overscroll-behavior:contain; scrollbar-gutter:stable; padding-bottom:10px; }
.order-entry-modal .modal-footer { flex:0 0 auto; flex-wrap:wrap; background:white; margin-top:10px; padding-top:12px; }
.order-entry-modal .modal-footer .order-next-product { margin-right:8px; }
.order-keyboard-help { margin:0 0 12px; padding:8px 10px; border-radius:6px; background:#eef7f1; color:#3c6650; font-size:12px; }
.order-draft-guard { margin-top:7px; padding:6px 9px; border-left:3px solid var(--primary,#15945e); background:#f0f8f3; color:#3c6650; font-size: 12px; line-height:1.5; }
.recognition-modal { display:flex; flex-direction:column; overflow:hidden; max-height:calc(100dvh - 40px); }
.recognition-modal #modalForm { display:flex; flex:1 1 auto; flex-direction:column; min-height:0; overflow:hidden; }
.recognition-modal .modal-header, .recognition-modal .modal-footer { flex:0 0 auto; background:#fff; }
.recognition-modal .modal-body { flex:1 1 auto; min-height:80px; overflow:auto; overscroll-behavior:contain; scrollbar-gutter:stable; overflow-anchor:none; }
.recognition-modal .modal-footer { flex-wrap:wrap; padding-top:12px; }
.recognition-manual-note { padding:10px 12px; margin-bottom:10px; border-left:3px solid #cf8b20; background:#fff8eb; color:#815517; font-size:12px; line-height:1.7; }
.recognition-manual-note ul { margin:6px 0; padding-left:20px; }
.order-unit-editor { grid-column:1/-1; display:flex; flex-wrap:wrap; align-items:center; gap:7px; padding:10px; margin:7px 0; border:1px solid #d7e7dd; border-radius:6px; background:#f4f9f6; }
.order-unit-editor input { width:95px; min-width:65px; }
.order-unit-editor small, .order-unit-editor .unit-config-error { flex-basis:100%; }
.order-unit-editor .unit-config-error { color:#b83a36; }
.line-unit-bar .configure-order-unit { flex-shrink:0; font-size: 12px; }
.line-unit-bar { flex-wrap:wrap; }
.order-entry-modal .order-entry-toolbar { margin-top:10px; margin-bottom:8px; }
.order-entry-modal .pricing-hint { margin-top:10px; padding:6px 10px; }
.order-entry-modal .pricing-hint p { margin:4px 0; }
.order-entry-modal .modal-header p { margin-bottom:0; }
.order-entry-modal .order-items-scroll .order-product-choices { position:relative; top:auto; margin-top:4px; max-height:200px; grid-column:1/-1; }
.order-entry-modal .order-items-scroll .line-product-box:has(.order-product-choices:not([hidden])) { z-index:auto; }
@media(max-width:700px) {
  .order-entry-modal .modal-header p { display:none; }
  .order-entry-modal .modal-body { padding-top:10px; }
  .order-entry-fixed-header .form-grid { gap:8px; grid-template-columns:1fr 1fr; }
  .order-entry-fixed-header .form-field { gap:4px; }
  .order-entry-fixed-header .form-field:last-child { grid-column:1/-1; }
  .order-entry-modal .pricing-hint { font-size: 12px; }
  .order-entry-modal .pricing-hint > p:first-child { display:none; }
  .order-entry-modal .order-entry-toolbar > span { display:none; }
  .order-entry-modal .modal-footer .modal-total { width:auto; margin:0 auto 0 0; }
  .order-entry-modal .order-next-product { order:3; width:100%; margin:0; }
  .order-keyboard-help { font-size: 12px; }
}
.wechat-order-text { min-height: 190px; line-height: 1.65; }
.recognition-help { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.recognition-customer { display: grid; grid-template-columns: 80px minmax(0,1fr); align-items: center; gap: 8px 12px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: #f8faf9; }
.recognition-customer > label { color: #506057; font-size: 12px; font-weight: 600; }
.recognition-customer select, .recognition-row input { min-width: 0; width: 100%; height: 36px; padding: 0 9px; border: 1px solid #dbe3de; border-radius: 5px; color: var(--ink); background: #fff; }
.recognition-customer small { grid-column: 2; color: var(--muted); font-size: 12px; }
.recognition-unparsed { display: grid; gap: 4px; padding: 10px 12px; margin-top: 12px; border-left: 3px solid #d28a1e; background: #fff8e8; color: #694a18; font-size: 12px; }
.recognition-unparsed small { color: #8c6d36; }
.recognition-grid-header, .recognition-row { display: grid; grid-template-columns: minmax(110px,1.1fr) minmax(190px,1.8fr) minmax(100px,.8fr) minmax(110px,.85fr) 28px; align-items: center; gap: 8px; }
.recognition-grid-header { padding: 14px 9px 7px; color: var(--muted); font-size: 12px; }
.recognition-grid-header span:nth-child(n+3) { text-align: center; }
.recognition-lines { display: grid; gap: 8px; }
.recognition-category-header { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:10px 12px; border-left:3px solid var(--green,#25875c); border-radius:4px; background:#edf6ef; }
.recognition-category-header strong { font-size:13px; }
.recognition-category-header span { color:var(--muted); font-size: 12px; }
.new-product-category { display:grid; gap:6px; margin-top:8px; }
.new-product-category input { width:100%; }
.new-product-category[hidden] { display:none; }
#newProductCategoryToggle { align-self:flex-start; padding-left:0; margin-top:4px; }
.recognition-row { padding: 9px; border: 1px solid var(--line); border-radius: 6px; background: #fbfcfb; }
.recognition-product-control { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 6px; min-width: 0; }
.recognition-product-control .link-button { padding: 4px 2px; font-size: 12px; white-space: nowrap; }
.recognition-source, .recognition-row label { display: grid; min-width: 0; gap: 5px; }
.recognition-source strong { overflow-wrap: anywhere; font-size: 12px; }
.recognition-source small, .recognized-status, .recognized-unit { color: var(--muted); font-size: 12px; line-height: 1.4; }
.recognition-row label > span { display: none; color: var(--muted); font-size: 12px; }
.recognized-status.is-matched { color: var(--green-dark); }
.recognized-status.is-unresolved { color: #a35b12; }
.recognized-unit.unit-mismatch { color: #a35b12; }
.recognition-row .recognized-qty, .recognition-row .recognized-price { text-align: right; }
.recognition-unit-ack { padding: 10px 12px; margin-top: 12px; border: 1px solid #efd28f; border-radius: 6px; background: #fff8e8; color: #694a18; font-size: 12px; }
.recognition-unit-ack label { display: flex; align-items: flex-start; gap: 8px; }
.recognition-unit-ack input { margin-top: 2px; accent-color: var(--green); }
.recognition-summary { display: flex; justify-content: space-between; gap: 12px; padding-top: 13px; margin-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.recognition-summary strong { color: var(--ink); font-size: 12px; white-space: nowrap; }
.recognition-summary b { color: var(--green-dark); }
@media (max-width: 740px) {
  .recognition-help { flex-direction: column; gap: 3px; }
  .recognition-customer { grid-template-columns: 1fr; }
  .recognition-customer small { grid-column: 1; }
  .recognition-grid-header { display: none; }
  .recognition-row { grid-template-columns: minmax(0,1fr) minmax(0,1fr) 28px; gap: 9px; }
  .recognition-source { grid-column: 1 / 3; }
  .recognition-row label > span { display: block; }
  .recognition-product-control { grid-column: 1 / 4; }
  .recognition-qty-field { grid-column: 1; }
  .recognition-price-field { grid-column: 2; }
  .recognition-remove { grid-column: 3; grid-row: 1; }
  .recognition-summary { align-items: flex-start; flex-direction: column; }
}

.wide-modal { width: min(1320px, calc(100vw - 40px)); }
.pricing-hint { padding: 10px 12px; margin-top: 16px; border-left: 3px solid var(--green); background: #f3f8f5; color: #53665b; font-size: 12px; }
.lines-header, .order-line { grid-template-columns: minmax(190px, 2fr) 68px 84px 80px 84px minmax(90px, 1fr) 78px 28px; }
.lines-header { gap: 8px; }
.order-line { gap: 8px; }
.order-line > * { min-width: 0; }
.line-product-box { display: grid; gap: 6px; }
.order-line label { display: grid; gap: 4px; min-width: 0; }
.order-line label > span { color: var(--muted); font-size: 12px; }
.order-line .line-qty, .order-line .line-cost, .order-line .line-margin, .order-line .line-price, .order-line .line-remark { min-width: 0; width: 100%; }
.order-line .line-qty-field { min-width: 0; }
.line-total { text-align: right; font-size: 12px; font-weight: 700; white-space: nowrap; }
.supplier-price-rows { display: grid; gap: 7px; }
.supplier-price-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(120px, .6fr) 30px; gap: 8px; }
.supplier-price-row input { min-width: 0; height: 36px; padding: 0 10px; border: 1px solid #dbe3de; border-radius: 6px; }
.finance-tables { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.finance-filter { align-items: center; }
.finance-filter label { color: var(--muted); }
.finance-filter input { min-width: 180px; }
.finance-foot { padding: 0 18px 15px; margin: 0; color: var(--muted); font-size: 12px; }
@media (max-width: 900px) {
  .finance-tables { grid-template-columns: 1fr; }
  .wide-modal { width: min(820px, calc(100vw - 28px)); }
  .lines-header { display: none; }
  .order-line { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .line-product-box { grid-column: 1 / -1; }
  .line-remark-field { grid-column: 1 / -1; }
  .order-line label > span { display: block; }
  .line-total { grid-column: 1; text-align: left; align-self: center; }
  .order-line > .remove-line { grid-column: 2; justify-self: end; }
}
@media (max-width: 520px) {
  .wide-modal { width: calc(100vw - 16px); }
  .modal { padding: 16px; }
  .supplier-price-row { grid-template-columns: minmax(0, 1fr) 30px; }
  .supplier-price-row .supplier-price { grid-column: 1; grid-row: 2; }
  .supplier-price-row .remove-line { grid-column: 2; grid-row: 1 / 3; align-self: center; }
  .finance-filter input { min-width: 0; }
}
.detail-total strong { margin-left: 10px; font-size: 23px; color: var(--ink); }
.danger-button { border: 1px solid #f1ccc5; color: #c15b4d; background: #fff7f4; padding: 0 13px; height: 38px; border-radius: 7px; white-space: nowrap; }
.danger-button:hover { background: #ffe9e1; }
.settings-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.settings-fields { margin-top: 25px; }
.about-copy { margin: 18px 0; color: #6b7e71; line-height: 1.9; font-size: 13px; }
.demo-feature-list { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; color: var(--green-dark); font-size: 12px; margin-top: 25px; }
@media (max-width: 1080px) {
  .sidebar { width: 190px; }
  .main-content { width: calc(100% - 190px); margin-left: 190px; }
  .topbar { padding: 0 24px; }
  .page-container { padding: 26px 24px 42px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .global-search { width: 210px; }
  .breadcrumb > span { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 740px) {
  .sidebar { width: 260px; transform: translateX(-280px); visibility: hidden !important; transition: transform .22s ease; }
  .sidebar.open { transform: translateX(0); visibility: visible !important; box-shadow: 10px 0 30px rgba(0,0,0,.18); }
  .main-content { width: 100%; margin-left: 0; }
  .topbar { height: 64px; padding: 0 16px; gap: 12px; }
  .mobile-menu { display: block; }
  .breadcrumb span, .breadcrumb i { display: none; }
  .global-search { display: none; }
  .top-actions { margin-left: auto; }
  .page-container { padding: 22px 16px 32px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-heading h1 { font-size: 23px; }
  .page-heading-actions { width: 100%; }
  .page-heading-actions button { flex: 1; }
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { min-height: 124px; }
  .dashboard-card, .recent-card { padding: 17px; }
  .card-title-row { align-items: flex-start; }
  .data-table th, .data-table td { padding: 11px 9px; }
  .filter-bar { align-items: stretch; }
  .filter-bar input, .filter-bar select, .filter-bar button { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .form-field.full { grid-column: auto; }
  .order-line { grid-template-columns: minmax(0,1fr) 63px 67px 28px; }
  .modal { padding: 20px; }
  .inline-demo { margin: 9px 0 0; display: table; }
  .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  .stat-card { padding: 15px; min-height: 150px; }
  .stat-value { font-size: 24px; }
  .stat-icon { width: 26px; height: 26px; right: 13px; top: 13px; font-size: 14px; }
  .stat-label { font-size: 12px; }
  .stat-foot { font-size: 12px; line-height: 1.6; }
  .stat-card.blue .stat-value { font-size: 22px; }
  .page-heading-actions { flex-wrap: wrap; }
  .page-heading-actions button { font-size: 12px; padding: 0 10px; min-width: 90px; }
  .table-toolbar { align-items: flex-start; padding: 15px; gap: 12px; flex-wrap: wrap; }
  .table-summary { font-size: 12px; }
  .table-scroll .data-table { min-width: 760px; }
  .search-input, .search-input input { width: 100%; min-width: 0; }
  .settings-layout { grid-template-columns: 1fr; }
  .checkbox-label { width: 100%; }
  .checkbox-label input { width: auto !important; }
  .lines-header { display: none; }
  .order-line { grid-template-columns: 1fr 1fr 28px; gap: 10px; }
  .order-line > div:first-child { grid-column: 1 / 3; grid-row: 1; }
  .order-line > .remove-line { grid-column: 3; grid-row: 1; }
  .order-line > .line-qty { grid-column: 1; grid-row: 2; }
  .order-line > .line-price { grid-column: 2; grid-row: 2; }
  .order-line > .line-remark { grid-column: 1 / 4; grid-row: 3; }
  .order-line > .line-total { grid-column: 1 / 4; grid-row: 4; }
  .order-line > .line-qty, .order-line > .line-price { min-width: 0; }
  .helper-row { align-items: flex-start; gap: 10px; font-size: 12px; }
  .helper-row .link-button { white-space: nowrap; }
  .modal-footer { flex-wrap: wrap; }
  .modal-total { width: 100%; margin-bottom: 8px; }
  .modal-footer .danger-button { margin-right: auto; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-heading { font-size: 16px; }
}

@media (max-width: 740px) {
  .order-line { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .order-line > div:first-child { grid-column: 1 / -1; grid-row: auto; }
  .order-line > .remove-line { grid-column: 2; grid-row: auto; }
  .order-line > .line-total { grid-column: 1; grid-row: auto; }
  .line-remark-field { grid-column: 1 / -1; }
  .finance-tables { grid-template-columns: 1fr; }
  .finance-filter label, .finance-filter input, .finance-filter button { width: 100%; }
}
.line-product-name { display: block; min-width: 0; margin: 0 2px; overflow: hidden; color: #596b60; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.order-line .line-product-search { width: 100%; min-width: 0; }
.export-filter { align-items: end; }
.export-date-field { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.export-date-field input { min-width: 160px; }
.range-separator { padding-bottom: 10px; color: var(--muted); }
.export-count { margin-left: auto; color: var(--muted); font-size: 12px; }
.export-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.export-option { min-height: 205px; padding: 22px; display: flex; flex-direction: column; justify-content: space-between; }
.export-kicker { color: var(--green); font-size: 12px; font-weight: 700; letter-spacing: .08em; }
.export-option h2 { margin: 10px 0 7px; font-size: 17px; }
.export-option p { max-width: 460px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.8; }
.export-option-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 20px; color: var(--muted); font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 740px) {
  .export-filter { align-items: stretch; }
  .export-date-field, .export-date-field input { width: 100%; }
  .range-separator { display: none; }
  .export-count { width: 100%; margin-left: 0; }
  .export-options { grid-template-columns: 1fr; }
  .export-option { min-height: 185px; padding: 18px; }
}
/* Stock entry and batch inbound review. */
.stock-product-search { width:100%; margin-bottom:8px; }
.inbound-workflow { margin-top:16px; padding:12px 16px; border:1px solid #cbe6d9; border-radius:8px; background:#effaf4; color:#186445; line-height:1.7; }
.inbound-review-scroll { margin-top:18px; }
.inbound-review-table { min-width:1000px; }
.inbound-review-table td { vertical-align:top; }
.inbound-review-table input { width:100%; min-width:0; min-height:40px; padding:9px 10px; border:1px solid var(--line); border-radius:8px; background:#fff; color:var(--ink); font:inherit; }
.inbound-review-table input:focus { outline:2px solid #a4ddbf; outline-offset:1px; }
.inbound-review-table .field-hint { display:block; margin-top:6px; white-space:normal; line-height:1.5; }
.inbound-review-table th:first-child { min-width:120px; }
.inbound-review-table th:nth-child(2) { min-width:240px; }
.inbound-review-table th:nth-child(3),.inbound-review-table th:nth-child(4) { min-width:105px; }
.inbound-review-table th:nth-child(5),.inbound-review-table th:nth-child(6) { min-width:145px; }
.inbound-review-table .is-unresolved { color:#b44a24; }
.inbound-review-table .unit-mismatch { color:#b44a24; font-weight:600; }
@media (max-width:700px) { .inbound-workflow { font-size:12px; } }
.offline-auth:not(.offline-authenticated) .app-shell { display:none; }
.nav-item[hidden] { display:none!important; }
.auth-screen { min-height:calc(100vh - 48px); display:grid; place-items:center; padding:24px; background:radial-gradient(at 15% 15%,#dcefe2,transparent 60%),#f4f7f5; }
.auth-card { width:min(460px,100%); padding:36px; border:1px solid #e1eae4; border-radius:18px; background:#fff; box-shadow:0 20px 80px #16452b12; }
.auth-brand { display:flex; align-items:center; gap:10px; font-size:24px; font-weight:800; color:#087947; margin-bottom:24px; }
.signin-mark { display:grid; place-items:center; width:42px; height:42px; border-radius:12px; background:#0c9b5b; color:#fff; font-size:16px; }
.auth-card h1 { font-size:24px; margin:0 0 10px; }
.auth-card p { color:#65776b; line-height:1.7; }
.auth-card label { display:grid; gap:9px; margin-top:20px; font-weight:600; }
.auth-card input,.offline-user-form input,.offline-user-form select,.offline-account-row select { width:100%; height:42px; border:1px solid #dae5de; border-radius:8px; padding:0 12px; background:#fff; font:inherit; }
.auth-card button { width:100%; padding:13px; }
.auth-error { color:#b83535!important; min-height:22px; font-size:13px; }
.signin-demo-accounts { display:grid; gap:6px; margin-top:20px; padding:14px; background:#f2f8f4; border-radius:9px; color:#486354; font-size:13px; }
.signin-note { font-size:12px; margin-bottom:0; }
.offline-account-card { margin-top:24px; }
.offline-account-row { display:flex; justify-content:space-between; align-items:center; gap:14px; padding:16px 0; border-bottom:1px solid var(--line); }
.offline-account-row small { display:block; margin-top:6px; color:var(--muted); }
.offline-account-row>div:last-child { display:flex; align-items:center; gap:8px; }
.offline-account-row select { width:140px; }
.offline-account-actions { flex-wrap:wrap; justify-content:flex-end; }
.offline-account-actions button { padding:8px 10px; white-space:nowrap; }
.offline-user-form { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; margin-top:22px; }
.offline-user-form h3,.offline-user-form .auth-error { grid-column:1/-1; }
.offline-user-form label { display:grid; gap:8px; }
@media (max-width:700px) { .auth-card { padding:25px; } .offline-user-form { grid-template-columns:1fr; } .offline-account-row { align-items:flex-start; flex-direction:column; } }
@media (max-width:740px) { .topbar { height:auto; min-height:64px; flex-wrap:wrap; padding-top:10px; padding-bottom:10px; } .top-actions { min-width:0; flex-wrap:wrap; justify-content:flex-end; gap:7px; } .top-actions .ghost-button { padding:7px; font-size:12px; } }

/* Order entry prioritises the product name; code and supplier stay compact. */
.wide-modal:has(#orderLines) { width:min(1440px,calc(100vw - 32px)); }
.order-lines { counter-reset:order-row; }
.lines-header, .order-line { grid-template-columns:28px minmax(260px,2.6fr) 76px 76px 86px 86px minmax(110px,1fr) 88px 68px; }
.order-line { padding:12px 10px; gap:10px; }
.line-sequence { color:var(--muted); font-size: 12px; text-align:center; counter-increment:order-row; }
.line-sequence::before { content:counter(order-row); }
.line-sequence-heading { font-size: 12px; }
.line-product-box { display:grid; grid-template-columns:82px minmax(0,1fr); gap:6px 10px; align-items:center; }
.order-line .line-product-search { grid-column:1; height:30px; font-size:13px; padding:0 6px; }
.line-product-box .line-product-name { grid-column:2; font-size:19px; line-height:1.45; font-weight:650; color:#203b2d; white-space:normal; overflow-wrap:anywhere; }
.line-product-box .line-stock { grid-column:2; font-size: 12px; }
.order-line .line-supplier { grid-column:1/-1; width:min(100%,300px); height:29px; font-size:12px; padding:0 6px; }
.order-line input { font-size:16px; }
.order-line .line-cost { font-size:14px; }
.return-order-search { display:flex; gap:10px; margin-bottom:16px; }
.return-order-search input { flex:1; min-width:0; height:40px; border:1px solid var(--line); border-radius:6px; padding:0 12px; font:inherit; }
.return-items { min-width:820px; }
.return-items .return-qty { width:100px; }
.return-items input,.return-items select { border:1px solid var(--line); border-radius:6px; padding:9px 7px; font:inherit; background:#fff; }
.return-product { min-width:180px; font-weight:600; }
.return-explanation { color:var(--muted); font-size:13px; line-height:1.8; }
.return-history { margin-top:20px; padding:16px; background:#f4f8f5; border-radius:8px; overflow-wrap:anywhere; }
.return-history p { font-size:13px; line-height:1.8; }
.return-finance-summary { margin:16px 0; padding:16px; line-height:1.8; border:1px solid var(--line); border-radius:8px; background:#fff; }
.return-finance-summary .stats-grid { margin-top:12px; }
@media (max-width:1150px) and (min-width:901px) {
  .lines-header,.order-line { grid-template-columns:22px minmax(200px,2fr) 62px 66px 72px 72px minmax(80px,1fr) 72px 64px; gap:6px; }
  .line-product-box { grid-template-columns:65px minmax(0,1fr); gap:5px; }
  .line-product-box .line-product-name { font-size:17px; }
}
@media (max-width:900px) {
  .lines-header { display:none; }
  .order-line { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; padding:14px; position:relative; }
  .order-line > .line-product-box { grid-column:1/-1; grid-row:auto; padding-right:20px; }
  .line-product-box .line-product-name { font-size:19px; }
  .line-sequence { position:absolute; top:17px; right:12px; }
  .order-line .line-remark-field { grid-column:1/-1; }
  .order-line > .line-total { grid-column:1; grid-row:auto; }
  .order-line > .remove-line { grid-column:2; grid-row:auto; justify-self:end; }
}
/* School quotations and packaging controls follow the existing form layout. */
.line-actions { display:flex; flex-direction:column; gap:8px; align-items:center; }
.line-move-buttons { display:flex; gap:4px; }
.line-move { border:1px solid var(--line); background:#fff; color:var(--green); border-radius:5px; min-width:28px; height:30px; cursor:pointer; font-size:18px; }
.line-move:disabled { opacity:.3; cursor:default; }
.pending-weight .line-qty { border-color:#c08720; background:#fff8e9; }
.pending-weight .line-qty-field::after { content:'待称重'; font-size: 12px; color:#8b5a13; }
.pending-weight-warning { background:#fff8e9; padding:12px; color:#8b5a13; border:1px solid #e6c787; border-radius:8px; }
.duplicate-product-warning { background:#fff5e5; border:1px solid #e7bd72; border-radius:8px; color:#805014; padding:10px 12px; line-height:1.6; overflow-wrap:anywhere; }
.duplicate-product { border-color:#dda444; background:#fffaf0; }
.pending-quantity-label { color:#8b5a13; font-size:12px; }
@media(max-width:900px) { .order-line > .line-actions { grid-column:2; grid-row:auto; justify-self:end; flex-direction:row; } .line-move { min-width:34px; height:34px; } }
.line-unit-bar { display:flex; grid-column:1/-1; align-items:center; gap:8px; min-width:0; }
.line-unit-bar .line-unit { width:180px; max-width:70%; padding:5px 7px; font-size:13px; }
.line-price-source { font-size: 12px; color:#64746b; overflow-wrap:anywhere; }
.unit-conversion-section { margin-top:20px; border-top:1px solid #e1e9e4; padding-top:16px; }
.missing-quote-units { margin:12px 0; padding:12px; background:#fff8e9; border:1px solid #e6c787; border-radius:7px; }
.missing-quote-units .form-hint { color:#805014; }
.missing-quote-units button { margin:4px 6px 0 0; }
.unit-conversion-row { display:flex; align-items:center; gap:8px; margin:8px 0; }
.unit-conversion-row input { width:110px; min-width:0; }
.unit-conversion-row .conversion-factor { width:120px; }
.save-school-prices { margin-top:8px; font-size:12px; }
.price-import-school { padding:12px 0; border-bottom:1px solid #e2e8e4; }
.price-import-school h3 { margin:4px 0; }
.price-import-school p { font-size:12px; color:#697a71; }
.price-import-school select { width:100%; margin:6px 0; }
.page-heading:has(+ #schoolPricesFilter) { align-items:flex-start; gap:18px; }
.page-heading:has(+ #schoolPricesFilter) .page-heading-actions { flex-wrap:wrap; justify-content:flex-end; }
.quote-import-preview { max-height:420px; overflow:auto; border:1px solid var(--line); border-radius:7px; }
.quote-import-preview th { position:sticky; top:0; z-index:1; background:#f1f6f3; }
.quote-import-preview td { overflow-wrap:anywhere; min-width:90px; }
.quote-preview-summary { display:flex; flex-wrap:wrap; gap:12px 22px; padding:14px; background:#f1f6f3; border-radius:7px; }
.school-price-form input[type="file"] { height:auto; padding:12px; }
.quote-unit-conversion {padding:14px;background:#f3faf6;border:1px solid #cee7d8;border-radius:8px;}
.quote-unit-conversion[hidden] {display:none;}
.quote-unit-equation {display:flex;align-items:center;gap:10px;flex-wrap:wrap;}
.quote-unit-equation input {width:150px;min-width:0;}
.recognized-unit-select { width:100%; margin-top:4px; font-size:12px; }
.delete-explanation { line-height:1.8; }
@media(max-width:600px) { .unit-conversion-row { gap:5px; } .unit-conversion-row input { width:74px; } .unit-conversion-row .conversion-factor { width:85px; } .line-unit-bar .line-unit { width:125px; } }
/* School prices remain separate from the catalog's generic price. */
.catalog-sale-price{min-width:210px;max-width:310px;text-align:left;white-space:normal}
.catalog-school-price{display:flex;flex-wrap:wrap;gap:3px 10px;justify-content:space-between;margin:4px 0;line-height:1.5}
.catalog-school-price>span{max-width:170px;overflow-wrap:anywhere}
.catalog-school-price>strong{white-space:nowrap;color:#087e56}
.catalog-generic-price{display:block;font-size:13px;white-space:nowrap}
.catalog-price-filter{display:flex;flex-direction:column;gap:5px;font-size:12px;color:#65756f;min-width:180px}
.catalog-price-filter select{min-height:42px;width:100%}
#orderZeroPriceNotice{font-weight:600;line-height:1.6;margin:10px 0 0}
.order-product-choices{position:absolute;left:0;right:0;top:100%;z-index:50;max-height:310px;overflow-y:auto;background:#fff;border:1px solid #dce6e0;border-radius:8px;box-shadow:0 8px 24px #102b2026;padding:5px}
.line-product-box:has(.order-product-choices:not([hidden])){position:relative;z-index:60}
.order-product-choice{display:flex;justify-content:space-between;gap:12px;width:100%;text-align:left;background:#fff;border:0;border-radius:5px;padding:9px 10px;color:#20372b;font-size:13px}
.order-product-choice:hover,.order-product-choice.highlighted{background:#e8f7ef}
.order-product-choice small,.recognition-product-choice small{display:block;color:#738178;font-size: 12px;margin-top:4px}
.order-product-choice em{white-space:nowrap;font-size: 12px;color:#087e56;font-style:normal}
.recognition-product-choices{display:flex;flex-direction:column;gap:5px;margin-top:7px;max-height:210px;overflow-y:auto}
.recognition-product-choice{border:1px solid #dde9e1;background:#f7fbf8;border-radius:5px;padding:7px;text-align:left;color:#20372b;font-size:12px}

/* Insert controls remain available beside each order item. */
.order-entry-toolbar { display:flex; align-items:center; gap:12px; margin-top:14px; }
.order-entry-toolbar > span { font-size:12px; color:var(--muted); }
.line-sequence { display:flex; flex-direction:column; align-items:center; gap:8px; }
.line-sequence::before { order:1; }
.line-insert { width:28px; height:30px; border:1px solid #b8dac8; border-radius:5px; background:#f1faf5; color:var(--green); font-size:20px; cursor:pointer; }
@media(max-width:900px){ .order-entry-toolbar { align-items:flex-start; } .order-line > .line-product-box { padding-right:36px; } }

.inbound-product-cell { position:relative;min-width:260px; }
.inbound-product-choices { display:grid;gap:3px;padding:5px;background:#fff;border:1px solid var(--line);border-radius:6px;max-height:240px;overflow:auto; }
.inbound-review-row > td:first-child .line-insert { margin-right:8px;vertical-align:middle; }
.inbound-review-table .inbound-unit-select { display:block;width:100%;min-width:95px;height:36px;margin-top:6px;padding:6px;border:1px solid var(--line);border-radius:6px;background:#fff;font:inherit; }
.purchase-price-sheet { max-width:420px; }
.purchase-price-partial { display:flex;gap:8px;align-items:flex-start;padding:12px;background:#fff8ed;border:1px solid #efd2a3;border-radius:8px;margin:12px 0;line-height:1.6; }
.purchase-price-partial input { margin-top:5px; }

/* Purchase directly from a sales order: receipt rows scroll, actions stay visible. */
.inbound-modal { display:flex; flex-direction:column; overflow:hidden; max-height:calc(100dvh - 40px); }
.inbound-modal #modalForm { display:flex; flex:1 1 auto; flex-direction:column; min-height:0; overflow:hidden; }
.inbound-modal .modal-header,.inbound-modal .modal-footer { flex:0 0 auto; background:#fff; }
.inbound-modal .modal-body { flex:1 1 auto; min-height:80px; overflow:auto; overscroll-behavior:contain; scrollbar-gutter:stable; }
.inbound-modal .modal-footer { flex-wrap:wrap; }
.procurement-source { display:flex; flex-wrap:wrap; gap:8px 18px; padding:12px 14px; background:#f0f8f3; border-radius:8px; margin-bottom:14px; }
.procurement-source small { flex-basis:100%; color:var(--muted); }
.procurement-source details { flex-basis:100%; font-size:13px; }
.procurement-source summary { cursor:pointer; color:#236b44; }
.procurement-source ul { max-height:150px; overflow:auto; margin:8px 0 0; padding-left:20px; }
.daily-demand { display:block; margin-top:5px; font-size:12px; color:var(--muted); white-space:normal; }
.daily-demand.unit-mismatch { color:#a35e13; }
.procurement-sync { display:flex; align-items:center; gap:8px; padding:16px 0; }
.procurement-complete { padding:10px 16px; margin:0; background:#f0f8f3; color:#236b44; }
.procurement-complete small { display:block; color:var(--muted); }
.order-procurement-table { min-width:910px; }
.order-procurement-table th:first-child { min-width:42px; width:42px; }
.order-procurement-table td:first-child { text-align:center; }
.order-procurement-table th:nth-child(2) { min-width:230px; }
.order-procurement-table th:nth-child(5),.order-procurement-table th:nth-child(6) { min-width:120px; }
.order-procurement-table:not(.show-procurement-extra) :is(th,td):nth-child(6),.order-procurement-table:not(.show-procurement-extra) :is(th,td):nth-child(7) { display:none; }
.order-procurement-table:not(.show-procurement-extra) { min-width:680px; }

/* Quantity changes are explicit keyboard entry, never native 0.001 steppers. */
.line-qty,.recognized-qty { appearance:textfield; -moz-appearance:textfield; }
.line-qty::-webkit-inner-spin-button,.line-qty::-webkit-outer-spin-button,
.recognized-qty::-webkit-inner-spin-button,.recognized-qty::-webkit-outer-spin-button { -webkit-appearance:none; margin:0; }

/* Shared screen typography and alignment; printed delivery notes have their own stylesheet. */
:root { --font-caption:12px; --font-label:13px; --control-height:40px; }
input, select, textarea { line-height:1.5; }
button { line-height:1.4; }
.brand-mark, .sidebar-bottom { flex-shrink:0; }
.main-nav { min-height:0; overflow-y:auto; }
.brand-text, .user-mini > span:last-child, .page-heading > div, .modal-header > div { min-width:0; }
.page-heading-actions { flex-wrap:wrap; align-items:center; }
.dashboard-grid > *, .finance-tables > *, .settings-layout > * { min-width:0; }
.sales-chart .bar-wrap { min-width:0; }
.page-heading p, .modal-header p, .card-subtitle, .detail-grid strong { overflow-wrap:anywhere; }
.modal-close { flex:0 0 31px; display:grid; place-items:center; padding:0; line-height:1; }
.outline-button, .primary-button, .ghost-button, .danger-button { min-height:38px; height:auto; padding-top:8px; padding-bottom:8px; }
.link-button { display:inline-flex; align-items:center; justify-content:center; min-height:30px; padding:4px 6px; vertical-align:middle; }
.data-table th, .data-table td { vertical-align:middle; line-height:1.5; }
.data-table .cell-note { line-height:1.5; white-space:normal; }
.data-table td:last-child .link-button + .link-button { margin-left:4px; }
.stat-value, .data-table .number, .line-total, .modal-total strong, .detail-total strong { font-variant-numeric:tabular-nums; }
.filter-bar { align-items:flex-end; }
.filter-bar input, .filter-bar select, .form-field input:not([type=checkbox]):not([type=radio]):not([type=file]), .form-field select { height:var(--control-height); min-width:0; }
.filter-bar > button, .filter-bar > .search-input { min-height:var(--control-height); }
.filter-bar .search-input { height:var(--control-height); }
.search-input input { width:100%; height:100%; min-height:0; background:transparent; }
.form-field input, .form-field select, .form-field textarea { width:100%; }
.form-field > label { flex:0 0 auto; }
.form-field > small, .form-field > .field-hint { line-height:1.5; }
.checkbox-label, .form-field .checkbox-label { display:flex; align-items:flex-start; gap:8px; font-size:var(--font-label); font-weight:400; line-height:20px; }
.checkbox-label input[type=checkbox], .form-field input[type=checkbox], .form-field input[type=radio] { width:16px; height:16px; min-width:16px; margin:2px 0 0; padding:0; flex:0 0 16px; }
.supplier-price-row { align-items:start; }
.supplier-price-row .remove-line { align-self:center; }
.unit-conversion-row { flex-wrap:wrap; }
.unit-conversion-row input { flex:0 1 110px; }
.unit-conversion-row .conversion-factor { flex-basis:120px; }
.unit-conversion-row > span { overflow-wrap:anywhere; }
.detail-grid { align-items:start; }
.detail-grid strong { line-height:1.6; }
.detail-heading { flex-wrap:wrap; gap:8px; }
.detail-modal .detail-fixed-header { max-height:36vh; overflow:auto; }
.detail-modal .detail-fixed-summary { max-height:24vh; overflow:auto; }
.detail-modal .detail-items-scroll { min-height:0; }
.detail-total, .modal-total { display:flex; align-items:baseline; flex-wrap:wrap; gap:4px; }
.detail-total { justify-content:flex-end; }
.export-option-footer, .helper-row, .recognition-summary { flex-wrap:wrap; align-items:center; }
.export-option-footer > span, .helper-row > span, .recognition-summary > span { min-width:0; overflow-wrap:anywhere; }
.recognition-row { align-items:start; }
.recognition-product-control { align-items:start; }
.recognition-source { padding-top:7px; }
.recognition-row .recognized-product, .recognition-row .recognized-qty, .recognition-row .recognized-price { height:38px; }
.recognized-unit-select { height:34px; padding:4px 7px; border:1px solid #dbe3de; border-radius:5px; background:#fff; }
.recognition-row .recognition-remove { margin-top:6px; }
.order-line > label { position:relative; align-self:center; align-content:start; }
.order-line .line-qty, .order-line .line-cost, .order-line .line-margin, .order-line .line-price, .order-line .line-remark { height:38px; line-height:1.5; }
.pending-weight .line-qty-field::after { position:absolute; top:calc(100% + 3px); left:0; line-height:18px; }
.order-line .line-remark { font-size:14px; }
.line-product-box .line-stock { margin-top:0; line-height:1.5; }
.line-price-source { line-height:1.5; }
.line-unit-bar .line-unit { height:36px; padding-top:3px; padding-bottom:3px; }
.lines-header { gap:10px; padding-left:11px; padding-right:11px; line-height:18px; }
.order-line .line-total { align-self:center; }
@media(min-width:901px) {
  .order-line > label > span { display:none; }
  .order-entry-fixed-header > .form-grid { grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(170px,.65fr); align-items:start; }
}
@media(min-width:901px) and (max-width:1150px) { .lines-header { gap:6px; } }
@media(max-width:900px) {
  .pending-weight .line-qty-field, .pending-weight .line-cost-field { margin-bottom:21px; }
}
@media(max-width:1200px) and (min-width:741px) { .global-search { display:none; } }
@media(max-width:1000px) and (min-width:741px) {
  .topbar { height:auto; min-height:76px; flex-wrap:wrap; gap:12px; padding-top:12px; padding-bottom:12px; }
  .top-actions { flex-wrap:wrap; justify-content:flex-end; margin-left:auto; }
  .breadcrumb > span { display:none; }
  .breadcrumb > i { display:none; }
}
@media(max-width:740px) {
  .site-footer { width:100%; margin-left:0; }
  .detail-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
  .page-heading-actions > button { flex:1 1 130px; }
  .filter-bar > *, .filter-bar > label { max-width:100%; }
  .filter-bar input[type=date] { width:100%; max-width:100%; }
  .filter-bar .checkbox-label { width:100%; }
  .recognition-source { padding-top:0; }
  .order-line > label > span { line-height:18px; }
  .export-option-footer { gap:10px; }
  .export-option-footer > button { width:100%; }
}
@media(max-width:360px) {
  .stats-grid { grid-template-columns:1fr; }
  .top-actions { gap:5px; }
  .top-actions .outline-button { padding-left:8px; padding-right:8px; }
}
