@charset "UTF-8";

:root {
  color-scheme: light;
  --canvas: #f6f5f1;
  --surface: #fff;
  --ink: #222c29;
  --muted: #7c8580;
  --faint: #a0a7a1;
  --line: #e8eae3;
  --line-strong: #d9ddd4;
  --green: #164e42;
  --green-hover: #103d34;
  --green-soft: #eaf1eb;
  --clay: #b86b50;
  --clay-soft: #fbf0e9;
  --red: #b95148;
  --red-soft: #fbefed;
  --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 360px; background: var(--canvas); }
body { margin: 0; color: var(--ink); line-height: 1.6; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
button, a { touch-action: manipulation; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
svg { flex-shrink: 0; width: 20px; height: 20px; vertical-align: middle; }
button svg { width: 17px; height: 17px; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #a7c3ad; outline-offset: 4px; }
::selection { background: #d9e7d9; color: #163b30; }
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 15; display: flex; flex-direction: column; width: 216px; padding: 33px 19px 22px; border-right: 1px solid var(--line); background: #fdfdfa; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 11px; margin-bottom: 45px; }
.brand-mark { display: grid; place-items: center; width: 37px; height: 42px; color: #fff; background: var(--green); border-radius: 11px 11px 14px 14px; }
.brand-mark svg { width: 22px; height: 22px; }
.brand-name { margin: 0; font-size: 19px; font-weight: 650; line-height: 1.4; letter-spacing: 2px; }
.brand-sub { margin-top: 1px; color: var(--muted); font-size: 10px; letter-spacing: 1.5px; }
.nav-list { display: flex; flex-direction: column; gap: 8px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 15px; color: #767e77; text-align: left; background: none; border: 0; border-radius: 9px; line-height: 1.5; transition: background .15s ease, color .15s ease; }
.nav-item:hover { color: var(--green); background: #f1f4ed; text-decoration: none; }
.nav-item.active { color: var(--green); font-weight: 600; background: var(--green-soft); }
.nav-icon, .nav-icon svg { width: 19px; height: 19px; }
.sidebar-bottom { margin-top: auto; padding: 20px 11px 0; color: var(--muted); font-size: 11px; line-height: 1.85; }
.sidebar-bottom > :first-child { margin-bottom: 5px; color: #657168; }
.local-dot { display: inline-block; width: 6px; height: 6px; margin: 0 7px 1px 0; background: #5f8d6e; border-radius: 50%; box-shadow: 0 0 0 3px #edf4ed; }
.mobile-brand { display: none; }
.main { max-width: 1850px; min-height: 100vh; margin-left: 216px; padding: 39px 44px 22px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.eyebrow { margin: 0 0 7px; color: #9aa197; font-size: 10px; font-weight: 600; letter-spacing: 2.4px; text-transform: uppercase; }
.page-title { margin: 0; font-size: 29px; font-weight: 620; line-height: 1.45; letter-spacing: -.7px; }
.page-subtitle { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 39px; padding: 9px 15px; border: 1px solid transparent; border-radius: 8px; color: var(--ink); background: #fff; font-size: 12px; font-weight: 500; line-height: 1.5; white-space: nowrap; transition: border-color .15s ease, background .15s ease, box-shadow .15s ease; }
.btn:hover { text-decoration: none; background: #f6f8f3; }
.btn.primary { color: #fff; background: var(--green); border-color: var(--green); box-shadow: 0 2px 3px #164e420d; }
.btn.primary:hover { background: var(--green-hover); border-color: var(--green-hover); }
.btn.secondary { border-color: var(--line-strong); background: #fff; }
.btn.secondary:hover { border-color: #aab9aa; background: #fbfcf9; }
.btn.ghost { color: #6d7970; background: transparent; }
.btn.ghost:hover { color: var(--green); background: var(--green-soft); }
.btn.danger { color: var(--red); border-color: #edcfca; background: #fff; }
.btn.danger:hover { background: var(--red-soft); }
.btn.small { min-height: 31px; padding: 5px 10px; font-size: 11px; border-radius: 6px; }
.btn.icon-btn, .icon-btn { width: 33px; min-height: 33px; padding: 6px; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 7px; }
.icon-btn:hover { color: var(--green); background: var(--green-soft); }
.banner-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.demo-banner { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 13px 18px; margin-bottom: 23px; color: #8a6443; background: #f5ede0; border: 1px solid #ede0cc; border-radius: 9px; font-size: 12px; }
.demo-banner strong { font-weight: 600; }
.demo-banner .btn { color: #7d583b; border-color: #d9c6ac; background: #fffaf1; }
.notice, .storage-warning { padding: 12px 16px; margin: 0 0 20px; color: #686f5d; background: #f0f2e9; border: 1px solid #e1e6d7; border-radius: 8px; font-size: 12px; }
.storage-warning { color: #97523e; background: var(--clay-soft); border-color: #efd8c9; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat-card { min-height: 143px; padding: 20px 22px 17px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.stat-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #778279; font-size: 12px; }
.stat-label svg { width: 17px; height: 17px; color: #9ca89a; }
.stat-value { display: inline-block; margin-top: 9px; color: #293e33; font-size: 33px; font-weight: 550; line-height: 1.2; letter-spacing: -1.1px; font-variant-numeric: tabular-nums; }
.stat-unit { margin-left: 7px; color: #9ba399; font-size: 11px; font-weight: 400; letter-spacing: 0; }
.stat-foot { margin-top: 10px; color: #9ca399; font-size: 10px; }
.stat-card.warning .stat-value, .stat-card.warning .stat-label svg { color: var(--clay); }
.stat-card.warning { background: #fffcf8; }
.workspace { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; padding: 23px 25px 18px; }
.section-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.section-head p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.section-head .tag { margin-left: 8px; vertical-align: 1px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; padding: 0 25px 20px; }
.search-wrap { position: relative; flex: 1; min-width: 230px; max-width: 355px; }
.search-wrap > svg { position: absolute; z-index: 1; top: 12px; left: 12px; width: 16px; height: 16px; color: #9ba39b; pointer-events: none; }
.search-input { width: 100%; height: 40px; padding: 9px 12px 9px 36px !important; background: #fafbf8 !important; border-color: #e8eae4 !important; border-radius: 7px !important; font-size: 11px !important; }
.search-input::placeholder { color: #a0a79e; }
.filters { display: flex; flex-wrap: wrap; gap: 5px; }
.filter-btn { min-height: 31px; padding: 6px 10px; color: #8a948a; background: transparent; border: 1px solid transparent; border-radius: 6px; font-size: 11px; line-height: 1.5; white-space: nowrap; }
.filter-btn:hover { color: var(--green); background: #f4f7f1; }
.filter-btn.active { color: var(--green); background: #edf3ec; font-weight: 500; }
.filter-btn span { margin-left: 4px; font-size: 10px; opacity: .65; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
th { padding: 13px 16px; color: #939a90; background: #fbfcf9; border-top: 1px solid #eff0e9; border-bottom: 1px solid #eff0e9; font-size: 10px; font-weight: 500; }
td { padding: 18px 16px; border-bottom: 1px solid #f0f1eb; font-size: 12px; }
th:first-child, td:first-child { padding-left: 25px; }
th:last-child, td:last-child { padding-right: 25px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: #fcfdf9; }
.product-cell { display: flex; align-items: center; gap: 12px; min-width: 180px; }
.bag-thumb { display: grid; place-items: center; flex-shrink: 0; width: 43px; height: 45px; color: #8d8172; background: #eee9df; border-radius: 9px; }
.bag-thumb svg { width: 28px; height: 28px; }
.bag-thumb[data-color="black"] { color: #626761; background: #e8eae6; }
.bag-thumb[data-color="brown"] { color: #a28365; background: #f0e5d7; }
.bag-thumb[data-color="white"] { color: #b2a58f; background: #f4f0e5; }
.product-name { color: #3a453c; font-size: 12px; font-weight: 550; }
.product-meta { margin-top: 3px; color: #a0a79d; font-size: 10px; letter-spacing: .1px; }
.tag { display: inline-block; padding: 2px 6px; color: #899283; background: #f1f4ed; border-radius: 4px; font-size: 10px; font-weight: 400; line-height: 1.6; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 5px; font-size: 10px; font-weight: 400; line-height: 1.6; }
.badge::before { width: 4px; height: 4px; background: currentColor; border-radius: 50%; content: ""; opacity: .7; }
.badge.ok { color: #6a876b; background: #edf3eb; }
.badge.low { color: #b47b4d; background: #fcf2e7; }
.badge.out { color: #bd7567; background: #fbefec; }
.badge.pending { color: #8b8e83; background: #f0f1ed; }
.qty { font-size: 19px; font-weight: 550; line-height: 1.2; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.qty.muted { color: #a8afa4; font-size: 14px; font-weight: 400; }
.row-actions { display: flex; align-items: center; gap: 5px; }
.row-actions .btn { color: #66816d; }
.link-text { display: inline-flex; align-items: center; gap: 5px; max-width: 200px; color: #7c8c79; font-size: 11px; }
.link-text svg { width: 12px; height: 12px; }
.link-text + .link-text { margin-left: 5px; }

.empty-state { padding: 51px 25px 44px; text-align: center; }
.empty-icon { display: grid; place-items: center; width: 66px; height: 66px; margin: 0 auto 20px; color: #7d9a7c; background: #f0f5ec; border: 1px solid #e5eddd; border-radius: 19px; }
.empty-icon svg { width: 31px; height: 31px; }
.empty-title { margin: 0 0 9px; color: #3d4f40; font-size: 18px; font-weight: 550; }
.empty-copy { max-width: 410px; margin: 0 auto 22px; color: #939c8e; font-size: 12px; line-height: 1.9; }
.empty-state .btn + .btn { margin-left: 7px; }
.onboarding-grid { display: grid; grid-template-columns: repeat(3, 1fr); max-width: 780px; margin: 38px auto 0; border-top: 1px solid var(--line); text-align: left; }
.onboarding-step { padding: 24px 22px 0; color: #a1a99a; font-size: 11px; line-height: 1.8; }
.onboarding-step + .onboarding-step { border-left: 1px solid var(--line); }
.onboarding-step h3 { margin: 9px 0 5px; color: #73816c; font-size: 12px; font-weight: 500; }
.onboarding-step p { margin: 0; }
.step-number { color: #9eae95; font-size: 11px; letter-spacing: .5px; }
.page-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 9px; margin-top: 19px; padding: 0 2px; color: #a5aca0; font-size: 10px; }
.page-footer svg { width: 12px; height: 12px; margin-right: 4px; }
.hint-row { display: flex; align-items: flex-start; gap: 8px; color: #8e9b88; font-size: 11px; }
.hint-row svg { width: 14px; height: 14px; margin-top: 2px; }

.history-list { padding: 0 25px; }
.history-item { display: flex; align-items: center; gap: 14px; padding: 19px 0; border-top: 1px solid #eff0e9; }
.history-icon { display: grid; place-items: center; flex-shrink: 0; width: 36px; height: 36px; color: #78916d; background: #eff4eb; border-radius: 10px; }
.history-icon svg { width: 17px; height: 17px; }
.history-body { flex: 1; min-width: 0; }
.history-title { margin: 0 0 4px; color: #53634c; font-size: 12px; font-weight: 500; }
.history-meta { color: #a0aa97; font-size: 10px; line-height: 1.8; overflow-wrap: anywhere; }
.history-delta { flex-shrink: 0; text-align: right; color: #7d8977; font-size: 21px; font-weight: 500; font-variant-numeric: tabular-nums; }
.history-delta.positive { color: #6c8d5e; }
.history-delta.negative { color: #b98165; }
.history-delta small { display: block; margin-top: 2px; color: #a4ad9b; font-size: 10px; font-weight: 400; }
.links-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.link-card { padding: 21px; background: #fff; border: 1px solid var(--line); border-radius: 13px; }
.link-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; }
.link-card h3 { margin: 0 0 5px; font-size: 14px; font-weight: 550; }
.link-card a { display: inline-block; max-width: 100%; font-size: 11px; overflow-wrap: anywhere; }
.mapping-list { margin-top: 19px; border-top: 1px solid #eff1e9; }
.mapping-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 11px 0; border-bottom: 1px solid #f2f3ed; color: #849079; font-size: 11px; }
.mapping-row:last-child { padding-bottom: 0; border-bottom: 0; }
.mapping-row strong { color: #5b6e50; font-size: 13px; font-weight: 500; }
.two-columns { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); align-items: start; gap: 22px; }
.help-panel { padding: 22px 24px; color: #89957c; background: #eef2e8; border: 1px solid #e4eadb; border-radius: 12px; font-size: 12px; line-height: 1.9; }
.help-panel h3 { margin: 0 0 10px; color: #5f7350; font-size: 14px; font-weight: 550; }
.help-panel p { margin: 0 0 10px; }
.help-panel p:last-child { margin-bottom: 0; }
.help-panel ol { margin: 12px 0; padding-left: 20px; }
.help-panel li { padding: 4px 0; }
.inline-link { padding: 0; color: var(--green); background: none; border: 0; font-size: inherit; text-decoration: underline; text-underline-offset: 3px; }
.muted { color: var(--muted); }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
.text-small { font-size: 11px; }
.divider { height: 1px; margin: 20px 0; background: var(--line); }

.toast { position: fixed; z-index: 100; left: calc(50% + 108px); bottom: 29px; max-width: min(540px, calc(100vw - 36px)); padding: 13px 21px; color: #fff; background: #315540; border: 1px solid #ffffff1a; border-radius: 10px; box-shadow: 0 7px 30px #243e2d22; font-size: 12px; transform: translateX(-50%); animation: toast-in .2s ease-out; }
.toast.error { background: #955e4b; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 7px); } to { opacity: 1; transform: translate(-50%, 0); } }
.drawer-backdrop { position: fixed; inset: 0; z-index: 40; background: #25352942; backdrop-filter: blur(2px); }
dialog.drawer { position: fixed; inset: 0 0 0 auto; width: 510px; height: 100dvh; max-width: calc(100vw - 30px); max-height: 100dvh; margin: 0 0 0 auto; padding: 0; color: var(--ink); background: #fff; border: 0; border-left: 1px solid #e4e9df; border-radius: 16px 0 0 16px; box-shadow: -10px 0 65px #1a32261a; }
dialog.drawer[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: #22372a40; backdrop-filter: blur(2px); }
.drawer > form { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.drawer-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-shrink: 0; padding: 28px 29px 22px; border-bottom: 1px solid var(--line); }
.drawer-header h2 { margin: 0; color: #3b513e; font-size: 21px; font-weight: 550; }
.drawer-header p { margin: 5px 0 0; color: #98a18e; font-size: 11px; }
.drawer-body { flex: 1; min-height: 0; padding: 25px 29px; overflow-y: auto; overscroll-behavior: contain; }
.drawer-footer { display: flex; justify-content: flex-end; gap: 9px; flex-shrink: 0; padding: 18px 29px; background: #fdfefa; border-top: 1px solid var(--line); }
.drawer-footer .btn { min-height: 40px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 19px 16px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field-label { color: #69795e; font-size: 12px; font-weight: 500; }
.field-label small { margin-left: 5px; color: #a7af9f; font-size: 10px; font-weight: 400; }
.field-hint { color: #a2ab97; font-size: 10px; line-height: 1.8; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea { width: 100%; min-width: 0; min-height: 41px; padding: 10px 12px; color: #53664b; background: #fff; border: 1px solid #dfe5d8; border-radius: 7px; outline: none; font-size: 12px; transition: border-color .15s ease, box-shadow .15s ease; }
input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus { border-color: #8eaa7d !important; box-shadow: 0 0 0 3px #c3d5b730; }
input::placeholder, textarea::placeholder { color: #b0b8a7; }
input[readonly] { background: #f6f8f1 !important; color: #9aa690; }
input[type="checkbox"], input[type="radio"] { width: 15px; height: 15px; margin: 0; accent-color: var(--green); flex-shrink: 0; }
input[type="number"] { font-variant-numeric: tabular-nums; }
select { cursor: pointer; }
textarea { min-height: 86px; resize: vertical; line-height: 1.8; }
.form-error { padding: 10px 13px; margin: 0 0 18px; color: #ad6b53; background: #fcf1e9; border: 1px solid #efdbcc; border-radius: 7px; font-size: 11px; line-height: 1.8; }
.form-error:empty { display: none; }
.quantity-preview { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 17px 19px; margin-top: 21px; color: #8a9a7c; background: #f3f7ed; border: 1px solid #e5edda; border-radius: 9px; font-size: 12px; }
.quantity-preview strong { color: #557344; font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; }
.quantity-preview .muted { color: #a5b298; }
.mapping-options { overflow-y: auto; max-height: 320px; padding: 0 12px; border: 1px solid #e1e8da; border-radius: 8px; }
.mapping-option { display: flex; align-items: center; gap: 11px; padding: 13px 0; border-bottom: 1px solid #edf1e7; font-size: 11px; }
.mapping-option:last-child { border-bottom: 0; }
.mapping-option > div { flex: 1; min-width: 0; }
.mapping-option strong { color: #677c59; font-weight: 500; }
.mapping-option .field-hint { display: block; margin-top: 2px; }
.mapping-option input:not([type="checkbox"]):not([type="radio"]) { min-height: 32px; margin-top: 6px; padding: 6px 9px; font-size: 10px; }
.checkbox-label { display: flex; align-items: flex-start; gap: 9px; color: #89997c; font-size: 11px; line-height: 1.8; cursor: pointer; }
.checkbox-label input { margin-top: 3px; }
.danger-note { padding: 13px 15px; margin: 16px 0; color: #ab7a59; background: #fcf4eb; border-radius: 7px; font-size: 11px; line-height: 1.9; }
.segmented { display: flex; gap: 4px; padding: 4px; margin-bottom: 23px; background: #f3f6ed; border: 1px solid #eaf0e2; border-radius: 8px; }
.segment { display: flex; align-items: center; justify-content: center; gap: 4px; flex: 1; min-height: 33px; padding: 7px 5px; color: #9ba98e; background: transparent; border: 0; border-radius: 5px; font-size: 11px; }
.segment.active { color: #5c7b4a; background: #fff; box-shadow: 0 1px 4px #60764b14; font-weight: 500; }
.radio-row { display: flex; align-items: flex-start; gap: 10px; padding: 14px 0; color: #809271; font-size: 12px; }
.radio-row input { margin-top: 3px; }
.backup-panel { padding: 25px; }
.backup-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 19px; }
.backup-card { display: flex; flex-direction: column; align-items: flex-start; padding: 24px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.backup-card > svg { width: 25px; height: 25px; margin-bottom: 17px; color: #829773; }
.backup-card h3 { margin: 0 0 8px; color: #536c42; font-size: 15px; font-weight: 550; }
.backup-card p { margin: 0 0 19px; color: #98a58b; font-size: 12px; line-height: 1.9; }
.backup-card .btn { margin-top: auto; }

@media (min-width: 1600px) {
  .main { padding-left: 58px; padding-right: 58px; }
  .stat-card { min-height: 155px; }
  td { padding-top: 21px; padding-bottom: 21px; }
}
@media (max-width: 1150px) {
  .main { padding: 31px 28px 22px; }
  .topbar { align-items: flex-start; }
  .top-actions { max-width: 255px; padding-top: 8px; }
  .stat-card { padding: 18px 17px 16px; }
  .stats-grid { gap: 12px; }
  .stat-value { font-size: 30px; }
  .toolbar { align-items: flex-start; }
  .filters { justify-content: flex-end; }
  .two-columns { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .sidebar { width: 184px; padding: 29px 14px 20px; }
  .brand { padding: 0 7px; gap: 9px; }
  .brand-name { font-size: 17px; letter-spacing: 1.5px; }
  .brand-sub { font-size: 9px; letter-spacing: 1px; }
  .brand-mark { width: 34px; height: 38px; }
  .nav-item { padding: 11px 12px; font-size: 12px; }
  .main { margin-left: 184px; padding: 29px 23px 20px; }
  .page-title { font-size: 26px; }
  .topbar { gap: 16px; }
  .top-actions { max-width: 200px; }
  .top-actions .btn { padding: 8px 11px; font-size: 11px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 21px; }
  .stat-card { min-height: 130px; }
  .section-head { padding: 21px 20px 17px; }
  .toolbar { padding: 0 20px 17px; }
  .search-wrap { max-width: none; flex-basis: 100%; }
  .filters { justify-content: flex-start; }
  th:first-child, td:first-child { padding-left: 20px; }
  th:last-child, td:last-child { padding-right: 20px; }
  .links-grid, .backup-grid { grid-template-columns: 1fr; }
  .toast { left: calc(50% + 92px); }
  .onboarding-step { padding: 21px 14px 0; }
}
@media (max-width: 700px) {
  html { min-width: 360px; }
  .sidebar { position: static; width: 100%; height: auto; padding: 17px 18px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { gap: 9px; margin: 0 0 17px; padding: 0; }
  .brand-mark { width: 31px; height: 35px; border-radius: 8px 8px 10px 10px; }
  .brand-mark svg { width: 19px; height: 19px; }
  .brand-name { font-size: 17px; }
  .brand-sub { font-size: 8px; }
  .nav-list { flex-direction: row; gap: 5px; margin: 0 -5px; padding-bottom: 11px; overflow-x: auto; scrollbar-width: none; }
  .nav-list::-webkit-scrollbar { display: none; }
  .nav-item { flex-shrink: 0; width: auto; gap: 7px; padding: 9px 10px; border-radius: 7px; font-size: 11px; white-space: nowrap; }
  .nav-icon, .nav-icon svg { width: 15px; height: 15px; }
  .sidebar-bottom { display: none; }
  .main { margin-left: 0; padding: 25px 18px 20px; }
  .topbar { flex-direction: column; align-items: stretch; gap: 17px; margin-bottom: 21px; }
  .page-title { font-size: 26px; }
  .eyebrow { margin-bottom: 6px; font-size: 9px; }
  .page-subtitle { margin-top: 6px; font-size: 11px; }
  .top-actions { justify-content: flex-start; max-width: none; padding-top: 0; }
  .top-actions .btn { min-height: 37px; padding: 8px 12px; }
  .demo-banner { align-items: flex-start; flex-direction: column; padding: 13px 15px; margin-bottom: 18px; font-size: 11px; }
  .banner-actions { flex-wrap: wrap; }
  .stats-grid { gap: 10px; margin-bottom: 20px; }
  .stat-card { min-height: 124px; padding: 16px; border-radius: 11px; }
  .stat-label { font-size: 11px; }
  .stat-value { margin-top: 8px; font-size: 29px; }
  .stat-unit { font-size: 10px; }
  .stat-foot { margin-top: 8px; font-size: 9px; }
  .workspace { border-radius: 12px; }
  .section-head { padding: 20px 17px 15px; gap: 10px; }
  .section-head h2 { font-size: 14px; }
  .section-head p { font-size: 10px; }
  .toolbar { gap: 11px; padding: 0 17px 16px; }
  .search-wrap { min-width: 0; width: 100%; }
  .filters { gap: 2px; }
  .filter-btn { padding: 5px 8px; font-size: 10px; }
  th { padding: 12px; }
  td { padding: 16px 12px; }
  th:first-child, td:first-child { padding-left: 17px; }
  th:last-child, td:last-child { padding-right: 17px; }
  .product-cell { gap: 10px; }
  .bag-thumb { width: 37px; height: 41px; }
  .product-name { font-size: 11px; }
  .product-meta { font-size: 9px; }
  .empty-state { padding: 36px 21px 31px; }
  .empty-icon { width: 59px; height: 59px; margin-bottom: 17px; border-radius: 17px; }
  .empty-title { font-size: 17px; }
  .empty-copy { font-size: 11px; }
  .onboarding-grid { margin-top: 29px; grid-template-columns: 1fr; }
  .onboarding-step { padding: 18px 1px 0; }
  .onboarding-step + .onboarding-step { border-left: 0; }
  .onboarding-step h3 { display: inline; margin-left: 7px; }
  .onboarding-step p { margin-top: 4px; padding-left: 23px; }
  .page-footer { align-items: flex-start; flex-direction: column; margin-top: 16px; font-size: 9px; }
  .history-list { padding: 0 17px; }
  .history-item { gap: 11px; }
  .history-title { font-size: 11px; }
  .history-meta { font-size: 9px; }
  .history-delta { font-size: 19px; }
  .link-card { padding: 18px; }
  .link-card h3 { font-size: 13px; }
  .two-columns { gap: 17px; }
  .backup-panel { padding: 18px; }
  .backup-card { padding: 21px; }
  .help-panel { padding: 19px 20px; font-size: 11px; }
  .toast { left: 50%; bottom: 20px; font-size: 11px; }
  dialog.drawer { width: 100%; max-width: 100%; border-left: 0; border-radius: 0; }
  .drawer-header { padding: 23px 22px 19px; }
  .drawer-header h2 { font-size: 20px; }
  .drawer-body { padding: 22px; }
  .drawer-footer { padding: 16px 22px max(16px, env(safe-area-inset-bottom)); }
  .form-grid { gap: 17px 13px; }
  .field-label { font-size: 11px; }
  input:not([type="checkbox"]):not([type="radio"]), select, textarea { font-size: 16px; }
  .search-input { font-size: 12px !important; }
  .mapping-option input:not([type="checkbox"]):not([type="radio"]) { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Application details */
.brand:hover { text-decoration: none; }
.brand-name, .brand-sub { display: block; }
.brand-dot { color: #b79a72; }
.sidebar-caption { margin: 0 15px 13px; color: #a1a69e; font-size: 10px; letter-spacing: 1px; }
.nav-count { margin-left: auto; padding: 1px 6px; color: #7d9383; background: #dce8dc; border-radius: 4px; font-size: 10px; }
.sidebar-note { padding: 50px 16px 25px; color: #a6ada0; }
.sidebar-note p { margin: 18px 0 12px; color: #85927d; font-family: Georgia, "Songti SC", serif; font-size: 18px; line-height: 1.8; letter-spacing: 2px; }
.sidebar-note > span:last-child { font-size: 8px; letter-spacing: 1.5px; }
.note-line { display: block; width: 25px; height: 1px; background: #c6d1bf; }
.sidebar-bottom strong { font-size: 11px; color: #647760; font-weight: 500; }
.sidebar-bottom p { margin: 7px 0 12px; }
.stat-card { text-align: left; }
.stat-button { font: inherit; }
.stat-button:hover { border-color: #bfd0bd; background: #fcfdf9; }
.stat-dot { width: 6px; height: 6px; background: #b1b7a9; border-radius: 50%; }
.stat-dot.warning { background: #c09061; }
.stat-foot svg { float: right; width: 14px; height: 14px; }
.section-count { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 5px; background: #eef3e9; color: #86987a; font-size: 10px; line-height: 20px; vertical-align: 1px; }
.align-right { text-align: right; }
.row-actions { justify-content: flex-end; }
.product-name { padding: 0; border: 0; background: transparent; text-align: left; font: inherit; font-weight: 550; }
.product-name:hover { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }
.link-text { padding: 0; border: 0; background: transparent; text-align: left; }
.link-text:hover { color: var(--green); }
.bag-thumb.charcoal { color: #68726c; background: #eaede8; }
.bag-thumb.brown { color: #a78461; background: #f2e8db; }
.bag-thumb.cream { color: #b0a285; background: #f6f1e5; }
.bag-thumb.green { color: #749179; background: #e8eee4; }
.bag-thumb.rose { color: #a77c7b; background: #f3e8e5; }
.color-swatch { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border: 1px solid #00000012; border-radius: 50%; background: #bcae9c; vertical-align: 1px; }
.color-swatch.charcoal { background: #555c56; }.color-swatch.brown { background: #9a7555; }.color-swatch.cream { background: #eee3cc; }.color-swatch.green { background: #6b886e; }.color-swatch.rose { background: #c19794; }
.spec-divider { padding: 0 7px; color: #c0c5bc; }
.qty-unit { color: #a1aa99; font-size: 10px; }
.badge i { display: none; }
.table-bottom { display: flex; justify-content: space-between; gap: 15px; padding: 13px 25px; color: #9aa390; border-top: 1px solid #eff1e9; font-size: 10px; }
.hint-row { margin-top: 17px; }
.welcome { padding-top: 40px; padding-bottom: 22px; }
.welcome-label { display: block; margin: 0 0 12px; color: #b2baa7; font-size: 9px; letter-spacing: 2px; }
.welcome .empty-title { font-size: 21px; }
.welcome .empty-icon { width: 74px; height: 74px; margin-bottom: 20px; }
.welcome .empty-icon svg { width: 37px; height: 37px; }
.empty-actions { display: flex; align-items: center; justify-content: center; gap: 8px; }
.empty-actions .btn + .btn { margin-left: 0; }
.onboarding-grid { margin: 15px 30px 30px; max-width: none; }
.onboarding-step { display: flex; gap: 14px; padding-top: 21px; }
.onboarding-step h3 { margin-top: 0; }
.step-number { font-family: Georgia, serif; font-size: 21px; font-weight: 400; line-height: 1.5; color: #bbc6b0; }
.compact { padding: 35px 20px; }
.notice { display: flex; align-items: flex-start; gap: 12px; padding: 17px 20px; }
.notice > svg { margin-top: 1px; width: 21px; height: 21px; color: #849a74; }
.notice strong { color: #627650; font-weight: 550; }
.notice p { margin: 4px 0 0; line-height: 1.9; }
.links-grid { padding: 0 25px 25px; }
.mapping-row > div:first-child { flex: 1; min-width: 0; }
.mapping-row .product-meta { display: block; }
.mapping-row > div:last-child { white-space: nowrap; }
.mapping-row strong { font-size: 12px; }
.mapping-row .qty { font-size: 17px; }
.shared-label { display: block; color: #a5b09a; font-size: 9px; }
.link-card-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; color: #a0aa95; font-size: 10px; }
.danger-text { color: #b38b77; text-decoration: none; }
.link-url { display: inline-block; margin-top: 5px; color: #9aa58e; }
.history-amount { text-align: right; flex-shrink: 0; }
.history-delta span { font-size: 10px; font-weight: 400; }
.history-icon.sale { color: #bb9070; background: #fbf1e7; }
.history-title .tag { margin-left: 7px; }
#history-kind { width: 140px; min-height: 38px; font-size: 11px; }
.backup-panel { padding: 0; }
.backup-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 22px; }
.backup-card h2 { margin: 13px 0 9px; color: #4c6444; font-size: 16px; font-weight: 550; }
.backup-card-icon { color: #79936c; }
.backup-card-icon svg { width: 28px; height: 28px; }
.backup-card p { flex: 1; }
.backup-meta { margin-bottom: 18px; font-size: 10px; color: #a8b09f; }
.help-panel h2 { margin: 0 0 23px; color: #5b7250; font-size: 16px; font-weight: 550; }
.help-panel .two-columns { grid-template-columns: 1fr 1fr; gap: 40px; }
.help-panel h3 { font-size: 12px; margin-top: 18px; margin-bottom: 5px; }
.help-panel h3:first-child { margin-top: 0; }
.backup-utility { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 23px 0 0; padding: 20px 24px; background: #ffffff80; border: 1px solid var(--line); border-radius: 10px; font-size: 12px; }
.backup-utility p { font-size: 11px; margin: 3px 0 0; }
label.field-label { display: flex; flex-direction: column; gap: 8px; }
.field-hint { margin: 0; font-size: 11px; }
.form-error { margin-top: 18px; margin-bottom: 0; }
.quantity-preview { flex-wrap: wrap; justify-content: flex-start; margin-top: 0; margin-bottom: 22px; }
.quantity-preview p { width: 100%; margin: 0; font-size: 11px; }
#movement-preview { margin: 0; }
.mapping-heading { margin: 25px 0 7px; }
.mapping-options { max-height: none; overflow: visible; margin-top: 14px; }
.mapping-option { display: grid; grid-template-columns: 1fr; gap: 2px; }
.mapping-option .mapping-alias { width: calc(100% - 24px); margin-left: 24px; }
.checkbox-label .product-meta { display: block; }
.checkbox-label strong { font-size: 12px; }
@media (max-width: 1200px) { .backup-grid { grid-template-columns: 1fr; } .backup-card { min-height: 0; } }
@media (max-width: 700px) {
  .sidebar-caption, .sidebar-note { display: none; }
  .nav-list { gap: 0; }.nav-count { display: none; }
  .nav-item { gap: 5px; padding-left: 8px; padding-right: 8px; }
  .onboarding-grid { margin: 15px 22px 26px; }
  .onboarding-step { padding: 18px 0 0; }
  .onboarding-step h3 { display: block; margin: 0 0 4px; }
  .onboarding-step p { padding: 0; }
  .links-grid { padding: 0 17px 17px; }
  .help-panel .two-columns { grid-template-columns: 1fr; gap: 19px; }
  .backup-utility { flex-direction: column; align-items: flex-start; }
  .table-bottom { flex-direction: column; gap: 3px; padding: 12px 17px; }
}

/* Return warehouse: versions, parcel intake, and waybill photos. */
.edition-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; margin-bottom: 24px; }
.edition-grid:has(> .edition-card:nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.edition-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; min-width: 0; min-height: 163px; padding: 23px 25px 21px; overflow: hidden; text-align: left; border: 1px solid transparent; border-radius: 14px; isolation: isolate; transition: transform .15s ease, outline-color .15s ease, box-shadow .15s ease; }
.edition-card:hover { transform: translateY(-2px); box-shadow: 0 7px 22px #263e2c0b; }
.edition-card.logo { color: #fff; background: #164e42; border-color: #164e42; }
.edition-card.blank { color: #694d31; background: #f2dfbf; border-color: #e7d2ad; }
.edition-card.unassigned { color: #657060; background: #e9ece4; border-color: #dce2d6; }
.edition-card.active { outline: 3px solid #b28c57; outline-offset: 3px; }
.edition-card.logo.active { outline-color: #7eaa92; }
.edition-kicker { position: relative; z-index: 1; display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 600; letter-spacing: .5px; }
.edition-kicker::before { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; content: ""; opacity: .8; }
.edition-total { position: relative; z-index: 1; margin-top: 13px; font-size: 36px; font-weight: 550; line-height: 1.15; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.edition-total span, .edition-total small { margin-left: 7px; font-size: 12px; font-weight: 400; letter-spacing: 0; opacity: .75; }
.edition-desc { position: relative; z-index: 1; margin-top: 10px; font-size: 11px; line-height: 1.75; opacity: .77; }
.edition-icon { position: absolute; z-index: 0; right: 22px; bottom: 18px; display: grid; place-items: center; width: 77px; height: 77px; color: currentColor; opacity: .13; transform: rotate(-8deg); }
.edition-icon svg { width: 72px; height: 72px; stroke-width: 1; }
.edition-badge { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 4px 8px; border: 1px solid transparent; border-radius: 5px; font-size: 10px; font-weight: 600; line-height: 1.5; white-space: nowrap; letter-spacing: .2px; }
.edition-badge.logo { color: #fff; background: #21604f; border-color: #21604f; }
.edition-badge.blank { color: #7c5730; background: #f2dfbf; border-color: #e7d2ad; }
.edition-badge.unassigned { color: #818a77; background: #eff1e9; border-color: #e0e5d8; }
.warehouse-hero { display: flex; align-items: center; justify-content: space-between; gap: 25px; padding: 21px 25px; margin-bottom: 24px; background: #edf3e8; border: 1px solid #e0e9d7; border-radius: 12px; }
.warehouse-hero h2, .warehouse-hero h3 { margin: 0 0 5px; color: #4d6941; font-size: 15px; font-weight: 600; }
.warehouse-hero p { margin: 0; color: #89977b; font-size: 12px; line-height: 1.9; }
.warehouse-hero > .btn { flex-shrink: 0; }
.warehouse-hero .return-flow-step { display: inline-flex; align-items: center; gap: 6px; margin-right: 14px; color: #7f9470; }
.return-flow-step { font-size: 11px; line-height: 1.8; }
.return-flow-step strong { display: inline-grid; place-items: center; width: 20px; height: 20px; color: #6d885c; background: #e1ebd9; border-radius: 50%; font-size: 10px; font-weight: 500; }
.return-intro { margin: 0 0 21px; color: #8a9a7a; font-size: 12px; line-height: 1.9; }
.return-intro strong { color: #607b50; font-weight: 600; }
.version-filter-note { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 9px; margin: -5px 0 19px; color: #85967b; font-size: 11px; }

.edition-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.edition-option { position: relative; display: block; min-width: 0; cursor: pointer; }
.edition-option > input[type="radio"] { position: absolute; left: 12px; top: 12px; width: 1px; height: 1px; opacity: 0; }
.edition-option-box { position: relative; display: flex; flex-direction: column; justify-content: center; min-height: 87px; padding: 17px 35px 17px 16px; border: 1px solid #dfe5d7; border-radius: 10px; transition: outline-color .15s ease, box-shadow .15s ease; }
.edition-option-box.logo { color: #275f4d; background: #eaf2e7; border-color: #d7e4d1; }
.edition-option-box.blank { color: #8d663b; background: #fbf0de; border-color: #ecd9b7; }
.edition-option-box::after { position: absolute; right: 13px; top: 15px; display: grid; place-items: center; width: 16px; height: 16px; color: transparent; background: #ffffffa6; border: 1px solid #bfcbb7; border-radius: 50%; content: "✓"; font-size: 10px; line-height: 1; }
.edition-option-box strong { display: block; font-size: 14px; font-weight: 600; letter-spacing: .4px; }
.edition-option-box small, .edition-option-box p { display: block; margin: 5px 0 0; font-size: 10px; font-weight: 400; line-height: 1.8; opacity: .8; }
.edition-option input:checked + .edition-option-box, .edition-option input:checked ~ .edition-option-box { outline: 2px solid #68895b; outline-offset: 2px; }
.edition-option input:checked + .edition-option-box.blank, .edition-option input:checked ~ .edition-option-box.blank { outline-color: #bd9158; }
.edition-option input:checked + .edition-option-box::after, .edition-option input:checked ~ .edition-option-box::after { color: #fff; background: #3d754d; border-color: #3d754d; }
.edition-option input:checked + .edition-option-box.blank::after, .edition-option input:checked ~ .edition-option-box.blank::after { background: #ad7e43; border-color: #ad7e43; }
.edition-option input:focus-visible + .edition-option-box, .edition-option input:focus-visible ~ .edition-option-box { box-shadow: 0 0 0 6px #bacdad50; }

.photo-dropzone { position: relative; padding: 25px 18px; color: #8d9d7e; background: #f7faf3; border: 1.5px dashed #cbd9be; border-radius: 11px; text-align: center; transition: background .15s ease, border-color .15s ease; }
.photo-dropzone:hover, .photo-dropzone:focus-within { background: #f0f6e8; border-color: #8fac7b; }
.photo-dropzone > svg, .photo-input-label > svg { display: block; width: 27px; height: 27px; margin: 0 auto 12px; color: #92ab7e; }
.photo-input-label { display: block; color: #6e865b; cursor: pointer; font-size: 12px; line-height: 1.9; }
.photo-input-label strong { display: block; margin-bottom: 5px; color: #607f4b; font-size: 13px; font-weight: 550; }
.photo-input-label small { display: block; margin-top: 6px; color: #a0ad92; font-size: 10px; line-height: 1.8; }
.photo-dropzone input[type="file"] { max-width: 100%; margin-top: 12px; min-height: 32px; background: #fff; font-size: 11px; }
.photo-guidance { margin: 10px 0 0; color: #99a58c; font-size: 10px; line-height: 1.85; }
.photo-count { display: inline-block; margin-left: 6px; padding: 1px 5px; color: #889b75; background: #eef4e6; border-radius: 4px; font-size: 10px; font-weight: 400; }
.photo-preview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 13px 0 0; }
.photo-preview { position: relative; min-width: 0; margin: 0; padding: 5px; color: #a2ae94; background: #f7f9f3; border: 1px solid #e3eadb; border-radius: 8px; }
.photo-preview img { display: block; width: 100%; height: 116px; background: #fff; border-radius: 4px; object-fit: contain; }
.photo-preview figcaption, .photo-preview small, .photo-preview .photo-name { display: block; padding: 5px 3px 1px; overflow: hidden; color: #9ba88d; font-size: 9px; line-height: 1.7; text-overflow: ellipsis; white-space: nowrap; }
.photo-remove { position: absolute; z-index: 1; right: -6px; top: -6px; display: grid; place-items: center; width: 22px; height: 22px; padding: 0; color: #997b66; background: #fff; border: 1px solid #e4d4c7; border-radius: 50%; box-shadow: 0 1px 4px #785d4420; font-size: 14px; line-height: 1; }
.photo-remove:hover { color: #a55e46; background: #fff5ed; }
.photo-remove svg { width: 12px; height: 12px; }
.tracking-field input { font-family: "SFMono-Regular", Consolas, monospace; letter-spacing: .5px; }

.return-lines { display: flex; flex-direction: column; gap: 10px; margin: 14px 0 0; }
.return-line { display: grid; grid-template-columns: minmax(0, 1fr) 84px 29px; align-items: start; gap: 8px; padding: 13px; background: #f7f9f3; border: 1px solid #e4eada; border-radius: 9px; }
.return-line-label { grid-column: 1 / -1; margin-bottom: 1px; color: #899d74; font-size: 10px; line-height: 1.7; }
.return-line select { min-height: 38px; padding: 9px; font-size: 11px; }
.return-line input[type="number"] { min-height: 38px; padding: 9px; text-align: center; font-size: 12px; }
.return-line .icon-btn, .return-line .btn.icon-btn { width: 29px; min-height: 38px; padding: 5px; color: #ae9984; }
.return-line .field { gap: 5px; }
.return-line .field-label { font-size: 10px; }
.return-add-line { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 35px; padding: 8px; margin-top: 11px; color: #789163; background: #f3f7ed; border: 1px dashed #d2dec6; border-radius: 7px; font-size: 11px; }
.return-add-line:hover { color: #557640; background: #edf4e4; border-color: #a7bd96; }
.return-add-line svg { width: 14px; height: 14px; }

.receipt-card { padding: 23px 25px; margin-bottom: 15px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.receipt-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 13px; }
.receipt-head h2, .receipt-head h3 { margin: 0 0 6px; color: #516947; font-size: 14px; font-weight: 550; }
.receipt-head .tag { vertical-align: 1px; }
.receipt-tracking { display: inline-flex; align-items: center; gap: 7px; color: #697b5c; font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; font-weight: 500; letter-spacing: .3px; overflow-wrap: anywhere; }
.receipt-meta { margin: 5px 0 0; color: #a0aa96; font-size: 10px; line-height: 1.85; overflow-wrap: anywhere; }
.receipt-items { display: flex; flex-direction: column; gap: 8px; padding: 16px 0; margin: 15px 0 0; color: #6c7e5e; border-top: 1px solid #edf0e6; font-size: 12px; }
.receipt-items > div, .receipt-items > li { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 7px; }
.receipt-items .edition-badge { margin-right: 6px; }
.receipt-items strong { color: #4b6d3c; font-size: 14px; font-weight: 550; font-variant-numeric: tabular-nums; }
.receipt-photos { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.receipt-photo { position: relative; display: grid; place-items: center; width: 73px; height: 81px; padding: 4px; overflow: hidden; color: #9eb28b; background: #f6f8f1; border: 1px solid #dfe8d5; border-radius: 7px; cursor: pointer; }
.receipt-photo:hover { background: #edf4e4; border-color: #a7bf95; }
.receipt-photo img { display: block; width: 100%; height: 100%; border-radius: 3px; object-fit: contain; }
.receipt-photo svg { width: 23px; height: 23px; }
.history-receipt-button { display: inline-flex; align-items: center; gap: 4px; padding: 3px 0; margin-top: 4px; color: #819c6c; background: transparent; border: 0; font-size: 10px; text-decoration: underline; text-underline-offset: 3px; }
.history-receipt-button:hover { color: #547e3c; }
.history-receipt-button svg { width: 12px; height: 12px; }

dialog.photo-viewer { position: fixed; inset: 0; width: min(1100px, calc(100vw - 60px)); max-width: calc(100vw - 40px); max-height: calc(100dvh - 50px); margin: auto; padding: 0; overflow: hidden; color: #586e4b; background: #fbfcf8; border: 1px solid #e1e7d9; border-radius: 14px; box-shadow: 0 16px 70px #1f362c30; }
dialog.photo-viewer[open] { display: flex; flex-direction: column; }
.photo-viewer-header { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; gap: 20px; padding: 17px 21px; border-bottom: 1px solid #e8ede0; }
.photo-viewer-header h2, .photo-viewer-header h3 { margin: 0; color: #5f7652; font-size: 14px; font-weight: 550; }
.photo-viewer-header p { margin: 3px 0 0; color: #a0ae92; font-size: 10px; line-height: 1.7; }
.photo-viewer-image { display: block; width: 100%; min-height: 0; max-height: calc(100dvh - 205px); padding: 16px; background: #ecf0e6; object-fit: contain; }
.photo-viewer-footer { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; flex-wrap: wrap; gap: 12px; padding: 13px 21px; color: #9daa90; font-size: 10px; }

@media (max-width: 980px) {
  .edition-grid { gap: 12px; }
  .edition-card { min-height: 152px; padding: 20px 18px 18px; }
  .edition-total { font-size: 32px; }
  .edition-kicker { font-size: 12px; }
  .edition-desc { font-size: 10px; }
  .edition-icon { right: 10px; bottom: 12px; width: 59px; height: 59px; }
  .edition-icon svg { width: 55px; height: 55px; }
  .warehouse-hero { align-items: flex-start; gap: 17px; padding: 20px; }
  .warehouse-hero .return-flow-step { margin-right: 9px; }
}
@media (max-width: 700px) {
  .edition-grid, .edition-grid:has(> .edition-card:nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; margin-bottom: 20px; }
  .edition-grid > .edition-card.unassigned { grid-column: 1 / -1; min-height: 106px; }
  .edition-card { min-height: 149px; padding: 19px 17px 16px; border-radius: 11px; }
  .edition-total { margin-top: 14px; font-size: 32px; }
  .edition-total span, .edition-total small { margin-left: 5px; font-size: 10px; }
  .edition-desc { margin-top: 10px; font-size: 9px; }
  .edition-kicker { gap: 7px; font-size: 12px; }
  .edition-kicker::before { width: 5px; height: 5px; }
  .edition-card.active { outline-width: 2px; outline-offset: 2px; }
  .edition-badge { padding: 3px 6px; font-size: 9px; }
  .warehouse-hero { flex-direction: column; align-items: stretch; gap: 15px; padding: 18px; margin-bottom: 21px; }
  .warehouse-hero h2, .warehouse-hero h3 { font-size: 14px; }
  .warehouse-hero p { font-size: 11px; }
  .warehouse-hero .return-flow-step { margin-right: 7px; font-size: 10px; }
  .warehouse-hero > .btn { align-self: flex-start; }
  .edition-options { gap: 10px; }
  .edition-option-box { min-height: 83px; padding: 15px 31px 15px 13px; }
  .edition-option-box strong { font-size: 13px; }
  .edition-option-box small, .edition-option-box p { font-size: 9px; }
  .edition-option-box::after { right: 10px; top: 13px; width: 15px; height: 15px; }
  .photo-dropzone { padding: 22px 15px; }
  .photo-preview-grid { gap: 8px; }
  .photo-preview img { height: 98px; }
  .photo-guidance { font-size: 10px; }
  .return-line { grid-template-columns: minmax(0, 1fr) 70px 26px; gap: 6px; padding: 11px; }
  .return-line select { padding: 9px 7px; font-size: 12px; }
  .return-line input[type="number"] { padding: 9px 6px; font-size: 16px; }
  .return-line .icon-btn, .return-line .btn.icon-btn { width: 26px; }
  .receipt-card { padding: 20px 18px; }
  .receipt-head h2, .receipt-head h3 { font-size: 13px; }
  .receipt-tracking { font-size: 11px; }
  .receipt-items { gap: 10px; font-size: 11px; }
  .receipt-photo { width: 67px; height: 75px; }
  dialog.photo-viewer { width: calc(100vw - 20px); max-width: calc(100vw - 20px); max-height: calc(100dvh - 28px); border-radius: 10px; }
  .photo-viewer-header { gap: 12px; padding: 15px 16px; }
  .photo-viewer-image { max-height: calc(100dvh - 185px); padding: 10px; }
  .photo-viewer-footer { padding: 12px 16px; }
}

/* Warehouse form and recognition integration. */
.edition-kicker { width: 100%; }
.edition-icon { top: 10px; right: 0; bottom: auto; width: 64px; height: 64px; font-size: 72px; font-family: Georgia, serif; line-height: 1; }
.edition-desc svg { width: 14px; height: 14px; margin-left: 8px; }
.warehouse-stats .stat-card { min-height: 125px; padding-top: 17px; }
.warehouse-stats .stat-value { font-size: 29px; }
.return-flow-step { display: flex; align-items: center; gap: 13px; margin: 25px 0 15px; }
.return-flow-step:first-child { margin-top: 0; }
.return-flow-step > strong { display: block; width: auto; height: auto; color: #516b47; background: none; border-radius: 0; font-size: 13px; font-weight: 550; }
.return-flow-step .step-number { font-size: 20px; }
.return-line { display: grid; grid-template-columns: 1fr; gap: 13px; }
.return-line-label { display: flex; align-items: center; justify-content: space-between; margin: 0; }
.return-line .edition-option-box { min-height: 67px; padding: 13px; }
.return-line label.field-label { font-size: 11px; }
.return-line input[type=number] { text-align: left; }
.return-line .line-sku { font-size: 12px; }
.return-add-line { margin-bottom: 20px; }
.return-confirm { margin-top: 20px; padding: 13px 14px; color: #677b5a; background: #f0f5eb; border: 1px solid #e0e9d7; border-radius: 8px; font-size: 12px; }
.photo-upload-actions { margin-top: 12px; }
.photo-input-label > span { font-size: 10px; }
.photo-count { margin: 5px 0 0; }
.ocr-panel { margin: 18px 0 24px; padding: 14px 16px; background: #edf3e9; border: 1px solid #dce7d4; border-radius: 9px; }
.ocr-heading { display: flex; align-items: center; justify-content: space-between; color: #647b53; font-size: 12px; }
#ocr-percent { color: #8c9c7f; font-size: 10px; }
#ocr-progress { width: 100%; height: 5px; margin: 14px 0 10px; accent-color: #64865a; }
.ocr-actions { display: flex; align-items: center; gap: 5px; margin-top: 10px; }
#ocr-result { margin-top: 10px; color: #6b805a; font-size: 11px; }
#ocr-result summary { cursor: pointer; }
#ocr-text { max-height: 180px; overflow: auto; margin: 8px 0 0; padding: 10px; white-space: pre-wrap; background: #ffffff99; border-radius: 5px; font-family: inherit; font-size: 11px; }
.receipt-list { padding: 0 25px 12px; }
.receipt-photo { height: 105px; }
.receipt-photo img { height: 73px; }
.receipt-photo span { font-size: 9px; color: #8b9b7e; }
.photo-missing { background: #fcf0e9; }
.version-filter-note { margin: 0; padding: 0 25px 17px; }
@media(max-width:700px){
  .return-line { grid-template-columns: 1fr; }
  .return-line .line-sku { font-size: 16px; }
  .receipt-list { padding: 0 17px 5px; }
  .version-filter-note { padding: 0 17px 14px; }
}

/* Shared cloud inventory and phone-first evidence pairing. */
.cloud-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; padding: 13px 17px; margin: 0 0 21px; color: #55715e; background: #edf4ed; border: 1px solid #dbe8dc; border-radius: 9px; font-size: 12px; line-height: 1.75; }
.cloud-state { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; min-width: 0; overflow-wrap: anywhere; }
.cloud-state strong { color: #315e49; font-weight: 550; }
.cloud-dot { display: inline-block; flex-shrink: 0; width: 7px; height: 7px; margin: 0 3px 0 1px; background: #52856b; border-radius: 50%; box-shadow: 0 0 0 3px #dfece0; }
.cloud-actions, .migration-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.cloud-actions .btn { min-height: 32px; padding-top: 5px; padding-bottom: 5px; }
.cloud-error, .cloud-bar.cloud-error { color: #996b47; background: #fbf1e4; border: 1px solid #ebd9be; border-radius: 9px; }
.cloud-error:not(.cloud-bar) { padding: 14px 17px; margin: 0 0 21px; font-size: 12px; line-height: 1.85; }
.cloud-error .cloud-dot { background: #c29257; box-shadow: 0 0 0 3px #f4e4cf; }
.cloud-error .cloud-state strong { color: #8b5e39; }
.cloud-signin { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 7px 13px; color: #fff; background: #164e42; border: 1px solid #164e42; border-radius: 7px; font-size: 12px; font-weight: 500; text-decoration: none; }
.cloud-signin:hover { color: #fff; background: #103d34; text-decoration: none; }
.migration-banner { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 14px 23px; padding: 18px 20px; margin: 0 0 21px; color: #8b795e; background: #fff8e9; border: 1px solid #eddfbc; border-radius: 10px; font-size: 12px; line-height: 1.9; }
.migration-banner strong { display: block; margin-bottom: 4px; color: #7b6445; font-weight: 550; }
.migration-banner p { margin: 4px 0 0; }
.migration-banner .migration-actions { align-self: center; }

.evidence-upload-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; margin: 15px 0 0; }
.evidence-upload-block { min-width: 0; padding: 15px 13px; background: #f7faf4; border: 1px solid #dfe8d8; border-radius: 10px; }
.evidence-upload-block:focus-within { border-color: #99b085; box-shadow: 0 0 0 3px #c6d5b82b; }
.evidence-label { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 7px; margin: 0 0 10px; color: #5e7850; font-size: 12px; font-weight: 550; line-height: 1.75; }
.evidence-label > small { display: block; width: 100%; color: #94a288; font-size: 10px; font-weight: 400; }
.evidence-role-badge { display: inline-flex; align-items: center; justify-content: center; gap: 5px; max-width: 100%; padding: 3px 7px; border: 1px solid transparent; border-radius: 5px; font-size: 10px; font-weight: 500; line-height: 1.6; white-space: nowrap; }
.evidence-role-badge.waybill { color: #4c765e; background: #e8f0e8; border-color: #d9e6d9; }
.evidence-role-badge.screenshot { color: #987345; background: #f8edda; border-color: #ebdabd; }
.evidence-upload-block input[type="file"] { max-width: 100%; min-width: 0; min-height: 34px; padding: 7px; font-size: 10px; background: #fff; }
.evidence-upload-block .photo-input-label { padding: 8px 2px; }
.evidence-upload-block .photo-input-label strong { font-size: 12px; }
.evidence-upload-block .btn { max-width: 100%; white-space: normal; }
.evidence-thumbs { display: flex; align-items: stretch; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.evidence-thumbs > .photo-preview { width: calc(50% - 4px); min-width: 0; }
.evidence-thumbs .photo-preview img { height: 100px; }
.evidence-thumbs:has(> .photo-preview:only-child) > .photo-preview { width: 100%; }
.evidence-thumbs:has(> .photo-preview:only-child) .photo-preview img { height: 125px; }
.evidence-pair-status { padding: 13px 15px; margin: 16px 0; color: #7d806f; background: #f2f4ed; border: 1px solid #e0e5d7; border-radius: 9px; font-size: 12px; line-height: 1.9; overflow-wrap: anywhere; }
.evidence-pair-status strong { font-weight: 550; }
.evidence-pair-status.matched { color: #4c7257; background: #eaf3e9; border-color: #cfe1cd; }
.evidence-pair-status.mismatch { color: #a1654e; background: #fcf0e8; border-color: #efd8c7; }
.evidence-pair-status.missing { color: #8b7b55; background: #faf5e8; border-color: #ebe1c8; }
.evidence-pair-status.ambiguous { color: #94734e; background: #faf0e2; border-color: #ebd9bb; }
.evidence-pair-meta { margin: 6px 0 0; color: inherit; font-size: 11px; font-weight: 400; line-height: 1.9; opacity: .86; overflow-wrap: anywhere; }
.evidence-summary { display: grid; grid-template-columns: 105px minmax(0, 1fr); gap: 9px 13px; padding: 15px 16px; margin: 12px 0 17px; background: #fafbf7; border: 1px solid #e6ebde; border-radius: 8px; font-size: 11px; line-height: 1.9; }
.evidence-summary dt { min-width: 0; margin: 0; color: #96a28b; font-weight: 400; }
.evidence-summary dd { min-width: 0; margin: 0; color: #5f7551; overflow-wrap: anywhere; word-break: break-word; }
.evidence-summary > div { display: grid; grid-template-columns: 105px minmax(0, 1fr); grid-column: 1 / -1; gap: 13px; }
.evidence-manual-confirm { display: flex; align-items: flex-start; gap: 9px; padding: 13px 14px; margin: 13px 0 18px; color: #8e7656; background: #fcf5e8; border: 1px solid #ebddc1; border-radius: 8px; font-size: 11px; line-height: 1.9; }
.evidence-manual-confirm input { flex-shrink: 0; margin-top: 4px; }
.copy-tracking-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.copy-tracking-row > input { flex: 1; min-width: 0; font-family: "SFMono-Regular", Consolas, monospace; letter-spacing: .3px; }
.copy-tracking-row > .btn { flex-shrink: 0; }
.readonly-search-note { margin: 7px 0 15px; color: #97a18f; font-size: 10px; line-height: 1.9; }
.receipt-source { margin: 13px 0 0; padding: 11px 13px; color: #839575; background: #f5f8ef; border: 1px solid #e6ecde; border-radius: 7px; font-size: 10px; line-height: 1.9; overflow-wrap: anywhere; }
.receipt-source strong { color: #657f55; font-weight: 500; }
.receipt-source-id { display: inline-block; margin-left: 5px; color: #718366; font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; word-break: break-word; }

.mobile-stock-list { display: none; }
.mobile-stock-card { position: relative; min-width: 0; padding: 17px; overflow: hidden; background: #fff; border: 1px solid #e4e9de; border-top: 3px solid #bac6af; border-radius: 10px; }
.mobile-stock-card.logo { border-top-color: #21604f; }
.mobile-stock-card.blank { border-top-color: #d5ad72; }
.mobile-stock-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.mobile-stock-name { display: block; min-width: 0; margin: 0; padding: 0; color: #41593b; font-size: 14px; font-weight: 600; line-height: 1.7; overflow-wrap: anywhere; }
button.mobile-stock-name { text-align: left; background: none; border: 0; }
.mobile-stock-meta { margin: 5px 0 0; color: #8c9b80; font-size: 12px; line-height: 1.9; overflow-wrap: anywhere; }
.mobile-stock-count { display: flex; align-items: baseline; justify-content: flex-end; gap: 5px; flex-shrink: 0; margin: 0; color: #2c5946; font-size: 32px; font-weight: 550; line-height: 1.3; font-variant-numeric: tabular-nums; letter-spacing: -.8px; }
.mobile-stock-count small, .mobile-stock-count .qty-unit { color: #9da98f; font-size: 11px; font-weight: 400; letter-spacing: 0; }
.mobile-stock-count .qty { font-size: inherit; font-weight: inherit; }
.mobile-stock-count .qty.muted { color: #a8b09d; font-size: 22px; }
.mobile-stock-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding-top: 14px; margin-top: 13px; border-top: 1px solid #eff2e8; }
.mobile-stock-actions .btn { flex: 1; min-height: 40px; padding: 8px 10px; font-size: 12px; }
.mobile-stock-actions .btn.ghost { flex: 0 1 auto; }

@media (max-width: 700px) {
  .cloud-bar { align-items: flex-start; flex-direction: column; gap: 11px; padding: 13px 15px; margin-bottom: 18px; font-size: 12px; }
  .cloud-actions { width: 100%; gap: 7px; }
  .cloud-actions .btn { min-height: 36px; font-size: 11px; }
  .cloud-signin { min-height: 40px; font-size: 12px; }
  .migration-banner { padding: 16px; gap: 12px; margin-bottom: 18px; font-size: 12px; }
  .migration-actions { width: 100%; }
  .migration-actions .btn { flex: 1; min-height: 40px; font-size: 11px; white-space: normal; }
  .evidence-upload-grid { grid-template-columns: 1fr; gap: 13px; }
  .evidence-upload-block { padding: 16px; }
  .evidence-label { font-size: 13px; }
  .evidence-role-badge { padding: 4px 8px; font-size: 11px; }
  .evidence-upload-block .photo-input-label strong { font-size: 13px; }
  .evidence-upload-block input[type="file"] { font-size: 12px; }
  .evidence-thumbs { gap: 10px; }
  .evidence-thumbs > .photo-preview { width: calc(50% - 5px); }
  .evidence-thumbs .photo-preview img { height: 120px; }
  .evidence-thumbs:has(> .photo-preview:only-child) .photo-preview img { height: 150px; }
  .evidence-pair-status { padding: 13px 14px; font-size: 12px; }
  .evidence-pair-meta, .readonly-search-note { font-size: 11px; }
  .evidence-summary { grid-template-columns: 78px minmax(0, 1fr); gap: 9px 11px; padding: 14px; font-size: 12px; }
  .evidence-summary > div { grid-template-columns: 78px minmax(0, 1fr); gap: 11px; }
  .evidence-manual-confirm { font-size: 12px; }
  .copy-tracking-row > input { font-size: 14px; }
  .copy-tracking-row > .btn { min-height: 40px; font-size: 11px; }
  .warehouse-table { display: none !important; }
  .mobile-stock-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 11px; padding: 0 16px 17px; }
  .mobile-stock-head .edition-badge { margin-top: 6px; font-size: 10px; }
  .mobile-stock-meta .badge { font-size: 10px; }
  .receipt-source { padding: 12px; font-size: 11px; }
  .receipt-source-id { margin-left: 0; font-size: 11px; }
}
