:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --ink: #18211d;
  --muted: #68736d;
  --line: #dde3df;
  --line-strong: #cbd4cf;
  --green: #16734a;
  --green-dark: #0f5938;
  --green-soft: #e7f4ed;
  --blue: #2468a2;
  --blue-soft: #eaf2f8;
  --amber: #a66315;
  --amber-soft: #fff3dd;
  --red: #bd3b31;
  --red-soft: #fbecea;
  --shadow: 0 1px 2px rgb(18 35 27 / 4%), 0 8px 24px rgb(18 35 27 / 5%);
  --sidebar: 228px;
  --radius: 8px;
  color-scheme: light;
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); min-width: 320px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgb(36 104 162 / 18%); outline-offset: 1px; }
svg { width: 18px; height: 18px; stroke-width: 1.8; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: var(--sidebar); display: flex; flex-direction: column; padding: 22px 14px 16px; background: #14241d; color: #fff; }
.brand { display: flex; align-items: center; gap: 11px; height: 46px; padding: 0 10px; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; background: #e9f7ef; color: var(--green-dark); border-radius: 8px; }
.brand-mark svg { width: 21px; height: 21px; }
.brand-copy { display: grid; gap: 1px; }
.brand-copy strong { font-size: 17px; letter-spacing: 0; }
.brand-copy small { color: #96a89f; font-size: 11px; }
.nav-list { display: grid; gap: 5px; margin-top: 31px; }
.nav-item { height: 43px; display: flex; align-items: center; gap: 12px; width: 100%; border: 0; border-radius: 6px; padding: 0 12px; color: #aebdb5; background: transparent; text-align: left; transition: background .16s, color .16s; }
.nav-item:hover { background: rgb(255 255 255 / 6%); color: #fff; }
.nav-item.active { background: #236c4c; color: #fff; }
.nav-item span { font-size: 14px; font-weight: 500; }
.sidebar-foot { margin-top: auto; border-top: 1px solid rgb(255 255 255 / 9%); padding: 16px 8px 0; }
.storage-status { display: flex; gap: 10px; color: #c3d0c9; }
.storage-status > svg { flex: none; color: #71c99c; margin-top: 2px; }
.storage-status span { display: grid; gap: 3px; }
.storage-status strong { font-size: 12px; font-weight: 500; }
.storage-status small { font-size: 10px; color: #83978d; line-height: 1.5; }
.text-button { display: flex; align-items: center; gap: 8px; border: 0; color: #aebdb5; background: transparent; padding: 10px 0 0; font-size: 12px; }
.text-button:hover { color: #fff; }
.text-button.danger:hover { color: #ffaaa3; }

.main-column { padding-left: var(--sidebar); min-height: 100vh; }
.topbar { height: 92px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 clamp(20px, 3.2vw, 46px); background: rgb(255 255 255 / 94%); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 15; backdrop-filter: blur(12px); }
.topbar h1 { margin: 4px 0 0; font-size: 23px; line-height: 1.15; letter-spacing: 0; }
.eyebrow { margin: 0; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0; }
.topbar-actions, .toolbar-actions, .filter-group { display: flex; align-items: center; gap: 10px; }
main { padding: 26px clamp(20px, 3.2vw, 46px) 48px; max-width: 1600px; margin: 0 auto; }
.view { display: none; animation: view-in .22s ease-out; }
.view.active { display: block; }
@keyframes view-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.button, .icon-button { display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; transition: background .16s, border-color .16s, color .16s, transform .08s; }
.button { min-height: 40px; gap: 8px; border-radius: 6px; padding: 0 15px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.button:active, .icon-button:active { transform: translateY(1px); }
.button-primary { background: var(--green); color: #fff; border-color: var(--green); }
.button-primary:hover { background: var(--green-dark); border-color: var(--green-dark); }
.button-secondary { color: var(--ink); background: var(--surface); border-color: var(--line-strong); }
.button-secondary:hover { border-color: var(--green); color: var(--green); }
.button-ghost { color: var(--muted); background: transparent; }
.button-ghost:hover { color: var(--ink); background: var(--surface-soft); }
.icon-button { width: 34px; height: 34px; border-radius: 6px; color: var(--muted); background: transparent; }
.icon-button:hover { color: var(--ink); background: var(--surface-soft); }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.metric-card { min-height: 132px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.metric-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.metric-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 7px; }
.metric-icon.green { color: var(--green); background: var(--green-soft); }
.metric-icon.blue { color: var(--blue); background: var(--blue-soft); }
.metric-icon.amber { color: var(--amber); background: var(--amber-soft); }
.metric-icon.red { color: var(--red); background: var(--red-soft); }
.metric-value { margin: 15px 0 8px; font-size: clamp(22px, 2vw, 28px); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.metric-foot { color: var(--muted); font-size: 11px; }
.metric-foot strong { color: var(--green); font-weight: 600; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .85fr); gap: 16px; align-items: start; margin-bottom: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; }
.panel-header h2 { margin: 0; font-size: 15px; line-height: 1.3; letter-spacing: 0; }
.panel-header p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.segmented { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); }
.segmented button { min-width: 46px; height: 28px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 11px; }
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(20 36 29 / 10%); font-weight: 600; }
.trend-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0 20px 8px; border-block: 1px solid var(--line); }
.trend-summary-item { min-width: 0; padding: 13px 12px; border-right: 1px solid var(--line); }
.trend-summary-item:first-child { padding-left: 0; }
.trend-summary-item:last-child { padding-right: 0; border-right: 0; }
.trend-summary-item small { display: block; margin-bottom: 6px; color: var(--muted); font-size: 9px; }
.trend-summary-item strong { display: block; overflow: hidden; color: var(--ink); font-size: 17px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.trend-summary-item.profit strong { color: var(--green); }
.chart-wrap { position: relative; height: 285px; padding: 4px 18px 12px; }
.trend-breakdown { margin-top: 2px; border-top: 1px solid var(--line); }
.trend-breakdown-row { min-height: 34px; display: grid; grid-template-columns: minmax(100px, 1fr) minmax(100px, .72fr) minmax(100px, .72fr); align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid var(--line); color: #445048; font-size: 10px; font-variant-numeric: tabular-nums; }
.trend-breakdown-row:last-child { border-bottom: 0; }
.trend-breakdown-row.heading { min-height: 31px; background: var(--surface-soft); color: var(--muted); font-size: 9px; font-weight: 600; }
.trend-breakdown-row span:nth-child(n+2) { text-align: right; }
.trend-breakdown-row strong { color: var(--green); font-weight: 600; }
.alert-list { padding: 0 20px 14px; }
.alert-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 13px 0; border-top: 1px solid var(--line); }
.product-avatar { width: 34px; height: 34px; display: grid; place-items: center; flex: none; border: 1px solid #dfe7e2; border-radius: 7px; color: var(--blue); background: var(--blue-soft); object-fit: cover; font-size: 12px; font-weight: 700; }
.alert-row strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
.alert-row small { color: var(--muted); font-size: 10px; }
.stock-count { color: var(--red); text-align: right; font-size: 12px; font-weight: 700; }
.stock-count small { display: block; font-weight: 400; }
.all-clear { min-height: 184px; display: grid; place-items: center; align-content: center; gap: 8px; color: var(--muted); text-align: center; }
.all-clear svg { width: 28px; height: 28px; color: var(--green); }
.all-clear strong { font-size: 13px; color: var(--ink); }
.recent-panel .table-scroll { max-height: 330px; }

.table-scroll { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th { height: 42px; padding: 0 16px; background: var(--surface-soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; font-weight: 600; text-align: left; white-space: nowrap; }
td { height: 58px; padding: 8px 16px; border-bottom: 1px solid var(--line); color: #344039; font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfb; }
.align-right { text-align: right; }
.money-positive { color: var(--green); font-weight: 600; }
.money-muted { color: var(--muted); }
.type-badge, .status-badge { display: inline-flex; align-items: center; gap: 5px; min-height: 24px; padding: 0 8px; border-radius: 4px; font-size: 10px; font-weight: 600; }
.type-badge.in { color: var(--blue); background: var(--blue-soft); }
.type-badge.out { color: var(--green); background: var(--green-soft); }
.type-badge.gift { color: var(--amber); background: var(--amber-soft); }
.status-badge.good { color: var(--green); background: var(--green-soft); }
.status-badge.low { color: var(--red); background: var(--red-soft); }
.product-cell { display: flex; align-items: center; gap: 10px; }
.product-cell span { display: grid; gap: 3px; }
.product-cell strong { max-width: 240px; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.product-cell small { color: var(--muted); font-size: 10px; }
.row-actions { display: flex; justify-content: flex-end; gap: 2px; }

.view-toolbar { min-height: 54px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.search-field { width: min(380px, 100%); height: 40px; display: flex; align-items: center; gap: 9px; padding: 0 12px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 6px; }
.search-field:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgb(36 104 162 / 10%); }
.search-field svg { flex: none; color: var(--muted); }
.search-field input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px; }
.select-control { height: 40px; padding: 0 34px 0 11px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink); font-size: 12px; }
.summary-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin-bottom: 16px; overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); }
.summary-item { min-height: 72px; padding: 13px 16px; background: var(--surface); }
.summary-item small { display: block; margin-bottom: 8px; color: var(--muted); font-size: 10px; }
.summary-item strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.table-panel { overflow: hidden; }
.empty-state { min-height: 280px; padding: 40px; place-items: center; align-content: center; text-align: center; color: var(--muted); }
.empty-state:not([hidden]) { display: grid; }
.empty-state svg { width: 32px; height: 32px; margin-bottom: 8px; color: var(--line-strong); }
.empty-state h3 { margin: 0; color: var(--ink); font-size: 14px; }
.empty-state p { margin: 6px 0 0; font-size: 11px; }

.entry-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(270px, .65fr); gap: 16px; align-items: start; }
.entry-form { overflow: hidden; }
.entry-form .panel-header { border-bottom: 1px solid var(--line); }
.entry-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 7px; }
.entry-icon.inbound { color: var(--blue); background: var(--blue-soft); }
.entry-icon.outbound { color: var(--green); background: var(--green-soft); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 20px; }
.field { display: grid; align-content: start; gap: 7px; color: #3b4740; font-size: 11px; }
.field > span { font-weight: 600; }
.field b { color: var(--red); }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink); font-size: 12px; transition: border .15s, box-shadow .15s; }
.field input, .field select { height: 41px; padding: 0 11px; }
.field textarea { padding: 11px; resize: vertical; min-height: 76px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgb(36 104 162 / 10%); outline: 0; }
.field small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.field-span-2 { grid-column: span 2; }
.outbound-mode { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.outbound-mode label { min-width: 0; cursor: pointer; }
.outbound-mode input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.outbound-mode label > span { height: 42px; display: flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--muted); font-size: 11px; font-weight: 600; }
.outbound-mode input:checked + span { border-color: var(--green); background: var(--green-soft); color: var(--green-dark); box-shadow: 0 0 0 2px rgb(22 115 74 / 8%); }
.outbound-mode input:focus-visible + span { outline: 3px solid rgb(36 104 162 / 18%); outline-offset: 1px; }
.field.gift-price .input-with-prefix { border-color: #e7c48d; background: var(--amber-soft); }
.field.gift-price input { color: var(--amber); background: transparent; font-weight: 600; }
.input-with-prefix, .input-with-suffix { display: flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; background: var(--surface); }
.input-with-prefix:focus-within, .input-with-suffix:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgb(36 104 162 / 10%); }
.input-with-prefix input, .input-with-suffix input { border: 0; border-radius: 0; box-shadow: none !important; }
.input-with-prefix em, .input-with-suffix em { flex: none; padding: 0 0 0 11px; color: var(--muted); font-style: normal; font-size: 12px; }
.input-with-suffix em { padding: 0 11px 0 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 15px 20px; border-top: 1px solid var(--line); background: var(--surface-soft); }
.order-summary { position: sticky; top: 118px; overflow: hidden; }
.summary-title { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.summary-title h2 { margin: 0; font-size: 15px; }
.summary-title p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.summary-lines { padding: 14px 20px; }
.summary-line { display: flex; justify-content: space-between; gap: 18px; padding: 9px 0; color: var(--muted); font-size: 11px; }
.summary-line strong { color: var(--ink); font-weight: 600; text-align: right; }
.summary-total { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 0 20px; padding: 17px 0; border-top: 1px solid var(--line); }
.summary-total span { color: var(--muted); font-size: 11px; }
.summary-total strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.profit-preview { margin: 0 20px 20px; padding: 12px; border-radius: 6px; background: var(--green-soft); color: var(--green-dark); font-size: 11px; }
.profit-preview strong { float: right; }
.profit-preview.gift { background: var(--amber-soft); color: var(--amber); }
.gift-cost-preview { margin: -8px 20px 20px; padding: 10px 12px; border-radius: 6px; background: var(--surface-soft); color: var(--muted); font-size: 11px; }
.gift-cost-preview strong { float: right; color: var(--ink); }
.mini-history { margin-top: 16px; overflow: hidden; }

.quick-outbound-section { margin-bottom: 20px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.section-heading h2 { margin: 0; font-size: 16px; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.quick-search { width: min(280px, 100%); }
.quick-product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; }
.quick-product-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow); }
.quick-product-image { width: 100%; aspect-ratio: 4 / 3; display: grid; place-items: center; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; object-fit: cover; background: #eef3f0; color: var(--green); font-size: 30px; font-weight: 700; }
.quick-product-body { padding: 11px; }
.quick-product-body h3 { min-height: 36px; margin: 0; overflow: hidden; color: var(--ink); font-size: 12px; line-height: 1.5; }
.quick-product-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 7px 0 10px; color: var(--muted); font-size: 10px; }
.quick-product-meta strong { color: var(--green-dark); font-size: 13px; }
.quick-product-actions { display: grid; grid-template-columns: minmax(0, 1fr) 40px; gap: 6px; }
.quick-product-card .button { width: 100%; padding-inline: 8px; }
.quick-product-card .gift-button { width: 40px; min-width: 40px; padding: 0; color: var(--amber); background: var(--amber-soft); border-color: #eed5ad; }
.quick-product-card .gift-button:hover { color: #805013; background: #ffe9c3; border-color: #d9ad67; }
.quick-product-card .button:disabled { cursor: not-allowed; border-color: var(--line); background: #edf0ee; color: #8c9691; }
.quick-empty { grid-column: 1 / -1; min-height: 130px; display: grid; place-items: center; align-content: center; gap: 7px; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: 7px; font-size: 11px; }
.quick-empty svg { width: 26px; height: 26px; }

.record-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.record-kpi { min-height: 84px; display: flex; align-items: center; gap: 13px; padding: 15px 17px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.record-kpi > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 7px; }
.record-kpi div { display: grid; gap: 5px; }
.record-kpi small { color: var(--muted); font-size: 10px; }
.record-kpi strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.records-toolbar .filter-group { flex: 1; }

dialog { width: min(600px, calc(100% - 28px)); max-height: calc(100vh - 28px); padding: 0; border: 0; border-radius: 8px; color: var(--ink); background: var(--surface); box-shadow: 0 24px 70px rgb(12 27 20 / 25%); }
dialog::backdrop { background: rgb(15 27 21 / 48%); backdrop-filter: blur(3px); }
.dialog-card { overflow-y: auto; max-height: calc(100vh - 28px); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; padding: 20px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 4px 0 0; font-size: 19px; }
.dialog-card .form-actions { position: sticky; bottom: 0; }
.image-uploader { display: flex; align-items: center; gap: 15px; padding: 12px; border: 1px dashed var(--line-strong); border-radius: 7px; background: var(--surface-soft); }
.image-preview { position: relative; width: 96px; height: 76px; display: grid; place-items: center; align-content: center; gap: 4px; flex: none; overflow: hidden; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--muted); cursor: pointer; }
.image-preview:hover { border-color: var(--green); color: var(--green); }
.image-preview img { width: 100%; height: 100%; object-fit: cover; }
.image-preview svg { width: 25px; height: 25px; }
.image-preview span { font-size: 9px; }
.image-preview.has-image::after { content: "更换图片"; position: absolute; inset: auto 0 0; padding: 5px 3px; background: rgb(15 35 26 / 78%); color: #fff; font-size: 9px; text-align: center; }
.image-upload-actions { min-width: 0; display: grid; gap: 8px; }
.image-upload-actions > div { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.image-upload-actions small { color: var(--muted); font-size: 10px; line-height: 1.5; }

.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 100; display: grid; gap: 8px; pointer-events: none; }
.toast { min-width: 260px; max-width: 360px; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 7px; background: #15251e; color: #fff; box-shadow: 0 12px 32px rgb(16 33 25 / 22%); font-size: 12px; animation: toast-in .2s ease-out; }
.toast.success svg { color: #79d1a3; }
.toast.error svg { color: #ff9e96; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.mobile-nav { display: none; }

@media (max-width: 1120px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .alert-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; }
  .entry-layout { grid-template-columns: minmax(0, 1.4fr) minmax(250px, .7fr); }
  .record-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  :root { --sidebar: 0px; }
  .sidebar { display: none; }
  .main-column { padding-left: 0; }
  .topbar { height: 76px; padding: 0 18px; }
  .topbar h1 { font-size: 20px; }
  .topbar .eyebrow { display: none; }
  main { padding: 18px 14px 90px; }
  .mobile-nav { position: fixed; inset: auto 0 0; z-index: 30; height: 68px; display: grid; grid-template-columns: repeat(5, 1fr); padding: 5px 4px calc(5px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgb(255 255 255 / 96%); backdrop-filter: blur(12px); }
  .mobile-nav button { display: grid; place-items: center; align-content: center; gap: 3px; border: 0; background: transparent; color: var(--muted); font-size: 9px; }
  .mobile-nav button.active { color: var(--green); font-weight: 600; }
  .mobile-nav svg { width: 19px; height: 19px; }
  .entry-layout { grid-template-columns: 1fr; }
  .order-summary { position: static; }
  .summary-strip { grid-template-columns: repeat(2, 1fr); }
  .view-toolbar { align-items: stretch; flex-direction: column; }
  .view-toolbar .search-field { width: 100%; }
  .toolbar-actions { justify-content: space-between; }
  .records-toolbar .filter-group { flex-wrap: wrap; }
  .records-toolbar .search-field { flex-basis: 100%; }
  .record-kpis { grid-template-columns: 1fr; gap: 8px; }
  .quick-product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .compact-action { width: 38px; min-width: 38px; padding: 0; }
  .compact-action span { display: none; }
  .topbar-actions { gap: 7px; }
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric-card { min-height: 116px; padding: 14px; }
  .metric-value { font-size: 20px; }
  .metric-top > span:first-child { font-size: 11px; }
  .panel-header { align-items: flex-start; padding: 15px; }
  .chart-panel .panel-header { flex-direction: column; }
  .chart-wrap { height: 235px; padding-inline: 8px; }
  .trend-summary { margin-inline: 15px; }
  .trend-summary-item { padding-inline: 8px; }
  .trend-summary-item strong { font-size: 14px; }
  .trend-breakdown-row { grid-template-columns: minmax(84px, 1fr) minmax(85px, .72fr) minmax(85px, .72fr); gap: 6px; padding-inline: 15px; }
  .alert-list { display: block; padding-inline: 15px; }
  .form-grid { grid-template-columns: 1fr; padding: 15px; }
  .field-span-2 { grid-column: span 1; }
  .form-actions { padding: 13px 15px; }
  .summary-strip { grid-template-columns: 1fr 1fr; }
  .summary-item { padding: 12px; }
  .summary-item strong { font-size: 15px; }
  .toolbar-actions { align-items: stretch; }
  .toolbar-actions .select-control, .toolbar-actions .button { min-width: 0; flex: 1; }
  .filter-group .select-control { flex: 1; min-width: 120px; }
  .records-toolbar > .button { align-self: flex-end; }
  .toast-region { right: 12px; bottom: 80px; left: 12px; }
  .toast { width: 100%; min-width: 0; }
  dialog .form-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .quick-search { width: 100%; }
  .quick-product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .quick-product-body { padding: 9px; }
  .quick-product-body h3 { min-height: 34px; font-size: 11px; }
  .image-uploader { align-items: flex-start; }
  .image-preview { width: 84px; height: 70px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Vben Analytics inspired application shell */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-soft: #f7f8fa;
  --ink: #1f2329;
  --muted: #7b8494;
  --line: #e5e7eb;
  --line-strong: #d7dbe2;
  --green: #16a34a;
  --green-dark: #12813d;
  --green-soft: #edf9f1;
  --blue: #1677ff;
  --blue-soft: #eaf3ff;
  --amber: #d97706;
  --amber-soft: #fff7e8;
  --red: #dc2626;
  --red-soft: #fff1f0;
  --shadow: 0 1px 2px rgb(15 23 42 / 3%), 0 3px 10px rgb(15 23 42 / 3%);
  --sidebar: 236px;
  --radius: 6px;
}

body { background: var(--bg); color: var(--ink); font-size: 14px; }
body.sidebar-collapsed { --sidebar: 64px; }

.sidebar {
  width: var(--sidebar);
  padding: 0 12px 16px;
  overflow: hidden;
  background: #111827;
  border-right: 1px solid #1f2937;
  transition: width .2s ease;
}
.brand {
  height: 56px;
  padding: 0 8px;
  gap: 10px;
  border-bottom: 1px solid rgb(255 255 255 / 7%);
  white-space: nowrap;
}
.brand-mark { width: 34px; height: 34px; color: #fff; background: var(--blue); border-radius: 7px; }
.brand-mark svg { width: 20px; height: 20px; }
.brand-mark.brand-image { overflow: hidden; padding: 0; border: 1px solid rgb(255 255 255 / 16%); background: #fff; }
.brand-mark.brand-image img { width: 100%; height: 100%; display: block; object-fit: cover; }
.brand-copy strong { color: #fff; font-size: 15px; font-weight: 600; }
.brand-copy small { color: #7f8a9c; font-size: 10px; }
.nav-list { gap: 3px; margin-top: 14px; }
.nav-caption {
  margin: 8px 10px 7px;
  color: #657087;
  font-size: 10px;
  line-height: 18px;
  white-space: nowrap;
}
.nav-item {
  position: relative;
  height: 42px;
  gap: 11px;
  padding: 0 12px;
  border-radius: 5px;
  color: #a6adbb;
}
.nav-item svg { width: 17px; height: 17px; flex: none; }
.nav-item span { font-size: 13px; }
.nav-item:hover { color: #f8fafc; background: rgb(255 255 255 / 6%); }
.nav-item.active { color: #fff; background: #1677ff; box-shadow: 0 3px 10px rgb(22 119 255 / 22%); }
.sidebar-foot { padding: 14px 8px 0; border-color: rgb(255 255 255 / 8%); }
.storage-status { color: #cbd5e1; }
.storage-status > svg { color: #60a5fa; }
.storage-status small { color: #6f7b8f; }
.text-button { color: #8f9bad; }

.main-column { padding-left: var(--sidebar); transition: padding-left .2s ease; }
.topbar {
  height: 56px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 96%);
  box-shadow: 0 1px 2px rgb(15 23 42 / 2%);
}
.topbar-start, .breadcrumb { min-width: 0; display: flex; align-items: center; }
.topbar-start { gap: 13px; }
.header-icon-button {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #566176;
}
.header-icon-button:hover { color: var(--blue); background: var(--blue-soft); }
.header-icon-button svg { width: 18px; height: 18px; }
.breadcrumb { gap: 7px; color: #8a93a3; font-size: 12px; white-space: nowrap; }
.breadcrumb svg { width: 13px; height: 13px; }
.breadcrumb strong { overflow: hidden; color: #343a46; font-weight: 500; text-overflow: ellipsis; }
.topbar-actions { gap: 8px; }
.topbar .button { min-height: 34px; padding-inline: 12px; }
.header-divider { width: 1px; height: 20px; margin: 0 2px; background: var(--line); }
.user-avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #334155;
  font-size: 12px;
  font-weight: 600;
}
.page-tabbar {
  position: sticky;
  top: 56px;
  z-index: 14;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 3px rgb(15 23 42 / 3%);
}
.page-tab {
  height: 29px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: #4c5668;
  background: #fff;
  font-size: 11px;
}
.page-tab.active { color: var(--blue); border-color: #b8d6ff; background: #f4f8ff; }
.page-tab svg { width: 12px; height: 12px; color: #9ba3b1; }
.tab-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); }
.page-tabbar > p { margin: 0; color: var(--muted); font-size: 10px; }

main { max-width: 1720px; padding: 18px 20px 42px; }
.view { animation-duration: .16s; }
.button { min-height: 36px; border-radius: 5px; padding-inline: 14px; font-size: 12px; }
.button-primary { background: var(--blue); border-color: var(--blue); }
.button-primary:hover { background: #095ec7; border-color: #095ec7; }
.button-secondary { color: #374151; border-color: var(--line-strong); }
.button-secondary:hover { color: var(--blue); border-color: #91caff; background: #f8fbff; }
.button-ghost:hover { color: var(--blue); background: var(--blue-soft); }
.icon-button { border-radius: 5px; }
.icon-button:hover { color: var(--blue); background: var(--blue-soft); }

.metrics-grid { gap: 12px; margin-bottom: 14px; }
.metric-card {
  min-height: 120px;
  padding: 16px 18px;
  border-color: var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
.metric-card:hover { border-color: #cbd5e1; box-shadow: 0 7px 20px rgb(15 23 42 / 7%); transform: translateY(-1px); }
.metric-top { color: #778195; font-size: 12px; }
.metric-icon { width: 36px; height: 36px; border-radius: 6px; }
.metric-icon svg { width: 19px; height: 19px; }
.metric-icon.blue { color: #1677ff; background: #eaf3ff; }
.metric-icon.green { color: #0f9f6e; background: #e9f9f3; }
.metric-icon.amber { color: #d97706; background: #fff5e5; }
.metric-icon.red { color: #e5484d; background: #fff0f0; }
.metric-value { margin: 13px 0 8px; color: #111827; font-size: 25px; letter-spacing: 0; }
.metric-foot { padding-top: 8px; border-top: 1px solid #f0f1f3; color: #8b94a5; }
.metric-foot strong { color: var(--blue); }

.dashboard-grid { grid-template-columns: minmax(0, 1fr) 330px; gap: 14px; margin-bottom: 14px; }
.panel { border-color: var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-header { min-height: 59px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-header h2 { color: #202632; font-size: 14px; font-weight: 600; }
.panel-header p { color: #8b94a5; }
.segmented { padding: 2px; border-radius: 5px; background: #f5f6f8; }
.segmented button { height: 27px; border-radius: 3px; }
.segmented button.active { color: var(--blue); box-shadow: 0 1px 4px rgb(15 23 42 / 10%); }
.trend-summary { margin: 0 18px 6px; }
.trend-summary-item { padding: 12px; }
.trend-summary-item strong { font-size: 16px; }
.trend-summary-item.profit strong { color: #0f9f6e; }
.chart-wrap { height: 276px; }
.trend-breakdown-row { padding-inline: 18px; }
.trend-breakdown-row.heading { background: #fafbfc; }
.trend-breakdown-row strong { color: #0f9f6e; }
.alert-list { padding: 0 18px 13px; }
.alert-row { padding: 12px 0; }
.product-avatar { border-color: #dbe7f8; color: var(--blue); background: var(--blue-soft); border-radius: 5px; }
.recent-panel { overflow: hidden; }

th { height: 40px; background: #fafbfc; color: #667085; font-size: 10px; }
td { height: 54px; color: #3d4553; }
tbody tr:hover { background: #f7faff; }
.type-badge, .status-badge { border-radius: 3px; }
.type-badge.in { color: #1677ff; background: #eaf3ff; }
.type-badge.out, .status-badge.good { color: #0f8a5f; background: #e9f9f3; }
.type-badge.gift { color: #c46a05; background: #fff5e5; }

.view-toolbar { margin-bottom: 14px; }
.search-field, .select-control, .field input, .field select, .field textarea,
.input-with-prefix, .input-with-suffix { border-radius: 5px; }
.search-field { height: 36px; background: #fff; }
.search-field:focus-within, .field input:focus, .field select:focus, .field textarea:focus,
.input-with-prefix:focus-within, .input-with-suffix:focus-within { border-color: #69a9ff; box-shadow: 0 0 0 2px rgb(22 119 255 / 10%); }
.select-control { height: 36px; }
.summary-strip { margin-bottom: 14px; border-radius: var(--radius); }
.summary-item { min-height: 70px; }
.entry-layout { gap: 14px; }
.entry-form .panel-header { border-bottom-color: var(--line); }
.entry-icon.inbound { color: var(--blue); background: var(--blue-soft); }
.entry-icon.outbound { color: #0f9f6e; background: #e9f9f3; }
.form-grid { gap: 15px; padding: 18px; }
.field input, .field select { height: 38px; }
.outbound-mode label > span { height: 39px; border-radius: 5px; }
.outbound-mode input:checked + span { color: #095ec7; border-color: #69a9ff; background: #edf5ff; box-shadow: 0 0 0 2px rgb(22 119 255 / 7%); }
.form-actions { padding: 13px 18px; background: #fafbfc; }
.order-summary { top: 113px; }
.profit-preview { color: #087451; background: #e9f9f3; }
.quick-outbound-section { margin-bottom: 18px; }
.section-heading h2 { color: #202632; font-size: 15px; }
.quick-product-grid { gap: 10px; }
.quick-product-card { border-radius: 6px; box-shadow: var(--shadow); transition: transform .16s, box-shadow .16s; }
.quick-product-card:hover { box-shadow: 0 7px 20px rgb(15 23 42 / 8%); transform: translateY(-1px); }
.quick-product-image { color: var(--blue); background: #f0f5fb; }
.quick-product-meta strong { color: #095ec7; }
.quick-product-card .gift-button { color: #c46a05; background: #fff5e5; border-color: #f1d5aa; }
.record-kpis { gap: 12px; margin-bottom: 14px; }
.record-kpi { border-radius: var(--radius); box-shadow: var(--shadow); }

dialog { border: 1px solid var(--line); border-radius: 7px; box-shadow: 0 24px 80px rgb(15 23 42 / 24%); }
dialog::backdrop { background: rgb(15 23 42 / 46%); }
.dialog-header { padding: 17px 20px; }
.image-preview:hover { color: var(--blue); border-color: var(--blue); }
.toast { border-color: #273449; background: #172033; }

body.sidebar-collapsed .brand { padding-inline: 3px; }
body.sidebar-collapsed .brand-copy,
body.sidebar-collapsed .nav-caption,
body.sidebar-collapsed .nav-item span,
body.sidebar-collapsed .storage-status span { display: none; }
body.sidebar-collapsed .nav-item { justify-content: center; padding: 0; }
body.sidebar-collapsed .sidebar-foot { padding-inline: 0; }
body.sidebar-collapsed .storage-status { justify-content: center; }
body.sidebar-collapsed .text-button { justify-content: center; width: 100%; font-size: 0; }
body.sidebar-collapsed .text-button svg { width: 17px; height: 17px; }

@media (max-width: 1120px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .alert-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  :root, body.sidebar-collapsed { --sidebar: 0px; }
  .sidebar { display: none; }
  .sidebar-toggle { display: none; }
  .topbar { height: 56px; padding: 0 14px; }
  .page-tabbar { top: 56px; height: 38px; padding: 0 14px; }
  .page-tabbar > p { display: none; }
  main { padding: 14px 12px 88px; }
  .order-summary { position: static; }
  .mobile-nav { height: 64px; border-color: var(--line); box-shadow: 0 -2px 10px rgb(15 23 42 / 5%); }
  .mobile-nav button.active { color: var(--blue); }
}

@media (max-width: 560px) {
  .breadcrumb > span, .breadcrumb > svg { display: none; }
  .breadcrumb strong { font-size: 13px; }
  .header-divider, .user-avatar { display: none; }
  .page-tab { max-width: 180px; }
  .metrics-grid { gap: 8px; }
  .metric-card { min-height: 112px; padding: 13px; }
  .metric-icon { width: 31px; height: 31px; }
  .metric-value { font-size: 19px; }
  .metric-foot { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .panel-header { padding: 13px 14px; }
  .trend-summary { margin-inline: 14px; }
  .quick-product-grid { gap: 8px; }
}

/* Authentication */
.auth-pending .app-shell,
.auth-pending .mobile-nav,
.auth-pending .login-screen { visibility: hidden; }
.auth-locked { overflow: hidden; }
.auth-locked .app-shell,
.auth-locked .mobile-nav { display: none; }
.login-screen[hidden] { display: none; }
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  min-width: 320px;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(440px, 1.05fr) minmax(420px, .95fr);
  overflow: auto;
  background: #f5f6f8;
}
.login-showcase {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 34px clamp(36px, 6vw, 86px) 28px;
  overflow: hidden;
  color: #fff;
  background: #111827;
}
.login-showcase::after {
  content: "";
  position: absolute;
  inset: 92px 0 auto auto;
  width: 5px;
  height: 180px;
  background: #1677ff;
}
.login-brand { display: flex; align-items: center; gap: 11px; }
.login-brand .brand-mark { flex: none; }
.login-brand > span:last-child { display: grid; gap: 2px; }
.login-brand strong { font-size: 15px; font-weight: 600; }
.login-brand small { color: #718096; font-size: 8px; letter-spacing: 1.6px; }
.login-showcase-copy { max-width: 540px; margin: auto 0 30px; }
.login-kicker { margin: 0 0 16px; color: #60a5fa; font-size: 12px; font-weight: 600; }
.login-showcase-copy h1 { margin: 0; font-size: 42px; line-height: 1.25; letter-spacing: 0; }
.login-showcase-copy > p:last-child { max-width: 480px; margin: 20px 0 0; color: #9aa6b8; font-size: 13px; line-height: 1.9; }
.login-preview {
  width: min(560px, 100%);
  padding: 18px 20px 20px;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 8px;
  background: #172033;
  box-shadow: 0 22px 50px rgb(0 0 0 / 18%);
}
.login-preview-head { display: flex; align-items: center; justify-content: space-between; color: #d7deea; font-size: 11px; }
.login-preview-head svg { width: 17px; height: 17px; color: #60a5fa; }
.login-preview-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 16px; border-block: 1px solid rgb(255 255 255 / 8%); }
.login-preview-metrics > span { min-width: 0; padding: 12px 10px; border-right: 1px solid rgb(255 255 255 / 8%); }
.login-preview-metrics > span:first-child { padding-left: 0; }
.login-preview-metrics > span:last-child { padding-right: 0; border-right: 0; }
.login-preview-metrics small { display: block; margin-bottom: 6px; color: #77859a; font-size: 9px; }
.login-preview-metrics strong { display: block; overflow: hidden; color: #fff; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.login-preview-metrics > span:nth-child(2) strong { color: #34d399; }
.login-preview-metrics > span:last-child strong { color: #60a5fa; }
.login-preview-chart { height: 94px; display: flex; align-items: flex-end; gap: 9px; padding-top: 18px; }
.login-preview-chart i { height: var(--bar); flex: 1; border-radius: 3px 3px 1px 1px; background: #2b74d8; }
.login-preview-chart i:nth-child(2n) { background: #28a781; }
.login-copyright { margin: 20px 0 0; color: #59677b; font-size: 9px; }
.login-form-shell { min-height: 100dvh; display: grid; place-items: center; padding: 40px clamp(28px, 5vw, 72px); }
.login-card {
  width: min(410px, 100%);
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 40px rgb(15 23 42 / 8%);
}
.login-mobile-brand { display: none; }
.login-heading { margin-bottom: 28px; }
.login-heading p { margin: 0 0 8px; color: var(--blue); font-size: 11px; font-weight: 600; }
.login-heading h2 { margin: 0; color: #172033; font-size: 25px; letter-spacing: 0; }
.login-heading span { display: block; margin-top: 9px; color: #8a94a5; font-size: 11px; }
.login-field { display: grid; gap: 8px; margin-top: 18px; color: #4b5565; font-size: 11px; font-weight: 600; }
.login-input {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.login-input:focus-within { border-color: #69a9ff; box-shadow: 0 0 0 2px rgb(22 119 255 / 10%); }
.login-input > svg { width: 16px; height: 16px; flex: none; color: #9aa3b2; }
.login-input input { min-width: 0; flex: 1; border: 0; outline: 0; color: #1f2937; background: transparent; font-size: 13px; font-weight: 400; }
.password-toggle { width: 28px; height: 28px; display: grid; place-items: center; flex: none; padding: 0; border: 0; border-radius: 4px; color: #8b94a5; background: transparent; }
.password-toggle:hover { color: var(--blue); background: var(--blue-soft); }
.password-toggle svg { width: 16px; height: 16px; }
.login-options { display: flex; align-items: center; justify-content: space-between; margin-top: 15px; }
.remember-login { display: inline-flex; align-items: center; gap: 7px; color: #697386; font-size: 11px; cursor: pointer; }
.remember-login input { width: 14px; height: 14px; margin: 0; accent-color: var(--blue); }
.login-error { margin: 13px 0 0; padding: 9px 10px; border: 1px solid #ffc9c9; border-radius: 5px; color: #b42318; background: #fff3f2; font-size: 11px; }
.login-submit { width: 100%; min-height: 42px; margin-top: 20px; justify-content: space-between; padding-inline: 16px; }
.login-submit svg { width: 16px; height: 16px; }
.login-local-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 20px; color: #98a1b0; font-size: 10px; }
.login-local-note svg { width: 14px; height: 14px; color: #4f9bee; }
.logout-button { border: 1px solid transparent; }

@media (max-width: 980px) {
  .login-screen { grid-template-columns: minmax(350px, .9fr) minmax(400px, 1.1fr); }
  .login-showcase { padding-inline: 34px; }
  .login-showcase-copy h1 { font-size: 34px; }
  .login-preview-metrics strong { font-size: 13px; }
}

@media (max-width: 760px) {
  .login-screen { display: block; background: #fff; }
  .login-showcase { display: none; }
  .login-form-shell { min-height: 100dvh; padding: 28px 20px; }
  .login-card { width: min(430px, 100%); padding: 28px 24px; border: 0; box-shadow: none; }
  .login-mobile-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 52px; color: #172033; font-size: 15px; }
  .login-mobile-brand .brand-mark { color: #fff; background: var(--blue); }
  .login-heading h2 { font-size: 23px; }
}

@media (max-width: 560px) {
  .login-form-shell { align-items: start; padding-top: max(28px, env(safe-area-inset-top)); }
  .login-card { padding-inline: 4px; }
  .login-mobile-brand { margin-bottom: 46px; }
}
