:root {
  --ink: #1a1a17;
  --ink-2: #2a2924;
  --muted: #75736a;
  --line: #e7e3da;
  --line-dark: #d6d0c4;
  --paper: #f6f4ef;
  --card: #fffefb;
  --gold: #b9954c;
  --gold-deep: #8d6b2d;
  --gold-soft: #eee3ca;
  --green: #49745c;
  --red: #9d584d;
  --shadow: 0 18px 50px rgba(30, 29, 24, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-width: 1180px; background: var(--ink); }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
svg:not(.legacy-label-paper):not(.label-barcode) { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  color: #f4f0e6;
  background:
    radial-gradient(circle at 15% 0%, rgba(185, 149, 76, .2), transparent 26%),
    linear-gradient(180deg, #1d1d19 0%, #121310 100%);
  border-right: 1px solid rgba(255,255,255,.06);
  z-index: 5;
}

.brand {
  min-height: 92px;
  padding: 22px 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.brand-logo { display: block; width: 100%; max-width: 102px; height: auto; }

.primary-nav { min-height: 0; padding: 24px 14px; overflow-y: auto; }
.nav-label { margin: 0 12px 10px; color: #77776f; font-size: 10px; font-weight: 700; letter-spacing: 2.4px; text-transform: uppercase; }

.nav-item {
  position: relative;
  width: 100%;
  height: 48px;
  padding: 0 14px;
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 12px;
  align-items: center;
  color: #aead9f;
  background: transparent;
  border: 0;
  border-radius: 7px;
  text-align: left;
  transition: .2s ease;
}

.nav-item::before { content: ""; position: absolute; left: -14px; width: 2px; height: 20px; background: transparent; }
.nav-item:hover { color: white; background: rgba(255,255,255,.04); }
.nav-item.is-active { color: #f6e5bd; background: linear-gradient(90deg, rgba(185,149,76,.18), rgba(185,149,76,.05)); }
.nav-item.is-active::before { background: #d2ad61; }
.nav-item svg { width: 19px; height: 19px; }
.nav-item span { font-weight: 550; letter-spacing: .3px; }
.nav-item em { padding: 3px 6px; color: #d6bc81; background: rgba(185,149,76,.14); border-radius: 20px; font-size: 9px; font-style: normal; }
.nav-item b { width: 20px; height: 20px; display: grid; place-items: center; color: #161611; background: #caa65c; border-radius: 50%; font-size: 10px; }
.nav-group { width: 100%; }
.nav-group-toggle { width: 100%; height: 48px; padding: 0 14px; display: grid; grid-template-columns: 22px 1fr auto; gap: 12px; align-items: center; color: #aead9f; background: transparent; border: 0; border-radius: 7px; text-align: left; }
.nav-group-toggle:hover, .nav-group.is-active .nav-group-toggle { color: #f6e5bd; background: rgba(185,149,76,.08); }
.nav-group-toggle svg { width: 19px; height: 19px; }
.nav-group-toggle span { font-weight: 550; letter-spacing: .3px; }
.nav-group-toggle i { color: #77776f; font-size: 13px; font-style: normal; transition: transform .18s ease; }
.nav-group-toggle[aria-expanded="false"] i { transform: rotate(-90deg); }
.nav-submenu { display: none; margin: 0 0 4px 24px; padding: 2px 0 3px 12px; border-left: 1px solid rgba(208,176,107,.2); }
.nav-submenu.is-open { display: block; }
.nav-item.sub { height: 38px; padding: 0 9px; grid-template-columns: 1fr auto; gap: 8px; font-size: 12px; }
.nav-item.sub::before { left: -13px; height: 14px; }
.nav-item.sub em { font-size: 8px; }
.nav-item.sub b { width: 18px; height: 18px; font-size: 9px; }

.sidebar-footer { margin-top: auto; padding: 14px; border-top: 1px solid rgba(255,255,255,.07); }
.connection-dot { padding: 2px 10px 14px; display: flex; gap: 8px; align-items: center; color: #818078; font-size: 11px; }
.connection-dot i { width: 6px; height: 6px; background: #70a47e; border-radius: 50%; box-shadow: 0 0 0 4px rgba(112,164,126,.1); }
.operator-card { padding: 11px; display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; background: rgba(255,255,255,.045); border-radius: 7px; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; color: #2a2316; background: linear-gradient(145deg, #e2ca98, #a7813a); border-radius: 50%; font-weight: 700; }
.operator-card div { display: grid; gap: 3px; }
.operator-card strong { font-size: 12px; font-weight: 600; }
.operator-card small { color: #77776f; font-size: 10px; }
.more { color: #77776f; letter-spacing: 1px; }

.workspace { min-width: 0; }
.topbar { height: 92px; padding: 0 34px; display: flex; align-items: center; justify-content: space-between; background: rgba(246,244,239,.96); border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 3px 0 0; font-family: "Songti SC", STSong, Georgia, serif; font-size: 25px; font-weight: 600; letter-spacing: 1px; }
.eyebrow, .section-kicker { margin: 0; color: var(--gold-deep); font-size: 9px; font-weight: 800; letter-spacing: 2.2px; }
.topbar-actions { display: flex; gap: 12px; align-items: center; }

.global-search { width: 330px; height: 48px; padding: 0 12px; display: grid; grid-template-columns: 20px 1fr auto; gap: 9px; align-items: center; background: #ece9e2; border: 1px solid transparent; border-radius: 7px; color: #8c897f; }
.global-search:focus-within { background: white; border-color: #d7cfbe; }
.global-search svg { width: 18px; }
.global-search input { width: 100%; background: transparent; border: 0; outline: 0; color: var(--ink); font-size: 12px; }
.global-search kbd { padding: 3px 6px; color: #89867e; background: #f7f5f0; border: 1px solid #ddd8ce; border-radius: 4px; font: 10px/1 sans-serif; }

.gold-rate-button { height: 54px; padding: 0 12px; display: grid; grid-template-columns: 28px auto auto; gap: 9px; align-items: center; color: #efe8db; background: var(--ink); border: 1px solid #302f2a; border-radius: 7px; text-align: left; box-shadow: 0 8px 20px rgba(20,20,16,.1); }
.gold-rate-button svg { color: #d0ad63; }
.gold-rate-button span { display: grid; gap: 3px; }
.gold-rate-button small { color: #8f8d84; font-size: 9px; letter-spacing: .5px; }
.gold-rate-button strong { font-size: 12px; font-weight: 600; }
.gold-rate-button i { padding: 3px 5px; color: #bb9b5c; background: rgba(185,149,76,.12); border-radius: 3px; font-size: 9px; font-style: normal; }

.view { display: none; padding: 28px 34px 50px; animation: view-in .25s ease; }
.view.is-visible { display: block; }
@keyframes view-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.hero-panel {
  position: relative;
  min-height: 326px;
  padding: 42px 48px;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  overflow: hidden;
  color: #f6f2e9;
  background:
    linear-gradient(110deg, rgba(18,18,15,.98) 0%, rgba(33,31,24,.96) 56%, rgba(65,54,33,.96) 100%),
    #1c1c18;
  border: 1px solid #292822;
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.hero-panel::after { content: ""; position: absolute; inset: 0; opacity: .28; background-image: linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px); background-size: 32px 32px; mask-image: linear-gradient(90deg, transparent 15%, black 100%); }
.hero-copy { position: relative; z-index: 2; }
.soft-badge { display: inline-flex; padding: 6px 9px; color: #a57d36; background: #f1e7d2; border: 1px solid #e5d5b3; border-radius: 3px; font-size: 9px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.hero-copy .soft-badge { color: #d7b973; background: rgba(185,149,76,.1); border-color: rgba(185,149,76,.28); }
.hero-copy h2 { margin: 20px 0 13px; font-family: "Songti SC", STSong, Georgia, serif; font-size: 38px; line-height: 1.3; font-weight: 500; letter-spacing: 2px; }
.hero-copy h2 em { color: #d2af68; font-style: normal; }
.hero-copy > p { max-width: 470px; margin: 0; color: #aaa79d; font-size: 13px; line-height: 1.8; }
.hero-actions { margin-top: 28px; display: flex; gap: 10px; }

.button { height: 42px; padding: 0 17px; display: inline-flex; gap: 8px; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 5px; font-size: 12px; font-weight: 650; letter-spacing: .3px; transition: .18s ease; }
.button svg { width: 16px; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .48; transform: none; box-shadow: none; }
.button-gold { color: #201d15; background: linear-gradient(135deg, #d5b66e, #ad8438); border-color: #d7ba79; box-shadow: 0 9px 24px rgba(185,149,76,.18); }
.button-dark { color: #f4eee0; background: #22221e; border-color: #3b3932; }
.button-light { color: var(--ink); background: var(--card); border-color: var(--line-dark); }
.button-subtle { color: #78756d; background: rgba(255, 255, 255, .45); border-color: #ded8cb; }
.button-subtle svg { color: #9e9a91; }
.button-subtle:hover { color: var(--ink); background: var(--card); border-color: var(--line-dark); }
.button-subtle:hover svg { color: var(--ink); }
.button-stop { color: #975b51; background: transparent; border-color: rgba(151,91,81,.5); }
.button-stop:hover { color: #7f463d; background: rgba(151,91,81,.08); border-color: #975b51; }
.button.full { width: 100%; }

.hero-visual { position: relative; z-index: 2; min-height: 220px; }
.orbital-ring { position: absolute; left: 50%; top: 50%; border: 1px solid rgba(215,185,115,.25); border-radius: 50%; transform: translate(-50%, -50%) rotate(-15deg); }
.ring-one { width: 290px; height: 180px; }
.ring-two { width: 220px; height: 290px; transform: translate(-50%, -50%) rotate(52deg); }
.gem-core { position: absolute; left: 50%; top: 50%; width: 128px; height: 128px; display: grid; place-content: center; text-align: center; transform: translate(-50%, -50%) rotate(45deg); background: linear-gradient(145deg, rgba(206,173,101,.25), rgba(255,255,255,.02)); border: 1px solid rgba(227,199,133,.62); box-shadow: inset 0 0 34px rgba(228,195,120,.1), 0 0 50px rgba(0,0,0,.28); }
.gem-core::before { content: ""; position: absolute; inset: 14px; border: 1px solid rgba(222,195,133,.25); }
.gem-core span, .gem-core small { transform: rotate(-45deg); }
.gem-core span { color: #e3c67f; font: 600 29px/1 Georgia, serif; letter-spacing: 3px; }
.gem-core small { margin-top: 8px; color: #8f8c82; font-size: 8px; letter-spacing: 2px; }
.floating-metric { position: absolute; min-width: 122px; padding: 12px 14px; display: grid; grid-template-columns: 1fr auto; gap: 2px 7px; background: rgba(20,20,17,.8); border: 1px solid rgba(255,255,255,.09); backdrop-filter: blur(8px); }
.floating-metric small { grid-column: 1 / -1; color: #88877e; font-size: 9px; letter-spacing: 1px; }
.floating-metric strong { color: #eee3ca; font-size: 18px; }
.floating-metric span { align-self: end; color: #7e7b71; font-size: 10px; }
.metric-a { left: 5%; top: 12%; }
.metric-b { right: 1%; bottom: 8%; }

.metric-grid { margin-top: 18px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.metric-grid.compact { grid-template-columns: repeat(3, 1fr); margin: 0 0 18px; }
.metric-card { position: relative; min-height: 156px; padding: 21px 22px; overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 28px rgba(30,29,24,.035); }
.metric-head { display: flex; align-items: center; justify-content: space-between; color: #66645d; font-size: 11px; }
.metric-head i { color: #8f8c83; font-size: 9px; font-style: normal; }
.metric-head .trend-up { color: var(--green); }
.metric-card > strong { display: block; margin-top: 18px; font-family: "SF Pro Display", "PingFang SC", sans-serif; font-size: 25px; font-weight: 610; letter-spacing: -.5px; }
.metric-card > p { margin: 8px 0 0; color: #918e85; font-size: 10px; }
.sparkline { position: absolute; right: 20px; bottom: 20px; width: 75px; height: 32px; display: flex; gap: 4px; align-items: end; }
.sparkline i { flex: 1; background: linear-gradient(#c6a55d, #e8dbc0); border-radius: 2px 2px 0 0; }
.metric-rule { position: absolute; left: 22px; right: 22px; bottom: 24px; height: 3px; background: #eeeae2; }
.metric-rule span { display: block; height: 100%; background: #b9954c; }
.cost-card { background: #f1eee7; }
.cost-card.is-live { color: #f4efe5; background: #20201c; border-color: #292923; }
.cost-card.is-live .metric-head, .cost-card.is-live > p { color: #8f8c82; }
.cost-card.is-live > strong { color: #e0c27d; }
.cost-mark { position: absolute; right: -5px; bottom: 12px; color: rgba(28,28,24,.06); font: 800 26px/1 Georgia, serif; letter-spacing: 2px; }
.cost-mark.live { color: rgba(231,201,131,.08); }
.live-indicator { display: flex; gap: 5px; align-items: center; color: #bca468 !important; }
.live-indicator b { width: 5px; height: 5px; background: #bca468; border-radius: 50%; box-shadow: 0 0 0 4px rgba(188,164,104,.1); }

.dashboard-grid { margin-top: 18px; display: grid; grid-template-columns: 1.7fr .8fr; gap: 18px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 28px rgba(30,29,24,.035); }
.panel-heading { padding: 20px 22px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.panel-heading h3 { margin: 5px 0 0; font-family: "Songti SC", STSong, Georgia, serif; font-size: 17px; font-weight: 650; letter-spacing: .5px; }
.segmented { padding: 3px; display: flex; background: #efede7; border-radius: 5px; }
.segmented button { height: 26px; padding: 0 10px; color: #858279; background: transparent; border: 0; border-radius: 3px; font-size: 9px; }
.segmented button.is-active { color: var(--ink); background: white; box-shadow: 0 2px 8px rgba(30,29,24,.08); }
.text-button { display: inline-flex; gap: 4px; align-items: center; color: var(--gold-deep); background: transparent; border: 0; font-size: 10px; font-weight: 700; }
.text-button svg { width: 13px; }

.cost-comparison { min-height: 270px; padding: 26px 24px; display: grid; grid-template-columns: .7fr 1.3fr; gap: 30px; align-items: center; }
.cost-summary small { color: #8f8c83; font-size: 10px; }
.cost-summary strong { display: block; margin: 10px 0 9px; color: var(--gold-deep); font: 500 38px/1 Georgia, serif; }
.cost-summary p { margin: 0; color: #858279; font-size: 10px; line-height: 1.7; }
.cost-chart { position: relative; height: 220px; padding-left: 44px; }
.cost-chart svg { width: 100%; height: 190px; overflow: visible; stroke-linecap: round; }
.chart-labels { position: absolute; left: 0; top: 6px; bottom: 42px; display: flex; flex-direction: column; justify-content: space-between; color: #aaa69d; font-size: 8px; }
.chart-grid { stroke: #ece8df; stroke-width: 1; }
.chart-area { fill: url(#areaGold); stroke: none; }
.chart-line { fill: none; stroke-width: 2.4; }
.live-line { stroke: #ae8740; }
.book-line { stroke: #4a4943; stroke-width: 1.4; stroke-dasharray: 4 5; }
.chart-legend { display: flex; gap: 18px; color: #858279; font-size: 9px; }
.chart-legend span { display: flex; gap: 6px; align-items: center; }
.chart-legend i { width: 14px; height: 2px; }
.chart-legend i.gold { background: #ae8740; }
.chart-legend i.charcoal { background: #4a4943; }

.gold-panel { min-width: 320px; }
.metal-rate-list { padding: 4px 22px 0; }
.metal-rate-item { padding: 15px 0; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; border-bottom: 1px solid var(--line); }
.metal-rate-item:last-child { border-bottom: 0; }
.metal-rate-item div { display: grid; gap: 3px; }
.metal-rate-item strong { font-size: 12px; }
.metal-rate-item small { color: #9a978e; font-size: 9px; }
.metal-rate-item > b { font: 600 16px/1 Georgia, serif; }
.metal-rate-item > span { grid-column: 2; justify-self: end; color: var(--green); font-size: 8px; }
.data-note { margin: 0 22px 20px; padding: 11px 12px; color: #8d897f; background: #f5f2eb; border-left: 2px solid #c8a95f; font-size: 9px; line-height: 1.6; }
.data-empty { padding: 30px; display: grid; place-items: center; gap: 8px; color: #827e74; text-align: center; }
.data-empty strong { color: #4a4841; font: 600 17px/1.2 "Songti SC", STSong, serif; }
.data-empty p { max-width: 560px; margin: 0; color: #969188; font-size: 9px; line-height: 1.7; }
.cost-data-empty { min-height: 250px; align-content: center; background: linear-gradient(135deg, #fbfaf6, #f1ede4); }
.compact-empty { min-height: 92px; margin: 18px 46px 26px; border: 1px dashed #d9d2c6; border-radius: 6px; }
.sale-empty { margin-top: 20px; }
.full-empty { min-height: 280px; grid-column: 1/-1; }

.recent-panel { margin-top: 18px; }
.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 15px; color: #8d8a81; background: #f4f1ea; border-bottom: 1px solid var(--line); font-size: 9px; font-weight: 700; letter-spacing: .4px; text-align: left; white-space: nowrap; }
td { padding: 13px 15px; border-bottom: 1px solid #eeeae2; color: #54524c; font-size: 10px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbf9f4; }
.product-cell { display: flex; gap: 10px; align-items: center; }
.product-thumb { width: 31px; height: 31px; position: relative; display: grid; place-items: center; background: #272721; border-radius: 5px; flex-shrink: 0; overflow: hidden; }
.product-thumb::after { content: ""; width: 9px; height: 9px; border: 2px solid #d3b56f; transform: rotate(45deg); }
.product-thumb.has-image::after { display: none; }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 5px; }
.product-cell div { display: grid; gap: 3px; }
.product-cell strong { color: var(--ink); font-size: 11px; }
.product-cell small { color: #aaa69c; font-size: 8px; }
.delta-up { color: var(--red); }
.delta-down { color: var(--green); }
.status { display: inline-flex; padding: 4px 7px; border-radius: 20px; font-size: 8px; font-weight: 700; }
.status.stocked { color: #4e765c; background: #e8f0e8; }
.status.warning { color: #8d6b2d; background: #f4ecd9; }
.status.transit { color: #536c83; background: #e6edf2; }

.inventory-page-head { margin-bottom: 14px; }
.inventory-live-strip { min-height: 45px; margin-bottom: 14px; padding: 0 16px; display: flex; align-items: center; gap: 12px; color: #d9d2c3; background: linear-gradient(90deg, #20201c, #2d291f); border: 1px solid #343229; border-radius: 7px; }
.inventory-live-strip > span { display: flex; gap: 8px; align-items: center; color: #e1c57f; font-size: 10px; font-weight: 700; }
.inventory-live-strip i { width: 7px; height: 7px; background: #72a17e; border-radius: 50%; box-shadow: 0 0 0 5px rgba(114,161,126,.12); }
.inventory-live-strip b { padding: 4px 7px; color: #90aa96; background: rgba(114,161,126,.1); border-radius: 3px; font-size: 8px; }
.inventory-live-strip p { margin-left: auto; color: #77746c; font-size: 9px; }
.inventory-kpis { margin-top: 0; }
.inventory-kpi { min-height: 144px; }
.inventory-kpi > strong { font-size: 24px; }
.inventory-kpi.book { background: #f1eee7; }
.inventory-kpi.live { color: #f4efe5; background: #20201c; border-color: #292923; }
.inventory-kpi.live .metric-head, .inventory-kpi.live > p { color: #8f8c82; }
.inventory-kpi.live > strong { color: #e0c27d; }
.inventory-kpi-mark { position: absolute; right: 12px; bottom: 10px; color: rgba(28,28,24,.055); font: 800 25px/1 Georgia, serif; letter-spacing: 2px; }
.inventory-kpi.live .inventory-kpi-mark { color: rgba(231,201,131,.07); }
.inventory-table-panel { margin-top: 16px; overflow: visible; }
.inventory-commandbar { min-height: 52px; padding: 8px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #e8e1d4; background: linear-gradient(100deg, #22221d, #2b2922); border-radius: 8px 8px 0 0; }
.inventory-command-group { display: flex; align-items: center; gap: 5px; }
.command-button { min-height: 34px; padding: 0 12px; display: inline-flex; align-items: center; gap: 7px; color: #d5cec1; background: transparent; border: 1px solid rgba(222,203,160,.14); border-radius: 4px; font-size: 9px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.command-button:hover, .command-button[aria-pressed="true"] { color: #ead495; background: rgba(202,169,91,.1); border-color: rgba(222,195,130,.35); }
.command-button svg { width: 15px; }
.inventory-selection { color: #8f8b82; font-size: 8px; white-space: nowrap; }
.column-settings { position: relative; }
.column-settings > summary { list-style: none; }
.column-settings > summary::-webkit-details-marker { display: none; }
.column-settings-popover { position: absolute; z-index: 8; top: 42px; right: 0; width: 330px; padding: 15px; color: var(--ink); background: #fffefb; border: 1px solid #d7d0c3; border-radius: 6px; box-shadow: 0 22px 55px rgba(28,27,23,.22); }
.column-settings-popover > div:first-child { padding-bottom: 10px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.column-settings-popover > div:first-child span { display: grid; gap: 3px; }
.column-settings-popover > div:first-child small { color: #9b968b; font-size: 7px; font-weight: 400; }
.column-settings-popover strong { font-size: 10px; }
.column-settings-popover button { padding: 0; color: var(--gold-deep); background: transparent; border: 0; font-size: 8px; cursor: pointer; }
.column-settings-list { max-height: min(520px, 65vh); overflow-y: auto; }
.column-settings-list label { min-height: 34px; display: grid; grid-template-columns: 16px minmax(0, 1fr) 62px; align-items: center; gap: 8px; color: #66635c; border-bottom: 1px solid #f0ece4; font-size: 9px; }
.column-settings-list label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.column-settings-list input[type="number"] { width: 62px; height: 25px; padding: 0 5px; font-size: 8px; }
.column-settings-popover input, .inventory-detail-table input[type="checkbox"] { width: 14px; height: 14px; accent-color: #a9853e; }
.inventory-toolbar { padding: 16px; display: grid; grid-template-columns: repeat(6, minmax(118px, 1fr)); gap: 11px 10px; align-items: end; background: #fffefb; border: 1px solid var(--line); border-top: 0; }
.inventory-toolbar label, .advanced-inventory label { display: grid; gap: 6px; }
.inventory-toolbar label > span, .advanced-inventory label > span { color: #77736a; font-size: 8px; font-weight: 700; }
.inventory-toolbar select, .inventory-toolbar input { height: 37px; }
.inventory-code-filter { grid-column: span 2; }
.inventory-query-actions { grid-column: span 2; height: 37px; display: flex; gap: 7px; align-items: center; }
.inventory-query-actions .button { height: 37px; }
.inventory-query-actions svg { width: 14px; }
.inventory-query-actions .button-light.is-active { color: #846528; border-color: #b99b59; background: #f4ecd9; }
.inventory-reset { margin-left: 2px; }
.advanced-inventory { padding: 14px 16px; display: grid; grid-template-columns: 1.45fr repeat(6, minmax(110px, 1fr)); gap: 10px; align-items: end; background: #f2eee5; border: 1px solid #ded7ca; border-top: 0; }
.advanced-inventory[hidden] { display: none; }
.advanced-inventory > div { align-self: center; display: grid; gap: 3px; }
.advanced-inventory > div strong { font: 600 15px/1.2 "Songti SC", STSong, serif; }
.advanced-inventory > div p { margin: 0; color: #969188; font-size: 7px; }
.advanced-inventory input, .advanced-inventory select { height: 36px; }
.inventory-summary { min-height: 65px; display: grid; grid-template-columns: 1.25fr repeat(5, 1fr); color: #e5ded1; background: #2b2a24; border-top: 1px solid #3b382f; }
.inventory-summary > span { padding: 13px 16px; display: grid; gap: 6px; border-right: 1px solid rgba(255,255,255,.07); }
.inventory-summary > span:last-child { border-right: 0; }
.inventory-summary small { color: #827f77; font-size: 8px; }
.inventory-summary strong { color: #d7d0c3; font: 600 14px/1 Georgia, "Songti SC", serif; }
.inventory-summary > span:nth-child(5) strong { color: #e0c27d; }
.inventory-subtotals { padding: 10px 12px; display: flex; gap: 8px; overflow-x: auto; background: #f6f3ec; border: 1px solid var(--line); border-top: 0; }
.inventory-subtotals[hidden] { display: none; }
.inventory-subtotals span { min-width: 205px; padding: 9px 11px; display: grid; gap: 4px; background: #fffefb; border: 1px solid #e5dfd3; border-radius: 4px; }
.inventory-subtotals strong { color: #625a49; font-size: 9px; }
.inventory-subtotals small { color: #979289; font-size: 8px; }
.inventory-table-wrap { max-height: calc(100vh - 420px); min-height: 330px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.inventory-detail-table { table-layout: fixed; }
.inventory-detail-table thead { position: sticky; top: 0; z-index: 2; }
.inventory-detail-table th[data-column="select"], .inventory-detail-table td[data-column="select"] { width: 38px; min-width: 38px; max-width: 38px; }
.inventory-detail-table th[data-column]:not([data-column="select"]) { position: relative; cursor: grab; user-select: none; }
.inventory-detail-table th[aria-sort="ascending"], .inventory-detail-table th[aria-sort="descending"] { color: #76571b; background: #f5ecd8; }
.inventory-detail-table th.is-column-dragging,
.inbound-lines-table th.is-column-dragging,
.inbound-detail-lines th.is-column-dragging { opacity: .35; }
.inventory-detail-table th.is-column-drop-before,
.inbound-lines-table th.is-column-drop-before,
.inbound-detail-lines th.is-column-drop-before { box-shadow: inset 3px 0 #b18b3f; }
.inventory-detail-table th.is-column-drop-after,
.inbound-lines-table th.is-column-drop-after,
.inbound-detail-lines th.is-column-drop-after { box-shadow: inset -3px 0 #b18b3f; }
.inventory-column-resizer { position: absolute; z-index: 4; top: 0; right: -4px; width: 8px; height: 100%; cursor: col-resize; touch-action: none; }
.inventory-column-resizer::after { content: ""; position: absolute; top: 20%; bottom: 20%; left: 3px; width: 1px; background: #c9c1b3; opacity: .55; }
.inventory-detail-table th:hover .inventory-column-resizer::after { width: 2px; background: #a9853e; opacity: 1; }
.inventory-detail-table.is-resizing, .inventory-detail-table.is-resizing * { cursor: col-resize !important; user-select: none !important; }
.inventory-detail-table td { height: 58px; }
.inventory-detail-table td > small { margin-top: 4px; display: block; color: #aaa69c; font-size: 7px; }
.inventory-detail-table .live-cost-cell { color: var(--gold-deep); font-weight: 750; }
.inventory-detail-table .rate-cell { color: #77746c; }
.inventory-detail-table .empty-inventory { height: 220px; color: #969289; text-align: center; }
.inventory-table-panel:not(.images-visible) .inventory-detail-table .product-thumb { display: none; }
.inventory-code { color: #3c3a34; font: 700 10px/1 monospace; letter-spacing: .2px; }
.tracking-badge { width: max-content; margin-top: 4px; padding: 2px 5px; display: block; color: #896b2e !important; background: #f3ead5; border-radius: 2px; font-size: 7px !important; }
.column-hidden { display: none !important; }
.stock-status { display: inline-flex; gap: 6px; align-items: center; }
.stock-status::before { content: ""; width: 5px; height: 5px; background: #638c70; border-radius: 50%; }
.stock-status.warning::before { background: #bd8b35; }
.stock-status.transit::before { background: #5d7c99; }
.inventory-table-foot { min-height: 45px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; color: #8c897f; background: #f7f4ed; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 8px 8px; font-size: 9px; }
.inventory-table-foot b { color: var(--gold-deep); }

.stocktake-page-head { margin-bottom: 15px; }
.stocktake-task-bar { min-height: 76px; padding: 13px 17px; display: grid; grid-template-columns: 1fr auto auto; gap: 28px; align-items: center; color: #eee8dc; background: linear-gradient(100deg, #20201c, #29261e); border: 1px solid #333128; border-radius: 8px; }
.stocktake-task-bar.is-empty { background: linear-gradient(100deg, #292823, #33312a); }
.stocktake-task-bar.is-empty .stocktake-running i { background: #918d84; box-shadow: 0 0 0 4px rgba(145,141,132,.1); }
.stocktake-task-bar > div { display: grid; grid-template-columns: auto auto 1fr; gap: 8px 11px; align-items: center; }
.stocktake-task-bar strong { font-size: 12px; }
.stocktake-task-bar p { grid-column: 1/-1; margin: 0; color: #8d8a81; font-size: 9px; }
.stocktake-running { padding: 4px 8px; display: inline-flex; gap: 6px; align-items: center; color: #8fb39a; background: rgba(95,139,108,.13); border-radius: 20px; font-size: 8px; font-weight: 700; }
.stocktake-running i, .scanner-connected i { width: 6px; height: 6px; background: #6da17b; border-radius: 50%; box-shadow: 0 0 0 4px rgba(109,161,123,.1); }
.stocktake-task-bar dl { margin: 0; display: flex; gap: 26px; }
.stocktake-task-bar dl div { display: grid; gap: 4px; }
.stocktake-task-bar dt { color: #77746c; font-size: 8px; }
.stocktake-task-bar dd { margin: 0; color: #d7d1c6; font-size: 10px; font-weight: 650; }
.miniapp-ready { padding: 7px 9px; color: #d0b574; background: rgba(185,149,76,.11); border: 1px solid rgba(185,149,76,.2); border-radius: 4px; font-size: 8px; font-weight: 700; }
.stocktake-bar-actions { display: flex !important; grid-template-columns: none !important; gap: 8px !important; align-items: center; justify-content: flex-end; }
.stocktake-bar-actions .text-button { color: #d0b574; }
.stocktake-steps { margin: 14px 0; display: grid; grid-template-columns: repeat(4,1fr); gap: 9px; }
.stocktake-steps article { min-height: 70px; padding: 13px 14px; display: flex; gap: 11px; align-items: center; background: #fffefb; border: 1px solid var(--line); border-radius: 7px; }
.stocktake-steps article.is-active { color: #f3ecdf; background: #24231e; border-color: #312f28; }
.stocktake-steps article.is-complete { background: #eef3ed; border-color: #d7e2d6; }
.stocktake-steps article.is-complete > span { color: #568066; }
.stocktake-steps article > span { color: #a77e35; font: 650 17px/1 Georgia, serif; }
.stocktake-steps article div { display: grid; gap: 4px; }
.stocktake-steps strong { font-size: 10px; }
.stocktake-steps p { margin: 0; color: #959188; font-size: 8px; line-height: 1.45; }
.stocktake-layout { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.stocktake-workbench { overflow: hidden; }
.scanner-connected { display: flex; gap: 8px; align-items: center; color: #4f795e; font-size: 9px; font-weight: 700; }
.scan-entry { padding: 20px 22px 10px; display: grid; grid-template-columns: 46px minmax(200px,1fr) 140px 82px auto; gap: 12px; align-items: end; }
.scan-glyph { width: 46px; height: 46px; display: grid; place-items: center; color: #d4b66f; background: #24241f; border-radius: 5px; }
.scan-glyph svg { width: 24px; }
.scan-entry label { display: grid; gap: 6px; }
.scan-entry label span { color: #66645d; font-size: 9px; font-weight: 700; }
.scan-entry input { height: 46px; font: 600 15px/1 monospace; letter-spacing: 1px; }
.scan-entry > input { text-align: center; }
.scan-entry .button { height: 46px; }
.stocktake-scan-result { margin: 0 22px 12px 80px; padding: 10px 16px; border-radius: 6px; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 10px; line-height: 1.3; }
.stocktake-scan-result[hidden] { display: none; }
.stocktake-scan-result.is-counted { color: #0d6832; background: #eaf8ee; border: 1.5px solid #a3e7be; }
.stocktake-scan-result.is-duplicate { color: #9c4b00; background: #fff5e6; border: 1.5px solid #fed29d; }
.stocktake-scan-result.is-out-of-scope, .stocktake-scan-result.is-unknown { color: #b01818; background: #fdeeee; border: 1.5px solid #f8b4b4; }
.scan-help { padding: 0 22px 17px 80px; display: flex; gap: 22px; color: #9a978e; font-size: 8px; }
.stocktake-candidates { margin: 0 22px 17px 80px; padding: 12px; display: grid; gap: 7px; background: #f8f3e9; border: 1px solid #e4d8bf; border-radius: 5px; }
.stocktake-candidates[hidden] { display: none; }
.stocktake-candidates > strong { color: #79673f; font-size: 9px; }
.stocktake-candidates button { padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 15px; text-align: left; background: #fffdf8; border: 1px solid #e2dbcf; border-radius: 4px; }
.stocktake-candidates button:hover { border-color: #bca16a; }
.stocktake-candidates button span { display: grid; gap: 3px; }
.stocktake-candidates button b { color: #2f2d27; font-size: 10px; }
.stocktake-candidates button small { color: #918d84; font-size: 8px; }
.stocktake-candidates button em { color: #826a36; font-size: 9px; font-style: normal; }
.stocktake-mini-metrics { display: grid; grid-template-columns: repeat(4,1fr); background: #f4f1ea; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stocktake-mini-metrics div { padding: 13px 16px; display: grid; gap: 5px; border-right: 1px solid #e4dfd5; }
.stocktake-mini-metrics div:last-child { border: 0; }
.stocktake-mini-metrics small { color: #8f8c83; font-size: 8px; }
.stocktake-mini-metrics strong { font: 650 18px/1 Georgia, serif; }
.stocktake-mini-metrics .has-difference strong { color: var(--red); }
.stocktake-line-toolbar { min-height: 58px; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.stocktake-line-toolbar > div:first-child { display: grid; gap: 4px; }
.stocktake-line-toolbar strong { font-size: 10px; }
.stocktake-line-toolbar small { color: #969289; font-size: 8px; }
.stocktake-line-toolbar input { width: 240px; height: 34px; }
.stocktake-line-toolbar .unified-product-toolbar-actions { display: flex; align-items: center; gap: 8px; }
.stocktake-tabs { display: inline-flex; align-items: center; background: #edeae2; border-radius: 6px; padding: 3px; gap: 2px; }
.stocktake-tabs button { border: 0; background: transparent; padding: 5px 12px; border-radius: 4px; font-size: 11px; font-weight: 600; color: #6a665d; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; transition: all .15s ease; }
.stocktake-tabs button b { font-size: 10px; background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 10px; font-variant-numeric: tabular-nums; }
.stocktake-tabs button:hover { color: #2b2923; }
.stocktake-tabs button.is-active { background: #fff; color: #1b1a17; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.stocktake-tabs button.is-active b { background: #f0ece3; }
.stocktake-offbook-wrap { max-height: 330px; overflow: auto; }
.stocktake-offbook-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.stocktake-offbook-table th { position: sticky; top: 0; z-index: 2; background: #f0ede5; color: #5f5b52; text-align: left; padding: 9px 12px; font-weight: 700; border-bottom: 1px solid var(--line); }
.stocktake-offbook-table td { padding: 8px 12px; border-bottom: 1px solid #ede8df; vertical-align: middle; }
.stocktake-offbook-table tr:hover td { background: #fbf9f4; }
.stocktake-area-summary { margin: 14px 0 0; padding: 10px 12px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); border-radius: 6px; }
.stocktake-area-summary[hidden] { display: none; }
.stocktake-area-summary-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 10px; }
.stocktake-area-summary-head strong { color: #d6d0c5; }
.stocktake-area-summary-head span { color: #c5a259; font-weight: 700; }
.stocktake-area-summary-list { display: grid; gap: 5px; max-height: 140px; overflow-y: auto; }
.stocktake-area-item { display: flex; justify-content: space-between; align-items: center; font-size: 9px; color: #aba69c; padding: 3px 0; border-bottom: 1px dashed rgba(255,255,255,.06); }
.stocktake-area-item:last-child { border-bottom: 0; }
.stocktake-area-name { color: #e0dbd0; }
.stocktake-area-count { color: #e0c27d; font-variant-numeric: tabular-nums; }
.stocktake-summary-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stocktake-summary-actions .button { white-space: nowrap; padding-left: 8px; padding-right: 8px; }
#voidStocktake, #reopenStocktake, #completeStocktake { grid-column: 1 / -1; }
.unified-product-toolbar { min-height: 48px; margin-top: 14px; padding: 9px 12px; display: flex; align-items: center; justify-content: space-between; gap: 14px; color: #5f5b52; background: #f7f4ed; border: 1px solid var(--line); border-bottom: 0; border-radius: 5px 5px 0 0; }
.unified-product-toolbar.compact { min-height: 42px; margin-top: 14px; }
.unified-product-toolbar > div { display: grid; gap: 3px; }
.unified-product-toolbar strong { color: #2c2b26; font-size: 10px; }
.unified-product-toolbar small { color: #969289; font-size: 8px; }
.unified-product-toolbar + .unified-product-table-wrap { margin-top: 0; border-radius: 0 0 5px 5px; }
.unified-product-table { width: max-content; min-width: 100%; table-layout: fixed; }
.unified-product-table thead { position: sticky; top: 0; z-index: 3; }
.unified-product-table th, .unified-product-table td { height: 48px; padding: 8px 10px; vertical-align: middle; }
.unified-product-table td strong, .unified-product-table td small { display: block; }
.unified-product-table td small { margin-top: 4px; color: #969289; font-size: 8px; }
.unified-product-table th[data-product-column="product"], .unified-product-table td[data-product-column="product"] { position: sticky; left: 0; z-index: 2; background: #fffefb; box-shadow: 1px 0 #e4dfd5; }
.unified-product-table thead th[data-product-column="product"] { z-index: 5; background: #f0ede5; }
.unified-product-table .unified-sticky-action { position: sticky; right: 0; z-index: 2; background: #fffefb; box-shadow: -1px 0 #e4dfd5; }
.unified-product-table thead .unified-sticky-action { z-index: 5; background: #f0ede5; }
.unified-product-table tbody tr:hover td[data-product-column="product"], .unified-product-table tbody tr:hover .unified-sticky-action { background: #fbf9f4; }
.product-column-dialog { width: min(760px, calc(100vw - 36px)); }
.product-column-dialog .product-column-settings-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; max-height: min(560px, 62vh); }
.product-column-dialog .product-column-settings-list label { grid-template-columns: 16px minmax(0, 1fr) 72px; }
@media (max-width: 760px) {
  .unified-product-toolbar, .stocktake-line-toolbar { align-items: stretch; flex-direction: column; }
  .stocktake-line-toolbar .unified-product-toolbar-actions { align-items: stretch; flex-direction: column; }
  .stocktake-line-toolbar .unified-product-toolbar-actions input { width: 100%; }
  .product-column-dialog .product-column-settings-list { grid-template-columns: 1fr; }
}
.stocktake-scan-table { max-height: 330px; }
.stocktake-scan-table table { min-width: 1040px; }
.stocktake-scan-table td strong, .stocktake-scan-table td small { display: block; }
.stocktake-scan-table td small { margin-top: 4px; color: #969289; font-size: 8px; }
.stocktake-count-input { width: 78px; height: 31px; }
.stocktake-difference.has-value { color: #9a5c52; font-weight: 700; }
.scan-result { display: inline-flex; padding: 4px 7px; border-radius: 20px; font-size: 8px; font-weight: 700; }
.scan-result.normal { color: #4e765c; background: #e8f0e8; }
.scan-result.cross { color: #8d6b2d; background: #f4ecd9; }
.scan-result.unknown { color: #9b5e54; background: #f3e9e6; }
.scan-result.gain { color: #3f7181; background: #e6f0f3; }
.scan-result.loss { color: #9b5e54; background: #f3e9e6; }
.scan-result.pending { color: #837c6d; background: #efede7; }
.stocktake-summary-card { padding: 25px; color: #eee8dc; background: #20201c; border: 1px solid #292923; border-radius: 8px; box-shadow: 0 18px 45px rgba(24,23,19,.14); }
.stocktake-summary-card h3 { margin: 7px 0 17px; font: 500 21px/1.2 "Songti SC", STSong, serif; }
.stocktake-progress { --progress: 64.3%; position: relative; width: 168px; height: 168px; margin: 8px auto 18px; display: grid; place-items: center; background: conic-gradient(#c5a259 var(--progress), #34332d 0); border-radius: 50%; }
.stocktake-progress::before { content: ""; position: absolute; width: 140px; height: 140px; background: #20201c; border-radius: 50%; }
.stocktake-progress div { position: relative; z-index: 1; display: grid; gap: 6px; text-align: center; }
.stocktake-progress strong { color: #e0c27d; font: 600 26px/1 Georgia, serif; }
.stocktake-progress small { color: #858279; font-size: 8px; }
.stocktake-summary-card dl { margin: 0; }
.stocktake-summary-card dl div { padding: 9px 0; display: flex; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,.08); }
.stocktake-summary-card dt { color: #8f8c83; font-size: 9px; }
.stocktake-summary-card dd { margin: 0; color: #d6d0c5; font-size: 10px; font-weight: 650; }
.stocktake-warning { margin: 16px 0; padding: 12px; color: #9f8b60; background: rgba(185,149,76,.09); border-left: 2px solid #b9954c; }
.stocktake-warning strong { color: #c9b17b; font-size: 9px; }
.stocktake-warning p { margin: 5px 0 0; color: #77746c; font-size: 8px; line-height: 1.6; }
.stocktake-create-dialog { width: min(900px, calc(100vw - 48px)); }
.stocktake-create-fields { margin-top: 18px; }
.stocktake-history-wrap { margin-top: 18px; max-height: 520px; border: 1px solid var(--line); }
.stocktake-history-wrap table { min-width: 900px; }
.stocktake-history-wrap tr[data-stocktake-task-no] { cursor: pointer; }
.stocktake-history-wrap tr[data-stocktake-task-no]:hover { background: #f8f3e9; }
.stocktake-history-wrap td strong, .stocktake-history-wrap td small { display: block; }
.stocktake-history-wrap td small { margin-top: 4px; color: #969289; font-size: 8px; }

.page-actions { margin-bottom: 22px; display: flex; justify-content: space-between; align-items: end; gap: 24px; }
.page-actions h2 { margin: 11px 0 5px; font-family: "Songti SC", STSong, Georgia, serif; font-size: 30px; font-weight: 550; letter-spacing: 1px; }
.page-actions p { margin: 0; color: #858279; font-size: 11px; }
.page-actions > div:last-child { display: flex; gap: 9px; }
.supplier-return-start { align-items: center; }
.supplier-return-start input { width: 260px; height: 38px; }
.supplier-return-add { display: flex; align-items: center; gap: 8px; }
.supplier-return-add input { width: 240px; height: 32px; }
.supplier-return-start .button { white-space: nowrap; }

.form-layout { display: grid; grid-template-columns: minmax(720px, 1fr) 320px; gap: 18px; align-items: start; }
.form-panel { padding: 8px 26px 28px; }
.form-section-title { margin: 26px 0 17px; padding-bottom: 12px; display: flex; gap: 11px; align-items: center; border-bottom: 1px solid var(--line); }
.form-section-title > span { color: var(--gold-deep); font: 600 18px/1 Georgia, serif; }
.form-section-title h3 { margin: 0; font: 600 15px/1.3 "Songti SC", STSong, serif; }
.form-section-title p { margin: 3px 0 0; color: #9a978e; font-size: 9px; }
.field-grid { display: grid; gap: 15px 13px; }
.field-grid.three { grid-template-columns: repeat(3, 1fr); }
.field-grid.four { grid-template-columns: repeat(4, 1fr); }
.field-grid label, .payment-select { display: grid; gap: 7px; }
.field-grid label > span, .payment-select > span { color: #68665f; font-size: 10px; font-weight: 600; }
.field-grid label.required > span::after { content: " ·"; color: #a06f42; }
input, select { width: 100%; height: 39px; padding: 0 11px; color: #2f2e29; background: #fbfaf6; border: 1px solid #ded9cf; border-radius: 4px; outline: none; font-size: 11px; }
input:focus, select:focus { border-color: #bfa66e; box-shadow: 0 0 0 3px rgba(185,149,76,.1); }
input[readonly] { color: #99958b; background: #f1eee7; }

.cost-insight { position: sticky; top: 112px; min-height: 540px; padding: 27px 25px; color: #eee8dc; background: linear-gradient(160deg, #24241f, #151612); border: 1px solid #2e2d27; border-radius: 8px; box-shadow: 0 18px 45px rgba(24,23,19,.18); }
.cost-insight h3 { margin: 7px 0 22px; font: 500 21px/1.2 "Songti SC", STSong, Georgia, serif; }
.cost-orbit { height: 210px; display: grid; place-items: center; background: radial-gradient(circle, rgba(185,149,76,.2) 0, rgba(185,149,76,.04) 38%, transparent 40%); }
.cost-orbit::before { content: ""; position: absolute; width: 172px; height: 172px; border: 1px solid rgba(208,176,107,.28); border-radius: 50%; }
.cost-orbit div { width: 144px; height: 144px; display: grid; place-content: center; text-align: center; border: 1px solid rgba(220,189,119,.56); transform: rotate(45deg); }
.cost-orbit div > * { transform: rotate(-45deg); }
.cost-orbit small { color: #99958b; font-size: 8px; letter-spacing: 1px; }
.cost-orbit strong { margin: 8px 0; color: #e2c47d; font: 600 19px/1 Georgia, serif; }
.cost-orbit span { color: #9a8060; font-size: 8px; }
.cost-insight dl { margin: 14px 0; }
.cost-insight dl div { padding: 11px 0; display: flex; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,.08); }
.cost-insight dt { color: #858279; font-size: 9px; }
.cost-insight dd { margin: 0; color: #ded8cc; font-size: 10px; font-weight: 600; }
.cost-insight > p { margin: 15px 0 0; color: #77756d; font-size: 9px; line-height: 1.7; }

/* Operational inbound */
.inbound-integrity { margin-bottom: 18px; }
.inbound-form-panel { min-width: 0; }
.inbound-main-column { width: 100%; min-width: 0; max-width: 100%; display: grid; align-content: start; gap: 8px; }
.field-span-three { grid-column: span 3; }
.inbound-advanced { margin-top: 22px; padding: 0 16px 17px; background: #f4f1ea; border: 1px solid #e3ded3; border-radius: 6px; }
.inbound-advanced summary { padding: 15px 0; color: #514d44; cursor: pointer; font-size: 10px; font-weight: 750; }
.inbound-advanced summary small { margin-left: 8px; color: #969188; font-size: 8px; font-weight: 500; }
.inbound-line-remark { margin-top: 17px; }
.inbound-editor-actions { margin-top: 16px; display: flex; align-items: center; justify-content: flex-end; gap: 13px; }
.inbound-insight { position: static; min-height: 0; }
.inbound-draft-mini { margin-top: 18px; display: grid; grid-template-columns: repeat(2,1fr); border: 1px solid rgba(255,255,255,.08); }
.inbound-draft-mini span { padding: 11px; display: grid; gap: 5px; border-right: 1px solid rgba(255,255,255,.08); border-bottom: 1px solid rgba(255,255,255,.08); }
.inbound-draft-mini span:nth-child(2n) { border-right: 0; }
.inbound-draft-mini span:nth-last-child(-n+2) { border-bottom: 0; }
.inbound-draft-mini small { color: #858178; font-size: 8px; }
.inbound-draft-mini strong { color: #e2c47d; font-size: 11px; }
.inbound-lines-panel, .inbound-paste-panel, .inbound-history-panel { margin-top: 18px; overflow: hidden; }
.inbound-lines-panel { min-width: 0; max-width: 100%; margin-top: 0; overflow: visible; }
.inbound-lines-heading-actions { display: flex; align-items: center; gap: 10px; }
.inbound-lines-heading-actions > span { color: #8b877d; font-size: 9px; white-space: nowrap; }
.inbound-lines-heading-actions .column-settings-popover { top: 36px; }
.panel-heading p { margin: 5px 0 0; color: #918d84; font-size: 9px; }
.inbound-lines-wrap { width: 100%; min-width: 0; max-width: 100%; min-height: 190px; max-height: 460px; overflow: auto; contain: inline-size; isolation: isolate; }
.inbound-lines-table { min-width: 0; table-layout: fixed; }
.inbound-lines-table thead, .inbound-history-wrap thead { position: sticky; top: 0; z-index: 1; }
.inbound-lines-table th { position: relative; }
.inbound-lines-table th:hover .inventory-column-resizer::after { width: 2px; background: #a9853e; opacity: 1; }
.inbound-lines-table th[data-inbound-column="row"], .inbound-lines-table td[data-inbound-column="row"] { position: sticky; left: 0; z-index: 3; background: #fffefb; }
.inbound-lines-table thead th[data-inbound-column="row"] { z-index: 5; background: #ece8df; }
.inbound-lines-table th[data-inbound-column="action"], .inbound-lines-table td[data-inbound-column="action"] { position: sticky; right: 0; z-index: 3; background: #fffefb; box-shadow: -1px 0 #e4dfd5; text-align: center; }
.inbound-lines-table thead th[data-inbound-column="action"] { z-index: 5; background: #ece8df; }
.inbound-lines-table.is-resizing { cursor: col-resize; user-select: none; }
.inbound-lines-table td strong, .inbound-history-wrap td strong, .inbound-detail-lines td strong { display: block; color: #2c2b26; font-size: 10px; }
.inbound-lines-table td small, .inbound-history-wrap td small, .inbound-detail-lines td small { display: block; margin-top: 4px; color: #969289; font-size: 8px; }
.inbound-paste-panel { padding-bottom: 18px; }
.inbound-paste-panel textarea { width: calc(100% - 44px); margin: 18px 22px 0; min-height: 130px; font: 10px/1.65 ui-monospace, Consolas, monospace; white-space: pre; }
.inbound-paste-panel textarea.has-file-preview { min-height: 74px; }
.inbound-excel-preview { margin: 18px 22px 0; border: 1px solid #d9d2c5; border-radius: 5px; overflow: hidden; background: #fffefb; }
.inbound-excel-preview-head { min-height: 38px; padding: 7px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #f4f1ea; border-bottom: 1px solid #ded8cc; }
.inbound-excel-preview-head strong { color: #37352f; font-size: 10px; }
.inbound-excel-preview-head span { color: #88837a; font-size: 8px; }
.inbound-excel-preview .table-wrap { max-height: min(60vh, 620px); }
.inbound-excel-preview table { table-layout: fixed; }
.inbound-excel-preview th, .inbound-excel-preview td { width: 110px; min-width: 110px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbound-excel-preview thead { position: sticky; top: 0; z-index: 2; }
.inbound-excel-preview th small { display: block; margin-top: 2px; color: #9b7a3c; font-size: 7px; font-weight: 500; }
.inbound-paste-actions { padding: 12px 22px 0; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.inbound-paste-actions span { color: #89857c; font-size: 9px; }
.inbound-history-wrap { min-height: 230px; max-height: 520px; }
.inbound-history-wrap table { min-width: 1120px; }
.inbound-history-wrap tr[data-inbound-no] { cursor: pointer; }
.inbound-history-wrap tr[data-inbound-no]:hover { background: #f8f3e9; }
.inbound-row-actions { display: flex; gap: 9px; align-items: center; }
.inbound-row-actions.compact { min-width: 168px; }
.inbound-detail-lines tr.needs-review td[data-inbound-detail-column="category"] strong { color: #975b51; }
.text-button.danger { color: #975b51; }
.supply-admin-stock { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.supply-admin-stock + .supply-admin-stock { margin-top: 4px; }
.supply-admin-stock > span { min-width: 44px; color: var(--muted); font-size: 10px; }
.supply-admin-stock input { width: 72px; min-width: 0; height: 30px; padding: 4px 7px; }
.readonly-tag { color: #9a968d; font-size: 8px; }
.status.pending { color: #8a6b31; background: #f3ead8; }
.status.cancelled { color: #92594f; background: #f3e8e5; }
.status.closed { color: #6e6b64; background: #ece9e2; }
.inbound-detail-lines-wrap { max-height: 440px; border: 1px solid var(--line); }
.inbound-detail-lines { min-width: 0; table-layout: fixed; border-collapse: separate; border-spacing: 0; }
.inbound-detail-lines th { position: sticky; top: 0; z-index: 2; }
.inbound-detail-lines th[data-inbound-detail-column]:not([data-inbound-detail-column="action"]) { cursor: grab; user-select: none; }
.inbound-detail-lines th:hover .inventory-column-resizer::after { width: 2px; background: #a9853e; opacity: 1; }
.inbound-detail-lines.is-resizing, .inbound-detail-lines.is-resizing * { cursor: col-resize !important; user-select: none !important; }
.inbound-detail-lines th[data-inbound-detail-column="action"],
.inbound-detail-lines td[data-inbound-detail-column="action"] {
  position: sticky; left: 0; z-index: 3; width: 58px; min-width: 58px; max-width: 58px;
  padding-left: 8px; padding-right: 8px; background: #fffefb; box-shadow: 1px 0 #e4dfd5; text-align: center;
}
.inbound-detail-lines thead th[data-inbound-detail-column="action"] { top: 0; z-index: 5; background: #f4f1ea; }
.inbound-detail-lines tbody tr:hover td[data-inbound-detail-column="action"] { background: #fbf9f4; }
.inbound-detail-lines td[data-inbound-detail-column="action"] .text-button { width: 100%; justify-content: center; }

.sales-layout { display: grid; grid-template-columns: 1fr 330px; gap: 18px; align-items: start; }
.sale-entry { padding: 25px; }
.member-lookup, .scan-product { display: grid; grid-template-columns: 32px 1fr auto; gap: 14px; align-items: end; }
.member-lookup > div, .scan-product > div { display: grid; gap: 7px; }
.member-lookup small, .scan-product small { color: #77746c; font-size: 10px; font-weight: 600; }
.member-lookup label, .scan-product label { position: relative; display: block; }
.member-lookup label svg, .scan-product label svg { position: absolute; left: 11px; top: 10px; width: 17px; color: #9c988d; }
.member-lookup label input, .scan-product label input { padding-left: 37px; height: 44px; }
.step-number { width: 32px; height: 32px; display: grid; place-items: center; color: #9a7738; background: #f1e7d3; border-radius: 50%; font: 600 11px/1 Georgia, serif; }
.match-pill { align-self: end; height: 44px; padding: 0 13px; display: grid; place-items: center; color: #4c745b; background: #e9f0e9; border-radius: 4px; font-size: 9px; font-weight: 700; }
.matched-member { margin: 18px 0 28px 46px; padding: 17px 18px; display: grid; grid-template-columns: 43px 1fr auto; gap: 13px; align-items: center; background: #f3f0e9; border: 1px solid #e5e0d5; border-radius: 6px; }
.member-avatar { width: 43px; height: 43px; display: grid; place-items: center; overflow: hidden; color: #261f13; background: linear-gradient(145deg, #dcc795, #a6813c); border-radius: 50%; font: 600 15px/1 Georgia, serif; }
.matched-member > div { display: grid; gap: 3px; }
.matched-member strong { font-size: 12px; }
.matched-member p { margin: 0; color: #8f8c83; font-size: 9px; }
.matched-member dl { display: flex; gap: 26px; }
.matched-member dl div { display: grid; gap: 4px; text-align: right; }
.matched-member dt { color: #9a978e; font-size: 8px; }
.matched-member dd { margin: 0; font-size: 12px; font-weight: 650; }
.scan-product { padding-top: 21px; border-top: 1px solid var(--line); }
.sale-line { margin: 20px 0 0 46px; padding: 16px; display: grid; grid-template-columns: 42px 1fr 100px 130px 24px; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 5px; }
.product-gem { width: 38px; height: 38px; display: grid; place-items: center; background: #24241f; border-radius: 4px; }
.product-gem::after { content: ""; width: 11px; height: 11px; border: 2px solid #d2b46d; transform: rotate(45deg); }
.sale-line > div:nth-child(2) { display: grid; gap: 4px; }
.sale-line strong { font-size: 11px; }
.sale-line p { margin: 0; color: #9a978e; font-size: 8px; }
.sale-line > span { color: #8b887f; font-size: 8px; line-height: 1.7; }
.sale-line > span b { color: var(--ink); font-size: 12px; }
.sale-line label { display: grid; gap: 5px; color: #77746c; font-size: 8px; }
.sale-line label input { height: 34px; }
.sale-line > button { color: #a7a39a; background: transparent; border: 0; font-size: 20px; }

.checkout-card { padding: 27px; color: #eee8dc; background: #20201c; border: 1px solid #292923; border-radius: 8px; box-shadow: 0 18px 45px rgba(24,23,19,.14); }
.checkout-card h3 { margin: 7px 0 22px; font: 500 21px/1.2 "Songti SC", STSong, serif; }
.checkout-card dl { margin: 0; }
.checkout-card dl div { padding: 10px 0; display: flex; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,.08); }
.checkout-card dt { color: #8f8c83; font-size: 9px; }
.checkout-card dd { margin: 0; color: #d6d0c5; font-size: 10px; }
.checkout-total { padding: 20px 0 18px; display: flex; align-items: end; justify-content: space-between; }
.checkout-total small { color: #8f8c83; font-size: 9px; }
.checkout-total strong { color: #e0c27d; font: 600 25px/1 Georgia, serif; }
.points-earned { padding: 14px; display: grid; grid-template-columns: 1fr auto; gap: 4px; background: rgba(185,149,76,.11); border: 1px solid rgba(185,149,76,.18); }
.points-earned span { color: #c8b58b; font-size: 9px; }
.points-earned strong { color: #e0c27d; }
.points-earned small { grid-column: 1/-1; color: #78756d; font-size: 8px; }
.payment-select { margin-top: 18px; }
.payment-select > span { color: #959188; }
.payment-select select { color: #ded8cc; background: #2c2c27; border-color: #403f37; }
.checkout-card > p { margin: 16px 0 0; color: #77746c; font-size: 9px; line-height: 1.7; }

.operational-sales-layout { grid-template-columns: minmax(0, 1fr) 370px; }
.operational-sale-entry { min-width: 0; overflow: hidden; }
.operational-checkout { position: sticky; top: 112px; }
.operational-member-lookup { margin-bottom: 14px; }
.sale-member-actions { display: flex !important; gap: 8px; align-items: center; }
.locked-operator-field input { color: #171713; font-weight: 750; background: #f0ede4; border-color: #d4c69d; cursor: not-allowed; }
.locked-operator-field small { color: #8a7650; font-size: 9px; }
.sale-member-create-dialog { width: min(860px, calc(100vw - 48px)); }
.sale-member-create-fields { padding-top: 18px; }
.sale-member-result .data-empty { margin: 0 0 18px 46px; }
.sale-matched-member { margin-bottom: 18px; grid-template-columns: 43px minmax(0,1fr) auto auto; }
.sale-matched-member small { display: block; color: #8f8c83; font-size: 8px; line-height: 1.5; }
.sale-member-binding { color: #947235 !important; }
.sale-new-member { margin: -6px 0 20px 46px; padding: 14px; display: grid; grid-template-columns: minmax(180px,1fr) auto; gap: 12px; align-items: end; background: #faf7ef; border: 1px solid #e7dfcf; border-radius: 5px; }
.sale-new-member[hidden] { display: none; }
.sale-new-member label { display: grid; gap: 6px; }
.sale-new-member label span { color: #77736a; font-size: 9px; font-weight: 600; }
.sale-scan-row { display: grid; grid-template-columns: minmax(260px,1fr) 82px auto; gap: 10px; align-items: center; }
.simple-sale-scan { grid-template-columns: minmax(280px, 1fr) auto; }
.sale-scan-row label { position: relative; }
.sale-scan-row label svg { position: absolute; left: 12px; top: 12px; width: 17px; color: #8d877c; }
.sale-scan-row label input { height: 42px; padding-left: 40px; font-family: ui-monospace, Consolas, monospace; }
.sale-scan-row > input, .sale-scan-row .button { height: 42px; }
.sale-stock-candidates { margin-top: 10px; padding: 12px; display: grid; gap: 7px; background: #f8f3e9; border: 1px solid #e4d8bf; border-radius: 5px; }
.sale-stock-candidates[hidden] { display: none; }
.sale-stock-candidates > strong { color: #79673f; font-size: 9px; }
.sale-stock-candidates button { padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 15px; text-align: left; background: #fffdf8; border: 1px solid #e2dbcf; border-radius: 4px; }
.sale-stock-candidates button:hover { border-color: #bca16a; }
.sale-stock-candidates button span { display: grid; gap: 3px; }
.sale-stock-candidates button b { color: #2f2d27; font-size: 10px; }
.sale-stock-candidates button small { color: #918d84; font-size: 8px; }
.sale-stock-candidates button em { color: #826a36; font-size: 9px; font-style: normal; }
.sale-draft-lines-wrap { min-height: 230px; max-height: 520px; margin-top: 14px; border: 1px solid var(--line); border-radius: 5px; }
.sale-draft-lines { min-width: 1760px; }
.sale-draft-lines thead { position: sticky; top: 0; z-index: 1; }
.sale-draft-lines th, .sale-draft-lines td { height: 48px; padding: 9px 10px; vertical-align: middle; }
.sale-draft-lines td > strong, .sale-draft-lines td > small { display: block; }
.sale-draft-lines td > small { margin-top: 4px; color: #969289; font-size: 8px; }
.sale-draft-lines th:nth-child(1) { min-width: 126px; }
.sale-draft-lines th:nth-child(2) { min-width: 170px; }
.sale-draft-lines th:nth-child(n+3):nth-child(-n+11) { min-width: 78px; }
.sale-draft-lines th:nth-child(n+12):nth-child(-n+14) { min-width: 82px; text-align: right; }
.sale-draft-lines th:nth-child(15) { min-width: 145px; }
.sale-draft-lines th:nth-child(16) { min-width: 105px; text-align: right; }
.sale-draft-lines th:nth-child(17) { min-width: 150px; }
.sale-draft-lines th:nth-child(18) { min-width: 88px; }
.sale-draft-lines .sale-code-cell { font-family: ui-monospace, Consolas, monospace; font-variant-numeric: tabular-nums; }
.sale-draft-lines .sale-name-cell { color: #27261f; font-weight: 650; }
.sale-draft-lines .sale-number-cell { text-align: right; font-variant-numeric: tabular-nums; }
.sale-draft-lines .sale-location-cell { color: #67635b; }
.sale-draft-lines .sale-code-cell,
.sale-draft-lines th:first-child { position: sticky; left: 0; z-index: 2; background: #fffefb; box-shadow: 1px 0 #e4dfd5; }
.sale-draft-lines thead th:first-child { z-index: 4; background: #f0ede5; }
.sale-draft-lines .sale-action-cell,
.sale-draft-lines th:last-child { position: sticky; right: 0; z-index: 2; background: #fffefb; box-shadow: -1px 0 #e4dfd5; }
.sale-draft-lines thead th:last-child { z-index: 4; background: #f0ede5; }
.sale-draft-lines tbody tr:hover .sale-code-cell,
.sale-draft-lines tbody tr:hover .sale-action-cell { background: #fbf9f4; }
.sale-order-essentials { align-items: start; }
.sale-more-info { margin: 10px 0 2px; border-top: 1px dashed #ddd5c6; padding-top: 9px; }
.sale-more-info summary { width: fit-content; color: #8a7650; font-size: 9px; cursor: pointer; }
.sale-more-info label { display: grid; gap: 6px; margin-top: 9px; }
.sale-more-info label span { color: #777168; font-size: 9px; }
.sale-more-info input { width: 100%; }
.sale-price-compare { display: grid; gap: 3px; min-width: 150px; }
.sale-price-compare small { color: #8f8a80; }
.sale-price-compare strong { color: #9a6714; font-size: 13px; }
.sale-price-compare em { color: #34322d; font-style: normal; font-size: 9px; }
.sale-line-actions { display: flex; align-items: center; gap: 8px; }
.sale-item-dialog { width: min(920px, calc(100vw - 48px)); }
.sale-item-dialog-body { padding-top: 24px; }
.sale-item-identity { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 1px; overflow: hidden; border: 1px solid #dcd5c7; border-radius: 7px; background: #dcd5c7; }
.sale-item-identity > div { display: grid; gap: 5px; padding: 15px 17px; background: #fffdfa; }
.sale-item-identity small, .sale-item-details small, .sale-item-price-card small { color: #928c81; font-size: 8px; }
.sale-item-identity strong { font-size: 13px; }
.sale-item-details { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-top: 14px; overflow: hidden; border: 1px solid #e1dbcf; border-radius: 7px; background: #e1dbcf; }
.sale-item-details > div { display: grid; gap: 5px; min-height: 62px; padding: 12px 14px; background: #f8f6f0; }
.sale-item-details strong { font-size: 11px; font-weight: 650; }
.sale-item-price-card { display: grid; grid-template-columns: 1fr 120px 150px 1.15fr; gap: 14px; align-items: end; margin-top: 18px; padding: 18px; border: 1px solid #cfb96f; border-radius: 8px; background: linear-gradient(120deg, #fffdf5, #f4ecd3); }
.sale-item-price-card > div { display: grid; gap: 5px; }
.sale-item-price-card > div strong { color: #6f5016; font: 600 25px/1.1 "Songti SC", STSong, serif; }
.sale-item-price-card > div span { color: #9a907d; font-size: 8px; }
.sale-item-price-card label { display: grid; grid-template-rows: auto 45px minmax(10px, auto); gap: 6px; color: #675f52; font-size: 9px; }
.sale-item-price-card input, .sale-item-price-card select { height: 45px; background: #fff; }
.sale-item-price-card input { font-size: 17px; font-weight: 750; }
.sale-item-price-card select { font-size: 12px; font-weight: 700; }
.sale-item-price-card #saleItemActualPrice { color: #8b5e0d; border-color: #b8953f; background: #fff; }
.sale-item-mixed-payments { margin-top: 14px; padding: 16px; border: 1px solid #cfb96f; border-radius: 8px; background: linear-gradient(120deg, #fffdf8, #fbf7ec); display: grid; gap: 12px; }
.sale-item-mixed-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sale-item-mixed-head strong { font-size: 13px; color: #5c4314; }
.sale-item-mixed-head span { display: block; font-size: 11px; color: #8c8270; margin-top: 2px; }
.sale-item-mixed-rows { display: grid; gap: 8px; }
.sale-item-mixed-row { display: grid; grid-template-columns: 160px 1fr 34px; gap: 8px; align-items: center; }
.sale-item-mixed-row select, .sale-item-mixed-row input { height: 38px; background: #fff; border: 1px solid #dcd3c1; border-radius: 4px; padding: 0 10px; font-size: 13px; color: #333; }
.sale-item-mixed-row input { font-weight: 600; color: #6f5016; }
.sale-item-mixed-row .remove-line { height: 34px; width: 34px; border-radius: 4px; font-size: 16px; color: #a04b3a; background: rgba(160,75,58,.08); border: 1px solid rgba(160,75,58,.2); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.sale-item-mixed-row .remove-line:disabled { opacity: .3; cursor: not-allowed; }
.sale-item-mixed-summary { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 10px 12px; background: rgba(207,185,111,.12); border-radius: 6px; font-size: 12px; }
.sale-item-mixed-metrics { display: flex; gap: 16px; color: #635742; }
.sale-item-mixed-metrics strong { font-weight: 700; color: #5c4314; }
.sale-item-mixed-status { display: flex; align-items: center; gap: 8px; }
.sale-item-mixed-status span { font-weight: 600; padding: 3px 8px; border-radius: 4px; }
.sale-item-mixed-status.is-balanced span { color: #276b3f; background: rgba(39,107,63,.12); }
.sale-item-mixed-status.is-short span { color: #b35900; background: rgba(179,89,0,.12); }
.sale-item-mixed-status.is-over span { color: #a82d2d; background: rgba(168,45,45,.12); }
.operational-checkout dl input { width: 108px; height: 29px; color: #eee8dc; text-align: right; background: #2c2c27; border-color: #403f37; }
.sale-payment-head { margin: 20px 0 9px; display: flex; align-items: center; justify-content: space-between; }
.sale-payment-head > span { color: #aaa59a; font-size: 9px; font-weight: 650; }
.operational-checkout .text-button { color: #d1b56f; }
.sale-payment-rows { display: grid; gap: 9px; }
.sale-payment-row { padding: 9px; display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) 24px; gap: 7px; background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.08); border-radius: 4px; }
.sale-payment-row select { grid-column: 1; grid-row: 1; }
.sale-payment-row [data-sale-payment-amount] { grid-column: 2; grid-row: 1; }
.sale-payment-row [data-sale-payment-reference] { grid-column: 1; grid-row: 2; }
.sale-payment-row [data-sale-payment-remark] { grid-column: 2; grid-row: 2; }
.sale-payment-row .remove-line { grid-column: 3; grid-row: 1 / span 2; }
.sale-payment-row input, .sale-payment-row select { min-width: 0; height: 34px; color: #ded8cc; background: #2c2c27; border-color: #403f37; }
.sale-payment-row.crm-payment-readonly { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
.sale-payment-row.crm-payment-readonly small { grid-column: 1 / 3; color: #a9a397; }
.crm-payment-empty { padding: 9px; color: #a9a397; border: 1px solid rgba(255,255,255,.08); }
.sale-payment-gap { margin-top: 10px; padding: 8px 10px; color: #dfb4a9; background: rgba(147,77,64,.13); border: 1px solid rgba(174,100,86,.2); border-radius: 4px; font-size: 9px; }
.sale-payment-gap.is-balanced { color: #acd0b4; background: rgba(67,116,79,.14); border-color: rgba(90,137,101,.25); }
.sale-return-lines-wrap { margin-top: 18px; max-height: 350px; border: 1px solid var(--line); }
.sale-return-lines-wrap table { min-width: 820px; }
.sale-return-lines-wrap td strong, .sale-return-lines-wrap td small { display: block; }
.sale-return-lines-wrap td small { margin-top: 4px; color: #969289; font-size: 8px; }
.sale-return-fields { margin-top: 20px; }
.sale-return-dialog .record-dialog-body { max-height: calc(100vh - 220px); }
.sale-return-payment-head { margin-top: 20px; display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.sale-return-payment-head div { display: grid; gap: 4px; }
.sale-return-payment-head strong { font-size: 11px; }
.sale-return-payment-head span { color: #8d8980; font-size: 8px; }
.sale-return-payment-rows { margin-top: 10px; display: grid; gap: 8px; }
.sale-return-payment-row { display: grid; grid-template-columns: 140px 120px minmax(150px,1fr) minmax(150px,1fr) 32px; gap: 8px; align-items: center; }
.sale-return-payment-row input, .sale-return-payment-row select { min-width: 0; height: 36px; }
.sale-return-payment-row .remove-line { width: 32px; height: 32px; color: #8e6a62; background: #f2e7e4; border-radius: 50%; }
.sale-return-payment-gap { margin-top: 10px; padding: 9px 11px; color: #94564d; background: #f5e9e6; border: 1px solid #ead3ce; border-radius: 4px; font-size: 9px; }
.sale-return-payment-gap.is-balanced { color: #4e7657; background: #eaf2eb; border-color: #d4e4d6; }

.member-dashboard { display: grid; grid-template-columns: .85fr 1.15fr; gap: 18px; }
.member-profile { min-height: 260px; padding: 28px; display: grid; grid-template-columns: 66px 1fr; gap: 18px; align-content: start; }
.member-avatar.large { width: 66px; height: 66px; font-size: 22px; }
.member-profile h3 { margin: 10px 0 5px; font: 600 24px/1.2 "Songti SC", STSong, serif; }
.member-profile p { margin: 0; color: #8f8c83; font-size: 9px; }
.member-profile dl { grid-column: 1/-1; margin: 25px 0 0; padding-top: 22px; display: grid; grid-template-columns: repeat(3,1fr); border-top: 1px solid var(--line); }
.member-profile dl div { text-align: center; border-right: 1px solid var(--line); }
.member-profile dl div:last-child { border: 0; }
.member-profile dt { color: #969289; font-size: 9px; }
.member-profile dd { margin: 7px 0 0; font: 600 19px/1 Georgia, serif; }
.points-ledger { padding-bottom: 8px; }
.rule-chip { padding: 6px 8px; color: #86682e; background: #f1e8d5; border-radius: 3px; font-size: 8px; font-weight: 700; }
.ledger-row { margin: 0 22px; padding: 17px 0; display: grid; grid-template-columns: 31px 1fr auto 80px; gap: 11px; align-items: center; border-bottom: 1px solid var(--line); }
.ledger-row:last-child { border-bottom: 0; }
.ledger-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; font-size: 16px; }
.ledger-icon.plus { color: #4f795e; background: #e8f0e9; }
.ledger-icon.minus { color: #9b5e54; background: #f3e9e6; }
.ledger-row div { display: grid; gap: 3px; }
.ledger-row strong { font-size: 10px; }
.ledger-row p { margin: 0; color: #99958c; font-size: 8px; }
.ledger-row > b { color: var(--gold-deep); font-size: 11px; }
.ledger-row time { color: #99958c; font-size: 8px; text-align: right; }

.print-layout { display: grid; grid-template-columns: 1fr 360px; gap: 18px; }
.label-preview { min-height: 410px; display: grid; place-items: center; align-content: center; gap: 24px; background: radial-gradient(circle at center, #eeebe3, #ddd8cd); border: 1px solid #d5d0c6; border-radius: 8px; }
.label-preview > span { color: #8a877e; font-size: 9px; letter-spacing: 1px; }
.label-preview-workspace { position: relative; padding: 78px 24px 26px; }
.label-preview-toolbar { position: absolute; left: 22px; right: 22px; top: 18px; display: flex; justify-content: space-between; align-items: end; gap: 16px; }
.label-preview-toolbar label { display: grid; gap: 5px; color: #6e6a61; font-size: 9px; font-weight: 700; }
.label-preview-toolbar select { min-width: 190px; height: 34px; background: rgba(255,255,255,.82); }
.label-preview-toolbar #labelPreviewMode { min-width: 110px; }
.label-preview-toolbar > div { display: flex; align-items: center; gap: 8px; }
.label-preview-toolbar strong { min-width: 46px; color: #4f4b43; font-size: 10px; text-align: center; }
.legacy-label-stage { min-width: 430px; min-height: 470px; display: grid; place-items: center; }
.legacy-label-paper { width: 300px; height: 470px; display: block; overflow: visible; color: #000; background: #fff; box-shadow: 0 20px 44px rgba(31,27,19,.2); }
.legacy-label-paper text { fill: #000; }
.print-safety-note { margin: 14px 0 0; color: #88847a; font-size: 8px; line-height: 1.6; }
#labelPrintSheet { display: none; }
.jewelry-label { position: relative; width: 520px; height: 245px; padding: 24px 27px; display: grid; grid-template-columns: 1.3fr .7fr; align-content: start; color: #171713; background: #fffdf7; box-shadow: 0 22px 40px rgba(30,28,22,.18); transform: rotate(-2deg); }
.jewelry-label::after { content: ""; position: absolute; inset: 9px; border: 1px solid #d7c8a7; pointer-events: none; }
.label-brand { grid-column: 1/-1; padding-bottom: 12px; margin-bottom: 13px; border-bottom: 1px solid #d8cdb5; font: 600 12px/1 Georgia, serif; letter-spacing: 2px; }
.jewelry-label > strong { font: 600 20px/1.3 "Songti SC", STSong, serif; }
.jewelry-label > p { grid-column: 1; margin: 7px 0; color: #5c594f; font-size: 10px; }
.jewelry-label > b { grid-column: 2; grid-row: 2/4; align-self: center; justify-self: end; font: 600 25px/1 Georgia, serif; }
.barcode { grid-column: 1; margin-top: 12px; height: 43px; display: flex; gap: 3px; align-items: stretch; }
.barcode i { background: #191914; }
.barcode i:nth-child(2n) { width: 2px; }
.barcode i:nth-child(3n) { width: 6px; }
.barcode i:nth-child(4n+1) { width: 3px; }
.jewelry-label > small { grid-column: 1; margin-top: 5px; font: 9px/1 monospace; letter-spacing: 2px; }
.print-control { padding: 28px; }
.print-control h3 { margin: 7px 0 25px; font: 600 21px/1.2 "Songti SC", STSong, serif; }
.printer-online { padding: 16px; display: grid; grid-template-columns: 10px 1fr auto; gap: 12px; align-items: center; background: #f1eee7; border: 1px solid #e3ddd2; }
.printer-online > i { width: 7px; height: 7px; background: #5f8b6c; border-radius: 50%; box-shadow: 0 0 0 5px rgba(95,139,108,.11); }
.printer-online div { display: grid; gap: 4px; }
.printer-online strong { font-size: 11px; }
.printer-online p { margin: 0; color: #8e8b82; font-size: 8px; }
.printer-online > span { color: #547760; font-size: 8px; font-weight: 700; }
.printer-online.is-offline > i { background: #9b978e; box-shadow: 0 0 0 5px rgba(155,151,142,.11); }
.printer-online.is-offline > span { color: #817d74; }
.print-control dl { margin: 22px 0; }
.print-control .button-stop { margin-bottom: 14px; }
.print-control dl div { padding: 12px 0; display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); }
.print-control dt { color: #8f8c83; font-size: 9px; }
.print-control dd { margin: 0; font-size: 10px; font-weight: 600; }

.report-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.report-card { position: relative; min-height: 220px; padding: 28px; overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: 8px; transition: .2s ease; }
.report-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #d8c9a8; }
.report-card > span { position: absolute; right: 22px; top: 17px; color: #eee9df; font: 700 48px/1 Georgia, serif; }
.report-card h3 { margin: 20px 0 11px; font: 600 20px/1.2 "Songti SC", STSong, serif; }
.report-card p { max-width: 460px; margin: 0; color: #858279; font-size: 10px; line-height: 1.75; }
.report-card button { margin-top: 28px; padding: 0; display: inline-flex; gap: 5px; align-items: center; color: var(--gold-deep); background: transparent; border: 0; font-size: 9px; font-weight: 700; }
.report-card button svg { width: 13px; }

/* Formal data workspaces */
.entity-kpis { grid-template-columns: repeat(4, 1fr) !important; }
.entity-kpis .metric-card { min-height: 132px; }
.entity-kpis .metric-card > strong { margin-top: 11px; font-size: 25px; }
.entity-panel { overflow: hidden; }
.entity-toolbar { padding: 18px 20px; display: grid; grid-template-columns: minmax(250px, 1.8fr) repeat(3, minmax(135px, .75fr)) auto auto; gap: 11px; align-items: end; background: #f1eee7; border-bottom: 1px solid var(--line); }
.entity-toolbar, .sales-items-toolbar, .report-filterbar { position: relative; z-index: 3; }
.entity-panel:has(.store-tree-trigger[aria-expanded="true"]), .sales-items-panel:has(.store-tree-trigger[aria-expanded="true"]), .report-workspace:has(.store-tree-trigger[aria-expanded="true"]) { overflow: visible; }
.entity-toolbar:has(.store-tree-trigger[aria-expanded="true"]), .sales-items-toolbar:has(.store-tree-trigger[aria-expanded="true"]), .report-filterbar:has(.store-tree-trigger[aria-expanded="true"]) { position: relative; z-index: 100; overflow: visible; }
.entity-toolbar.member-toolbar { grid-template-columns: minmax(300px, 2fr) repeat(2, minmax(150px, .8fr)) auto auto; }
.entity-toolbar label, .report-filterbar label { display: grid; gap: 6px; }
.entity-toolbar label > span, .report-filterbar label > span { color: #77746c; font-size: 9px; font-weight: 700; }
.store-tree-select { position: relative; min-width: 0; }
.store-tree-trigger { position: relative; width: 100%; height: 39px; padding: 0 31px 0 11px; overflow: hidden; color: #2f2e29; background: #fbfaf6; border: 1px solid #ded9cf; border-radius: 4px; font-size: 11px; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.store-tree-trigger::after { content: "⌄"; position: absolute; top: 50%; right: 11px; color: #77746c; transform: translateY(-56%); transition: transform .16s ease; }
.store-tree-trigger[aria-expanded="true"] { border-color: #b9964d; box-shadow: 0 0 0 2px rgba(185,150,77,.11); }
.store-tree-trigger[aria-expanded="true"]::after { transform: translateY(-40%) rotate(180deg); }
.store-tree-trigger.has-partial { color: #8b6720; font-weight: 750; }
.store-tree-menu { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; width: max(240px, 100%); max-height: 330px; overflow-y: auto; padding: 8px; background: #fffdfa; border: 1px solid #ddd5c6; border-radius: 9px; box-shadow: 0 18px 42px rgba(38,34,26,.18); }
.store-tree-heading { padding: 4px 8px 8px; color: #918978; font-size: 8px; font-weight: 800; letter-spacing: .16em; }
.store-tree-menu button { width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px; color: #4c4941; background: transparent; border: 0; border-radius: 6px; text-align: left; cursor: pointer; }
.store-tree-menu button:hover { background: #f6f0e4; }
.store-tree-select-all { margin-bottom: 5px; border-bottom: 1px solid #eee7da !important; border-radius: 6px 6px 0 0 !important; }
.store-tree-select-all strong, .store-tree-select-all small, .store-tree-company strong, .store-tree-company small { display: block; }
.store-tree-select-all strong { color: #635d51; font-size: 10px; }
.store-tree-select-all small { margin-top: 2px; color: #aaa18e; font-size: 8px; }
.store-tree-company { margin-bottom: 4px; background: #faf5ea !important; border: 1px solid #eadfc9 !important; }
.store-tree-company strong { color: #28261f; font-family: Georgia, "Times New Roman", serif; font-size: 12px; }
.store-tree-company small { margin-top: 2px; color: #9a917f; font-size: 8px; }
.store-tree-check { width: 16px; height: 16px; flex: 0 0 16px; display: grid; place-items: center; color: transparent; border: 1px solid #cfc7b7; border-radius: 4px; font-size: 10px; font-weight: 900; }
.store-tree-menu button.is-selected .store-tree-check { color: #fff; background: #aa8439; border-color: #aa8439; }
.store-tree-branches > span { display: block; padding: 5px 8px 3px 33px; color: #aaa18e; font-size: 8px; }
.store-tree-branches button { padding-left: 18px; }
.entity-toolbar .button, .report-filterbar .button { height: 39px; }
.entity-toolbar .text-button { height: 39px; justify-content: center; }
.pending-inbound-bulk-actions { min-height: 42px; padding: 6px 20px; display: flex; align-items: center; justify-content: flex-end; gap: 14px; background: #fffefb; border-bottom: 1px solid var(--line); }
.pending-inbound-bulk-actions input, .inbound-history-wrap input[type="checkbox"] { width: 14px; height: 14px; accent-color: #a9853e; }
.entity-table-wrap { min-height: 350px; max-height: 560px; }
.entity-table-wrap table { min-width: 1080px; }
.entity-table-wrap tbody tr, .inventory-detail-table tbody tr { transition: background .16s ease, box-shadow .16s ease; }
.entity-table-wrap tbody tr[data-record-id], .inventory-detail-table tbody tr[data-item-id] { cursor: pointer; }
.entity-table-wrap tbody tr[data-record-id]:hover, .inventory-detail-table tbody tr[data-item-id]:hover { background: #f8f3e9; }
.inventory-detail-table tbody tr.is-selected { background: #f3ead8; box-shadow: inset 3px 0 #b9954c; }
.entity-table-wrap td strong { display: block; font-size: 10px; }
.entity-table-wrap td small { display: block; margin-top: 4px; color: #99958c; font-size: 8px; }
.entity-pagination { min-height: 54px; padding: 10px 18px; display: flex; align-items: center; justify-content: space-between; color: #89867d; background: #faf8f3; border-top: 1px solid var(--line); font-size: 9px; }
.entity-pagination > div { display: flex; gap: 8px; }
.entity-pagination .command-button:disabled { cursor: not-allowed; opacity: .42; }
.loading-cell { height: 180px !important; color: #89867d !important; text-align: center !important; font-size: 10px !important; }
.loading-cell > span, .dialog-loading > span { width: 17px; height: 17px; margin-right: 9px; display: inline-block; vertical-align: middle; border: 2px solid #ded6c5; border-top-color: #a47d37; border-radius: 50%; animation: jc-spin .8s linear infinite; }
@keyframes jc-spin { to { transform: rotate(360deg); } }
.data-integrity-note { margin: 0 0 17px; padding: 13px 16px; display: flex; gap: 12px; align-items: center; color: #796a4c; background: #f3ecdc; border: 1px solid #e4d6b7; border-left: 3px solid #b9954c; border-radius: 5px; }
.data-integrity-note strong { flex: 0 0 auto; font-size: 9px; letter-spacing: .4px; }
.data-integrity-note span { color: #807866; font-size: 9px; line-height: 1.6; }
.data-integrity-note.dark { margin: 20px 0; color: #d0b87e; background: rgba(185,149,76,.09); border-color: rgba(185,149,76,.18); }
.data-integrity-note.dark span { color: #8f897d; }
.entity-name { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: center; }
.entity-name > i, .entity-name > .member-face { width: 34px; height: 34px; display: grid; place-items: center; overflow: hidden; color: #3c301d; background: linear-gradient(145deg, #e7d7b0, #b58e43); border-radius: 50%; font: 700 11px/1 Georgia, serif; font-style: normal; }
.entity-name > .member-face img, .member-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.masked-phone { font: 600 10px/1 monospace; letter-spacing: .5px; }
.status-pill { display: inline-flex; padding: 5px 8px; border-radius: 20px; color: #4e765c; background: #e8f0e8; font-size: 8px; font-weight: 750; white-space: nowrap; }
.status-pill.pending, .status-pill.draft { color: #8a6b31; background: #f3ead8; }
.status-pill.returned, .status-pill.rejected, .status-pill.voided { color: #92594f; background: #f3e8e5; }
.status-pill.approved, .status-pill.completed { color: #4e765c; background: #e7efe8; }
.status-pill.historical { color: #6f6656; background: #eee9df; }

/* Sales line register */
.sales-item-kpis { grid-template-columns: repeat(5, 1fr) !important; }
.sales-item-kpis .metric-card { min-height: 126px; padding: 18px; }
.sales-item-kpis .metric-card > strong { margin-top: 10px; font-size: 22px; }
.sales-items-quality b { color: #7e4d43; font-weight: 750; }
.sales-items-panel { overflow: hidden; }
.sales-items-toolbar { padding: 16px 18px; display: grid; grid-template-columns: 1.7fr 1.25fr repeat(4, minmax(128px, .8fr)); gap: 11px 10px; align-items: end; background: #f1eee7; border-bottom: 1px solid var(--line); }
.sales-items-toolbar label { display: grid; gap: 6px; }
.sales-items-toolbar label > span { color: #77746c; font-size: 9px; font-weight: 700; }
.sales-items-toolbar input, .sales-items-toolbar select { height: 37px; }
.sales-items-toolbar .store-tree-trigger { height: 37px; }
.sale-product-link { max-width: 180px; padding: 0; overflow: hidden; color: #9a721f; background: none; border: 0; border-bottom: 1px dashed #b99a58; font: inherit; font-weight: 750; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.sale-product-link:hover { color: #5f4411; border-bottom-style: solid; }
.sales-items-search { grid-column: span 2; }
.sales-items-query-actions { height: 37px; display: flex; gap: 8px; align-items: center; }
.sales-items-query-actions .button { height: 37px; }
.sales-items-query-actions .text-button { height: 37px; }
.sales-items-print-heading { display: none; }
.sales-items-table-wrap { min-height: 390px; max-height: 600px; }
.sales-items-table { min-width: 2050px; }
.sales-items-table thead { position: sticky; top: 0; z-index: 2; }
.sales-items-table tbody tr[data-sales-no] { cursor: pointer; }
.sales-items-table tbody tr[data-sales-no]:hover { background: #f8f3e9; }
.sales-items-table td strong, .sale-detail-lines td strong { display: block; color: #2c2b26; font-size: 10px; }
.sales-items-table td small, .sale-detail-lines td small { display: block; margin-top: 4px; color: #969289; font-size: 8px; }
.sales-items-table th:nth-child(1) { min-width: 175px; }
.sales-items-table th:nth-child(2) { min-width: 150px; }
.sales-items-table th:nth-child(3) { min-width: 150px; }
.sales-items-table th:nth-child(8) { min-width: 145px; }
.sales-items-table th:nth-child(9) { min-width: 135px; }
.sales-items-table th:nth-child(11) { min-width: 150px; }
.sales-items-table th:nth-child(12) { min-width: 125px; }
.sales-items-table th:nth-child(13) { min-width: 180px; }
.line-remark { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.line-match { display: inline-flex; padding: 5px 8px; border-radius: 20px; font-size: 8px; font-weight: 750; white-space: nowrap; }
.line-match.matched { color: #4e765c; background: #e7efe8; }
.line-match.mismatch { color: #8a672d; background: #f3ead8; }
.line-match.unmatched { color: #92594f; background: #f3e8e5; }
.line-match.unknown { color: #6e6b64; background: #ece9e2; }
.order-quality-warning { margin-top: 18px; }
.sale-detail-lines-wrap { max-height: 420px; border: 1px solid var(--line); }
.sale-detail-lines { min-width: 1700px; }
.sale-detail-lines thead { position: sticky; top: 0; z-index: 1; }

/* Transfer builder */
.transfer-builder { display: grid; grid-template-columns: minmax(760px, 1fr) 310px; gap: 18px; align-items: start; }
.transfer-form-panel { padding-top: 6px; }
.transfer-info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-span-two { grid-column: span 2; }
.transfer-scan-row { display: grid; grid-template-columns: 1fr 90px auto; gap: 10px; }
.transfer-scan-row label { position: relative; }
.transfer-scan-row label svg { position: absolute; left: 12px; top: 11px; width: 17px; color: #8d877c; }
.transfer-scan-row label input { height: 42px; padding-left: 40px; font-family: ui-monospace, Consolas, monospace; }
.transfer-scan-row > input, .transfer-scan-row .button { height: 42px; }
.transfer-lines-wrap { min-height: 235px; margin-top: 16px; border: 1px solid var(--line); border-radius: 5px; }
.transfer-lines-wrap table { min-width: 720px; }
.transfer-quantity { width: 72px; height: 31px; }
.remove-line { color: #9a5c52; background: transparent; border: 0; font-size: 18px; }
.transfer-summary-card { position: sticky; top: 112px; padding: 27px; color: #eee8dc; background: linear-gradient(155deg, #25251f, #161612); border: 1px solid #302f29; border-radius: 8px; box-shadow: 0 18px 45px rgba(24,23,19,.16); }
.transfer-summary-card h3 { margin: 8px 0 23px; font: 500 22px/1.2 "Songti SC", STSong, serif; }
.transfer-summary-card dl { margin: 0; }
.transfer-summary-card dl div { padding: 12px 0; display: flex; justify-content: space-between; gap: 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.transfer-summary-card dt { color: #858178; font-size: 9px; }
.transfer-summary-card dd { margin: 0; color: #e2dbce; font-size: 10px; font-weight: 650; text-align: right; }
.transfer-summary-card .button + .button { margin-top: 9px; }
.transfer-print-sheet, .warranty-print-sheet, .stocktake-print-sheet { display: none; }

/* Record dialogs */
.record-dialog { width: min(1120px, calc(100vw - 48px)); max-height: calc(100vh - 48px); padding: 0; overflow: hidden; color: var(--ink); background: #fbfaf6; border: 1px solid #d9d2c5; border-radius: 10px; box-shadow: 0 36px 100px rgba(15,15,12,.38); }
.record-dialog::backdrop { background: rgba(18,18,15,.72); backdrop-filter: blur(5px); }
.record-dialog form { margin: 0; }
.record-dialog-head { min-height: 105px; padding: 24px 28px; display: flex; align-items: flex-start; justify-content: space-between; background: linear-gradient(120deg, #24241f, #171713); cursor: move; }
.record-dialog-head h2 { margin: 8px 0 5px; color: #f0eadd; font: 550 25px/1.2 "Songti SC", STSong, serif; }
.record-dialog-head p { margin: 0; color: #858279; font-size: 9px; }
.record-dialog-head .dialog-close { color: #aaa69d; background: rgba(255,255,255,.07); }
.record-dialog-head:active { cursor: grabbing; }
.record-dialog-body { max-height: calc(100vh - 220px); padding: 8px 28px 28px; overflow: auto; }
.dialog-section { padding: 21px 0; border-bottom: 1px solid var(--line); }
.dialog-section:last-child { border-bottom: 0; }
.dialog-section h3 { margin: 0 0 16px; display: flex; gap: 9px; align-items: center; font: 600 14px/1.2 "Songti SC", STSong, serif; }
.dialog-section h3 span { color: #a47c35; font: 650 12px/1 Georgia, serif; }
.textarea-field { display: grid; gap: 7px; }
.textarea-field > span { color: #68665f; font-size: 10px; font-weight: 600; }
textarea { width: 100%; padding: 11px; color: #2f2e29; background: #fbfaf6; border: 1px solid #ded9cf; border-radius: 4px; outline: none; resize: vertical; }
textarea:focus { border-color: #bfa66e; box-shadow: 0 0 0 3px rgba(185,149,76,.1); }
.record-dialog-actions { min-height: 70px; padding: 13px 28px; display: flex; gap: 9px; align-items: center; justify-content: flex-end; background: #f0ede6; border-top: 1px solid #ddd7cb; }
.record-dialog-actions > span { margin-right: auto; color: #8e8a80; font-size: 9px; }
.record-dialog-actions[hidden] { display: none; }
.profile-dialog, .order-dialog { width: min(1040px, calc(100vw - 48px)); }
.dialog-loading { min-height: 320px; display: grid; grid-template-columns: auto auto; gap: 5px; place-content: center; color: #89857c; font-size: 10px; }
.profile-hero { margin: 20px 0; padding: 22px; display: grid; grid-template-columns: 58px 1fr auto; gap: 15px; align-items: center; color: #eee8dc; background: linear-gradient(135deg, #25251f, #191915); border-radius: 7px; }
.profile-hero .member-avatar { width: 58px; height: 58px; }
.profile-hero h3 { margin: 0 0 5px; font: 550 22px/1.2 "Songti SC", STSong, serif; }
.profile-hero p { margin: 0; color: #8f8b82; font-size: 9px; }
.profile-hero dl { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(95px,1fr)); gap: 24px; text-align: right; }
.profile-hero dt { color: #827e75; font-size: 8px; }
.profile-hero dd { margin: 5px 0 0; color: #e3c57c; font: 600 17px/1 Georgia, serif; }
.profile-grid { display: grid; grid-template-columns: .85fr 1.15fr; gap: 16px; }
.profile-block { padding: 20px; background: #fffefb; border: 1px solid var(--line); border-radius: 6px; }
.profile-block tr.is-expired { color: #8a837a; opacity: .65; }
.profile-block h4 .text-button { margin-left: 10px; font-size: 12px; }
.profile-block h4, .report-section h4 { margin: 0 0 16px; font: 600 15px/1.2 "Songti SC", STSong, serif; }
.profile-facts { display: grid; grid-template-columns: repeat(2,1fr); gap: 0 20px; }
.profile-facts div { padding: 11px 0; border-bottom: 1px solid var(--line); }
.profile-facts dt { color: #8f8b82; font-size: 8px; }
.profile-facts dd { margin: 5px 0 0; font-size: 10px; font-weight: 600; }
.profile-inline-edit { width: 100%; padding: 0 0 3px; border: 0; border-bottom: 1px dashed var(--line-dark); border-radius: 0; background: transparent; color: inherit; font: inherit; }
.profile-inline-edit::placeholder { color: #b3ada2; font-weight: 400; }
.profile-inline-edit:hover, .profile-inline-edit:focus { border-bottom: 1px solid var(--gold); outline: none; }
.profile-ledger, .profile-orders { max-height: 310px; overflow: auto; }
.profile-ledger .ledger-row { margin: 0; }
.source-summary-empty { min-height: 135px; padding: 24px; display: grid; place-content: center; text-align: center; color: #827d72; background: #f3efe7; border: 1px dashed #d8cdb8; border-radius: 5px; }
.source-summary-empty strong { color: #6e5b35; font-size: 11px; }
.source-summary-empty p { max-width: 470px; margin: 7px auto 0; font-size: 9px; line-height: 1.7; }
.order-summary-grid { margin: 18px 0; display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }
.order-summary-grid > div { padding: 14px; background: #f1eee7; border-radius: 5px; }
.order-summary-grid small { color: #8f8b82; font-size: 8px; }
.order-summary-grid strong { margin-top: 6px; display: block; font-size: 12px; }
.item-edit-dialog { width: min(1320px, calc(100vw - 36px)); }
.item-edit-dialog .record-dialog-head { min-height: 92px; padding-top: 19px; padding-bottom: 19px; }
.legacy-item-body { padding-top: 18px; }
.legacy-stock-strip { padding: 14px; display: grid; grid-template-columns: 1.05fr 1fr 1fr .75fr .9fr .8fr 1fr; gap: 9px; background: linear-gradient(135deg, #ede7da, #f6f2e9); border: 1px solid #dcd3c2; border-left: 3px solid #ad853b; border-radius: 6px; }
.legacy-stock-strip label, .legacy-product-grid label, .legacy-pricing-grid label { min-width: 0; display: grid; gap: 6px; }
.legacy-stock-strip label > span, .legacy-product-grid label > span, .legacy-pricing-grid label > span { color: #706b61; font-size: 9px; font-weight: 750; }
.legacy-stock-strip input { height: 35px; font-weight: 700; }
.legacy-product-section { padding-bottom: 18px; }
.legacy-product-grid { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 11px; }
.legacy-span-two { grid-column: span 2; }
.legacy-remark-field { grid-column: span 2; }
.legacy-stone-section { padding-bottom: 17px; }
.legacy-stone-table-wrap { border: 1px solid #ded8cc; border-radius: 5px; }
.stone-review-action { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 10px; }
.stone-review-action span { color: #756d5c; font-size: 10px; }
.stone-review-action button[hidden] { display: none; }
.legacy-stone-table { min-width: 1160px; table-layout: fixed; }
.legacy-stone-table th { padding: 9px 7px; color: #736e64; background: #eee9df; font-size: 8px; text-align: center; }
.legacy-stone-table th:first-child { width: 145px; }
.legacy-stone-table td { padding: 6px; background: #fffefb; }
.legacy-stone-table input, .legacy-stone-table select { height: 33px; padding: 0 8px; text-align: center; }
.legacy-stone-table td:first-child input, .legacy-stone-table td:first-child select { text-align: left; font-weight: 700; }
.legacy-side-stone-row { background: #fbf8f1; }
.legacy-data-note { margin: 9px 0 0; color: #9a9387; font-size: 8px; line-height: 1.6; }
.legacy-pricing-section { border-bottom: 0; }
.legacy-pricing-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 11px; }

/* Purchase inbound: document-first workflow with a one-item editor dialog. */
.inbound-order-builder { align-items: start; }
.inbound-order-header { min-height: 0; }
.inbound-order-toolbar { margin-top: 18px; padding-top: 15px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-top: 1px solid var(--line); }
.inbound-order-toolbar > div { display: grid; gap: 4px; }
.inbound-order-toolbar strong { color: #37352f; font-size: 11px; }
.inbound-order-toolbar small { color: #918d84; font-size: 8px; }
.inbound-line-dialog { width: min(1240px, calc(100vw - 28px)); }
.inbound-line-dialog .record-dialog-head { min-height: 82px; padding: 16px 24px; }
.inbound-line-dialog .record-dialog-head h2 { margin: 5px 0 3px; font-size: 24px; }
.inbound-line-dialog .record-dialog-head p { font-size: 9px; }
.inbound-line-dialog .record-dialog-body { max-height: calc(100vh - 158px); padding: 12px 18px 16px; }
.inbound-line-dialog input[readonly] { color: #8a867d; background: #efede7; }
.inbound-line-dialog .record-dialog-actions { min-height: 60px; padding: 9px 18px; }
.inbound-line-dialog .record-dialog-actions > span { font-size: 10px; }
#inventoryEditDialog[open] { display: flex; flex-direction: column; height: min(880px, calc(100dvh - 48px)); }
#inventoryEditDialog form { display: flex; flex: 1 1 auto; min-height: 0; flex-direction: column; }
#inventoryEditDialog .record-dialog-head, #inventoryEditDialog .record-dialog-actions { flex: 0 0 auto; }
#inventoryEditDialog .record-dialog-body { flex: 1 1 auto; min-height: 0; max-height: none; overflow-y: auto; }
.inbound-legacy-body { display: grid; gap: 12px; }
.inbound-legacy-group { position: relative; padding: 20px 12px 12px; border: 1px solid #d7d0c3; border-radius: 5px; background: #fbfaf6; }
.inbound-legacy-group > h3 { position: absolute; top: -9px; left: 11px; margin: 0; padding: 0 8px; color: #4d4a42; background: #fbfaf6; font: 700 11px/1.5 sans-serif; }
.inbound-basic-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 12px; }
.inbound-basic-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.inbound-basic-column { display: grid; align-content: start; gap: 8px; }
.inbound-basic-column label, .inbound-gold-row label, .inbound-total-grid label { min-width: 0; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 7px; align-items: center; }
.inbound-basic-column label > span, .inbound-gold-row label > span, .inbound-total-grid label > span { color: #5f5b53; font-size: 10px; font-weight: 700; text-align: right; }
.inbound-basic-column input, .inbound-basic-column select, .inbound-gold-row input, .inbound-gold-row select, .inbound-total-grid input, .inbound-total-grid select { min-width: 0; height: 34px; padding: 0 8px; font-size: 10px; }
.inbound-image-box { padding: 9px; display: grid; grid-template-rows: auto 1fr auto; gap: 8px; border: 1px solid #d7d0c3; border-radius: 4px; background: #f2efe8; }
.inbound-image-box > strong { color: #565249; font-size: 10px; }
.inbound-image-box > div { min-height: 148px; display: grid; place-content: center; gap: 7px; color: #aaa59b; background: #fff; border: 1px solid #ded8cc; text-align: center; }
.inbound-image-box > div span { font-size: 13px; }
.inbound-image-box > div small { max-width: 170px; font-size: 8px; line-height: 1.5; }
.inbound-image-box .button { height: 32px; font-size: 9px; }
.inventory-image-box { grid-template-rows: auto minmax(148px, 1fr); align-content: start; }
.inventory-image-box .inventory-image-preview { min-width: 0; padding: 7px; place-content: center; }
.inventory-image-preview img { display: block; max-width: 100%; max-height: 180px; margin: auto; object-fit: contain; }
.inventory-image-box [hidden] { display: none; }
.inventory-image-box > small { color: #75736a; font-size: 9px; line-height: 1.5; }
.inventory-image-box select { min-width: 0; width: 100%; font-size: 10px; }
.inventory-camera-dialog { width: min(620px, calc(100vw - 32px)); }
.inventory-camera-dialog video { display: block; width: 100%; max-height: 45vh; background: #171713; }
.inventory-camera-dialog .record-dialog-body { padding-top: 16px; }
.inventory-camera-dialog .record-dialog-body p { font-size: 12px; line-height: 1.6; }
.inbound-gold-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.inbound-gold-row label { grid-template-columns: 58px minmax(0, 1fr); }
.inbound-line-dialog .inbound-stone-table { width: 100%; min-width: 0; table-layout: fixed; }
.inbound-line-dialog .inbound-stone-table th { height: 30px; padding: 5px; font-size: 8px; }
.inbound-line-dialog .inbound-stone-table th:first-child { width: 130px; }
.inbound-line-dialog .inbound-stone-table td { padding: 5px; }
.inbound-line-dialog .inbound-stone-table input, .inbound-line-dialog .inbound-stone-table select { height: 32px; padding: 0 6px; font-size: 9px; }
.inbound-total-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.inbound-total-grid label { grid-template-columns: 56px minmax(0, 1fr); }
.inbound-total-grid.compact-row { gap: 10px; }
.inbound-total-grid.compact-row label { grid-template-columns: 48px minmax(0, 1fr); }
.inventory-detail-total-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }

@media (max-width: 900px) {
  .inbound-basic-workspace { grid-template-columns: 1fr; }
  .inbound-image-box { display: none; }
  .inbound-basic-columns { grid-template-columns: 1fr; }
  .inbound-gold-row, .inbound-total-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inbound-line-dialog .inbound-stone-table { min-width: 850px; }
}

/* Reports */
.report-workspace { overflow: hidden; }
.report-filterbar { padding: 16px 20px; display: grid; grid-template-columns: repeat(3,minmax(170px,220px)) auto; gap: 11px; align-items: end; background: #f1eee7; border-bottom: 1px solid var(--line); }
.report-integrity { margin: 16px 20px 0; }
.report-panel { display: none; padding: 20px; }
.report-panel.is-active { display: block; }
.report-title { padding: 4px 2px 18px; display: flex; align-items: end; justify-content: space-between; }
.report-title h3 { margin: 7px 0 0; font: 600 23px/1.2 "Songti SC", STSong, serif; }
.report-title p { margin: 0; color: #918d83; font-size: 9px; }
.report-kpi-strip { display: grid; grid-template-columns: repeat(6,1fr); color: #eee8dc; background: #22221e; border-radius: 6px; overflow: hidden; }
.report-kpi-strip span { padding: 17px 19px; display: grid; gap: 7px; border-right: 1px solid rgba(255,255,255,.08); }
.report-kpi-strip span:last-child { border: 0; }
.report-kpi-strip small { color: #87837a; font-size: 8px; }
.report-kpi-strip strong { color: #e1c37b; font: 600 17px/1 Georgia, serif; }
.report-section { margin-top: 22px; }
.report-section > h4 {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 10px;
  padding: 5px 12px 6px;
  border: 1px solid #e4dccb;
  border-left-width: 4px;
  border-left-color: #c4b48a;
  border-radius: 4px;
  background: #f7f3ea;
  color: #3f3a32;
  font: 700 14px/1.2 "Songti SC", STSong, serif;
}
.report-section.is-tone-sale > h4 { color: #1e6b42; background: #e8f6ee; border-color: #c5e6d1; border-left-color: #3d9a64; }
.report-section.is-tone-transfer > h4 { color: #2b579a; background: #eaf2fb; border-color: #c7dbf6; border-left-color: #3d6db3; }
.report-section.is-tone-inbound > h4 { color: #7d5b12; background: #f8efd8; border-color: #ebd39b; border-left-color: #c4a056; }
.report-section.is-tone-return > h4 { color: #1b6b6b; background: #e5f4f2; border-color: #b7e0db; border-left-color: #2a9a90; }
.report-section.is-tone-supplier-return > h4 { color: #8a4b2a; background: #f6e6dc; border-color: #e5c4ae; border-left-color: #c07548; }
.report-section.is-tone-stocktake > h4 { color: #5a4a8a; background: #ece6f7; border-color: #d0c6e8; border-left-color: #7a68b0; }
.report-section.is-tone-stock > h4 { color: #5a5348; background: #f3efe6; border-color: #ddd4c4; border-left-color: #8a8173; }
.report-section h4 small { margin-left: 8px; color: #918d83; font: 500 9px/1.4 sans-serif; }
.report-inbound-wrap { max-height: 280px; }
.report-table-wrap { max-height: 360px; }
.report-section table tfoot td { color: #39372f; background: #f3f0e8; border-top: 1px solid #cfc7b7; font-weight: 700; }
.report-document-row { cursor: pointer; }
.report-document-row:hover td { background: #fbf4e3; }
.report-document-row td strong, .report-document-row td small { display: block; }
.report-document-row td small { margin-top: 3px; color: #9b978e; font-size: 8px; }
.report-sales-summary-table th, .report-sales-summary-table td { padding: 6px 8px; }
.report-sales-detail-row > td { padding: 0 10px 9px; background: #fbfaf6; }
.report-sales-line-table { width: 100%; border: 1px solid #ddd6c8; font-size: 8px; }
.report-sales-line-table th { height: 25px; padding: 4px 8px; color: #807a6e; background: #eeeae1; }
.report-sales-line-table td { height: 25px; padding: 4px 8px; background: #fff; }
.report-orders-container { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.report-order-card {
  border: 1px solid #ddd6c8;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.03);
  overflow: hidden;
  transition: border-color .15s ease-in-out;
}
.report-order-card:hover { border-color: #bfa66e; }
.report-order-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 3px 12px;
  padding: 6px 12px;
  border-bottom: 1px solid #e7e2d4;
  font-size: 10px;
  color: #555;
}
.report-card-identity { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; min-width: 0; }
.report-card-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 600;
  color: #7d5b12;
  background: #faedd0;
  border: 1px solid #ebd39b;
}
.report-card-badge.is-sale { color: #1e6b42; background: #e2f4e9; border-color: #bee5cb; }
.report-card-badge.is-transfer { color: #2b579a; background: #e4eefb; border-color: #c7dbf6; }
.report-card-badge.is-inbound { color: #7d5b12; background: #faedd0; border-color: #ebd39b; }
.report-card-badge.is-return { color: #1b6b6b; background: #e1f4f2; border-color: #b7e0db; }
.report-card-badge.is-supplier-return { color: #8a4b2a; background: #f6e6dc; border-color: #e5c4ae; }
.report-card-badge.is-stocktake { color: #5a4a8a; background: #ece6f7; border-color: #d0c6e8; }
.report-card-no { font-size: 12px; font-weight: 700; color: #1a1a1a; letter-spacing: .2px; }
.report-card-no.is-clickable { cursor: pointer; color: #8c6819; text-decoration: underline; text-underline-offset: 2px; }
.report-card-no.is-clickable:hover { color: #573f0c; }
.report-card-time { color: #8c867b; font-size: 9px; }
.report-card-meta {
  display: flex;
  align-items: baseline;
  flex-wrap: nowrap;
  gap: 3px 12px;
  flex: 1 1 auto;
  min-width: 0;
}
.report-card-meta-item { display: inline-flex; align-items: baseline; gap: 4px; min-width: 0; white-space: nowrap; }
.report-card-meta-item small { color: #8c867b; font-size: 8px; }
.report-card-meta-item strong { color: #222; font-weight: 600; }
.report-card-metrics {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex: 0 0 auto;
  font-size: 10px;
  color: #666;
}
.report-card-metrics strong { color: #1a1a1a; }
.report-sale-card .report-order-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}
.report-sale-card .report-card-identity { grid-column: 1; grid-row: 1; }
.report-sale-card .report-card-metrics { grid-column: 2; grid-row: 1; margin-left: 0; }
.report-sale-card .report-card-meta { grid-column: 1 / -1; grid-row: 2; flex-wrap: wrap; }
.report-card-meta-item.report-card-note strong { color: #555; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.report-order-card-body { width: 100%; overflow-x: auto; }
.report-order-card-body .report-sales-line-table { margin: 0; border: none; border-collapse: collapse; }
.report-order-card-body .report-sales-line-table th { background: #fdfcf9; border-bottom: 1px solid #e5e0d3; color: #736c5f; font-weight: 600; }
.report-order-card-body .report-sales-line-table td { border-bottom: 1px solid #f2eee3; }
.report-order-card-body .report-sales-line-table tr:last-child td { border-bottom: none; }
.report-sales-total-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 14px;
  padding: 8px 12px;
  margin-top: 10px;
  background: #fbfaf7;
  border: 1px solid #e5e0d3;
  border-radius: 4px;
  font-size: 10px;
  color: #666;
}
.report-sales-total-bar > span:first-child { margin-right: auto; font-weight: 600; color: #333; }
.report-sales-total-bar strong { color: #1a1a1a; font-size: 11px; }
.report-movement-transfer-line-table .report-transfer-col-code { width: 14%; }
.report-movement-transfer-line-table .report-transfer-col-name { width: 14%; }
.report-movement-transfer-line-table .report-transfer-col-category { width: 11%; }
.report-movement-transfer-line-table .report-transfer-col-certificate { width: 13%; }
.report-movement-transfer-line-table .report-transfer-col-model { width: 9%; }
.report-movement-transfer-line-table .report-transfer-col-quantity { width: 6%; }
.report-movement-transfer-line-table .report-transfer-col-weight { width: 7%; }
.report-movement-transfer-line-table .report-transfer-col-remark { width: 12%; }
.report-movement-transfer-line-table .report-transfer-col-price { width: 14%; }
.report-movement-transfer-line-table th:nth-child(6),
.report-movement-transfer-line-table th:nth-child(7),
.report-movement-transfer-line-table th:nth-child(9),
.report-movement-transfer-line-table td:nth-child(6),
.report-movement-transfer-line-table td:nth-child(7),
.report-movement-transfer-line-table td:nth-child(9) { text-align: right; }
.report-detail-unavailable { display: block; padding: 8px 10px; color: #9a958b; border: 1px dashed #d8d1c4; background: #fff; font-size: 8px; }
.report-stock-comparison-table th:not(:first-child), .report-stock-comparison-table td:not(:first-child) { text-align: right; }
.report-stock-comparison-table td.stock-count-value { color: #c0392b; font-weight: 700; }
.report-stock-comparison-table th:nth-child(5), .report-stock-comparison-table td:nth-child(5), .report-stock-comparison-table th:nth-child(7), .report-stock-comparison-table td:nth-child(7) { border-left: 1px solid #d8d1c4; }
.report-flow-wrap { max-height: 560px; }
.report-flow-wrap table { min-width: 2350px; }
.report-flow-wrap thead tr:first-child th { color: #e0c27c; background: #25251f; border-right: 1px solid #3a3931; text-align: center; }
.report-flow-wrap thead tr:nth-child(2) th { background: #eae4d7; }
.report-flow-wrap td { text-align: right; }
.report-flow-wrap td:first-child { position: sticky; left: 0; z-index: 1; color: #282721; background: #fffefb; text-align: left; font-weight: 650; }
.report-value-missing { color: #aaa69d; }
.flow-cell-increase { color: #c0392b; font-weight: 600; }
.flow-cell-decrease { color: #278a5b; font-weight: 600; }
.payment-report-filters { margin-bottom: 14px; padding: 14px; display: grid; grid-template-columns: repeat(4,minmax(150px,1fr)); gap: 10px; background: #f3f0e9; border: 1px solid #e2ddd2; border-radius: 6px; }
.payment-report-filters label { display: grid; gap: 6px; }
.payment-report-filters label > span { color: #77746c; font-size: 9px; font-weight: 700; }
.payment-report-kpis { grid-template-columns: repeat(4,1fr); }
.payment-method-summary { display: grid; grid-template-columns: repeat(3,minmax(180px,1fr)); gap: 10px; }
.payment-method-summary > div:not(.source-summary-empty) { padding: 14px 16px; display: grid; gap: 5px; background: #f3f0e9; border-left: 2px solid #bea05e; border-radius: 4px; }
.payment-method-summary > .source-summary-empty { grid-column: 1 / -1; }
.payment-method-summary span { color: #77736a; font-size: 9px; font-weight: 700; }
.payment-method-summary strong { color: #292821; font: 600 16px/1 Georgia,serif; }
.payment-method-summary small { color: #969188; font-size: 8px; }
.payment-report-wrap { max-height: 560px; }
.payment-report-wrap table { min-width: 1380px; }
.payment-report-wrap td strong, .payment-report-wrap td small { display: block; }
.payment-report-wrap td small { margin-top: 4px; color: #9a968d; font-size: 8px; }
.payment-business-type { display: inline-flex; padding: 5px 7px; color: #685f4e; background: #eee9df; border-radius: 99px; font-size: 8px; font-weight: 700; }
.payment-business-type.is-outflow { color: #884a43; background: #f4e7e4; }
.payment-amount.is-inflow { color: #48684f; }
.payment-amount.is-outflow { color: #984f47; }

.gold-dialog { width: 560px; padding: 0; color: var(--ink); background: #fbfaf6; border: 1px solid #d8d2c6; border-radius: 8px; box-shadow: 0 35px 90px rgba(15,15,12,.35); }
.gold-dialog::backdrop { background: rgba(20,20,17,.68); backdrop-filter: blur(4px); }
.gold-dialog form { padding: 28px; }
.dialog-heading { display: flex; justify-content: space-between; }
.dialog-heading h2 { margin: 8px 0 6px; font: 600 24px/1.2 "Songti SC", STSong, serif; }
.dialog-heading p { margin: 0; color: #858279; font-size: 10px; }
.dialog-close { width: 32px; height: 32px; color: #817e75; background: #f0ede6; border: 0; border-radius: 50%; font-size: 19px; }
.rate-edit-list { margin-top: 22px; }
.rate-edit-row { padding: 14px 0; display: grid; grid-template-columns: 1fr 155px; gap: 20px; align-items: center; border-bottom: 1px solid var(--line); }
.rate-edit-row div { display: grid; gap: 3px; }
.rate-edit-row strong { font-size: 11px; }
.rate-edit-row small { color: #97938a; font-size: 8px; }
.rate-edit-row label { position: relative; }
.rate-edit-row input { padding-left: 26px; text-align: right; }
.rate-edit-row label::before { content: "¥"; position: absolute; left: 10px; top: 11px; z-index: 1; color: #8f8c83; font-size: 10px; }
.formula-note { margin-top: 20px; padding: 14px; background: #f1eee7; border-left: 2px solid var(--gold); }
.formula-note strong { font-size: 10px; }
.formula-note p { margin: 5px 0 0; color: #817e75; font-size: 9px; line-height: 1.65; }
.dialog-actions { margin-top: 22px; display: flex; justify-content: flex-end; gap: 9px; }

.toast { position: fixed; top: 22px; left: 50%; min-width: 280px; max-width: min(560px, calc(100vw - 32px)); padding: 14px 17px; display: flex; gap: 10px; align-items: center; color: #eee8dc; background: #20201c; border: 1px solid #3b3931; border-radius: 6px; box-shadow: 0 18px 45px rgba(18,18,15,.28); transform: translate(-50%, -80px); opacity: 0; pointer-events: none; transition: .25s ease; z-index: 10000; }
.toast.is-in-dialog { position: absolute; top: 16px; }
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }
.toast i { width: 23px; height: 23px; display: grid; place-items: center; color: #242017; background: #c7a65f; border-radius: 50%; font-size: 11px; font-style: normal; }
.toast span { font-size: 11px; }
.toast.is-error { border-color: #70433c; }
.toast.is-error i { color: #fff2ee; background: #9d584d; }

@media (max-width: 1380px) {
  .view { padding-left: 25px; padding-right: 25px; }
  .topbar { padding-left: 25px; padding-right: 25px; }
  .hero-panel { padding-left: 35px; }
  .metric-card { padding-left: 17px; padding-right: 17px; }
  .metric-card > strong { font-size: 21px; }
  .field-grid.four { grid-template-columns: repeat(3, 1fr); }
  .form-layout { grid-template-columns: 1fr 290px; }
  .jewelry-label { width: 450px; }
  .inventory-toolbar { grid-template-columns: repeat(4, minmax(118px, 1fr)); }
  .advanced-inventory { grid-template-columns: repeat(4, minmax(118px, 1fr)); }
  .advanced-inventory > div { grid-column: span 2; }
  .inventory-summary { grid-template-columns: repeat(3, 1fr); }
  .inventory-summary > span { border-bottom: 1px solid rgba(255,255,255,.07); }
  .entity-toolbar { grid-template-columns: minmax(230px, 1.6fr) repeat(2, minmax(125px,.8fr)) auto auto; }
  .entity-toolbar label:nth-of-type(4) { grid-column: auto; }
  .sales-items-toolbar { grid-template-columns: repeat(4, minmax(130px, 1fr)); }
  .sales-items-search { grid-column: span 2; }
  .sales-items-query-actions { grid-column: span 2; }
  .transfer-builder { grid-template-columns: minmax(700px, 1fr) 285px; }
  .legacy-stock-strip { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .legacy-product-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
}

@media (max-width: 1100px) {
  .operational-sales-layout { grid-template-columns: 1fr; }
  .operational-checkout { position: static; }
  .stocktake-layout { grid-template-columns: 1fr; }
  .stocktake-summary-card { position: static; }
  .stocktake-task-bar { grid-template-columns: 1fr auto; }
  .stocktake-task-bar > dl { grid-column: 1 / -1; }
  .inbound-builder { grid-template-columns: 1fr; }
  .inbound-insight { position: static; }
  .inbound-product-fields, .inbound-form-panel .field-grid.four { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .inbound-form-panel .field-grid.three { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .field-span-three { grid-column: span 2; }
  .payment-report-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .payment-method-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .legacy-product-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .legacy-pricing-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}

@media (max-width: 720px) {
  .stocktake-task-bar { grid-template-columns: 1fr; gap: 14px; }
  .stocktake-task-bar > dl { flex-wrap: wrap; gap: 14px 24px; }
  .stocktake-bar-actions { justify-content: flex-start; }
  .stocktake-steps { grid-template-columns: repeat(2,1fr); }
  .scan-entry { grid-template-columns: 1fr; }
  .scan-glyph { display: none; }
  .scan-help { padding-left: 22px; flex-direction: column; gap: 6px; }
  .stocktake-candidates { margin-left: 22px; }
  .stocktake-mini-metrics { grid-template-columns: repeat(2,1fr); }
  .stocktake-line-toolbar { align-items: stretch; flex-direction: column; }
  .stocktake-line-toolbar input { width: 100%; }
  .stocktake-create-fields { grid-template-columns: 1fr !important; }
  .stocktake-create-fields .field-span-two { grid-column: auto; }
  .operational-member-lookup, .sale-scan-row, .sale-new-member { grid-template-columns: 1fr; margin-left: 0; }
  .operational-member-lookup .step-number { display: none; }
  .sale-member-result .data-empty, .sale-matched-member { margin-left: 0; }
  .sale-matched-member { grid-template-columns: 43px minmax(0,1fr) auto; }
  .sale-matched-member .text-button { grid-column: 2 / -1; justify-self: end; }
  .sale-return-fields { grid-template-columns: 1fr !important; }
  .sale-return-fields .field-span-two { grid-column: auto; }
  .sale-return-payment-head { align-items: stretch; flex-direction: column; }
  .sale-return-payment-row { grid-template-columns: 1fr 1fr 32px; }
  .sale-return-payment-row [data-sale-return-payment-method] { grid-column: 1; grid-row: 1; }
  .sale-return-payment-row [data-sale-return-payment-amount] { grid-column: 2; grid-row: 1; }
  .sale-return-payment-row [data-sale-return-payment-reference] { grid-column: 1; grid-row: 2; }
  .sale-return-payment-row [data-sale-return-payment-remark] { grid-column: 2; grid-row: 2; }
  .sale-return-payment-row .remove-line { grid-column: 3; grid-row: 1 / span 2; }
  .inbound-page-head, .inbound-paste-actions { align-items: stretch; flex-direction: column; }
  .inbound-page-head > div:last-child { width: 100%; }
  .inbound-page-head .button { flex: 1; }
  .inbound-product-fields, .inbound-form-panel .field-grid.four, .inbound-form-panel .field-grid.three { grid-template-columns: 1fr; }
  .legacy-stock-strip, .legacy-product-grid, .legacy-pricing-grid { grid-template-columns: 1fr; }
  .legacy-span-two, .legacy-remark-field { grid-column: auto; }
  .field-span-three { grid-column: auto; }
  .inbound-form-panel { padding-left: 16px; padding-right: 16px; }
  .inbound-paste-panel textarea { width: calc(100% - 32px); margin-left: 16px; margin-right: 16px; }
  .inbound-paste-actions { padding-left: 16px; padding-right: 16px; }
  .payment-report-filters, .payment-method-summary, .payment-report-kpis { grid-template-columns: 1fr; }
}

/* 2026-08-15 desktop workstation mode: dense, table-first, scan-first */
@media (min-width: 1101px) {
  .app-shell { grid-template-columns: 220px 1fr; }
  .brand { min-height: 72px; padding: 15px 18px; }
  .primary-nav { padding: 13px 10px; }
  .nav-label { margin-bottom: 6px; }
  .nav-item, .nav-group-toggle { height: 41px; padding: 0 12px; }
  .nav-item.sub { height: 33px; }
  .sidebar-footer { padding: 10px; }
  .connection-dot { padding-bottom: 9px; }

  .topbar { height: 72px; padding: 0 20px; }
  .topbar h1 { font-size: 21px; }
  .global-search { width: 310px; height: 40px; }
  .gold-rate-button { height: 44px; }
  .view:not([data-view-panel="dashboard"]) { padding: 12px 18px 24px; }
  .view:not([data-view-panel="dashboard"]) .page-actions { min-height: 48px; margin-bottom: 7px; align-items: center; }
  .view:not([data-view-panel="dashboard"]) .page-actions h2 { margin: 4px 0 2px; font-size: 22px; }
  .view:not([data-view-panel="dashboard"]) .page-actions p { max-width: 950px; overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
  .view:not([data-view-panel="dashboard"]) .soft-badge { padding: 3px 6px; font-size: 7px; }
  .view:not([data-view-panel="dashboard"]) .button { min-height: 34px; }
  .view:not([data-view-panel="dashboard"]) .panel { border-radius: 5px; }
  .view:not([data-view-panel="dashboard"]) table th { height: 34px; padding: 7px 9px; }
  .view:not([data-view-panel="dashboard"]) table td { padding: 7px 9px; }
  .data-integrity-note { min-height: 34px; margin-bottom: 7px; padding: 7px 10px; gap: 8px; }
  .data-integrity-note strong, .data-integrity-note span { font-size: 8px; }
  .data-integrity-note:not(.dark) span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  input, select { height: 33px; }

  /* Real-time inventory */
  .inventory-page-head { margin-bottom: 5px !important; }
  .inventory-live-strip { min-height: 36px; margin-bottom: 6px; padding: 0 11px; border-radius: 4px; }
  .inventory-live-strip p { max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .inventory-kpis { display: none; }
  .inventory-table-panel { margin-top: 0; }
  .inventory-commandbar { min-height: 42px; padding: 5px 8px; border-radius: 5px 5px 0 0; }
  .command-button { min-height: 30px; padding: 0 9px; font-size: 8px; }
  .inventory-toolbar { padding: 8px 10px; grid-template-columns: repeat(8, minmax(92px, 1fr)); gap: 7px 8px; }
  .inventory-toolbar .is-source-unavailable { display: none; }
  .inventory-toolbar label, .advanced-inventory label { gap: 3px; }
  .inventory-toolbar select, .inventory-toolbar input { height: 32px; font-size: 10px; }
  .inventory-code-filter { grid-column: span 2; }
  .inventory-query-actions { grid-column: span 3; height: 32px; }
  .inventory-query-actions .button { height: 32px; min-height: 32px; }
  #runInventoryQuery.is-pending { box-shadow: 0 0 0 3px rgba(185,149,76,.2); }
  .advanced-inventory { padding: 8px 10px; grid-template-columns: 1.2fr repeat(6, minmax(90px, 1fr)); gap: 7px; }
  .advanced-inventory > div p { display: none; }
  .advanced-inventory input, .advanced-inventory select { height: 32px; }
  .inventory-summary { min-height: 46px; }
  .inventory-summary > span { padding: 8px 11px; gap: 3px; }
  .inventory-summary strong { font-size: 12px; }
  .inventory-table-wrap { min-height: 430px; max-height: calc(100vh - 322px); }
  .inventory-detail-table td { height: 40px; }
  .inventory-detail-table td > small { margin-top: 2px; }
  .inventory-detail-table th[data-column="select"], .inventory-detail-table td[data-column="select"] { position: sticky; left: 0; z-index: 3; width: 38px; min-width: 38px; max-width: 38px; background: #fffefb; }
  .inventory-detail-table thead th[data-column="select"] { z-index: 5; background: #ece8df; }
  .inventory-detail-table tbody tr.is-selected > td[data-column="select"] { background: #f3ead8; }
  .inventory-table-foot { position: sticky; bottom: 0; min-height: 42px; padding: 5px 10px; z-index: 4; }
  .inventory-foot-note { max-width: 48%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .inventory-pagination { margin-left: auto; display: flex; gap: 7px; align-items: center; }
  .inventory-pagination label { display: flex; gap: 6px; align-items: center; }
  .inventory-pagination label > span, .inventory-pagination > span { color: #807c73; font-size: 8px; white-space: nowrap; }
  .inventory-pagination select { width: 86px; height: 30px; padding: 0 7px; font-size: 9px; }
  .inventory-pagination .command-button { color: #6d685e; border-color: #d8d1c4; }
  .inventory-pagination .command-button:disabled { opacity: .4; cursor: not-allowed; }

  /* Shared business-entry density */
  .form-section-title { margin: 11px 0 8px; padding-bottom: 6px; gap: 7px; }
  .form-section-title > span { font-size: 13px; }
  .form-section-title h3 { font-size: 12px; }
  .form-section-title p { display: none; }
  .field-grid { gap: 7px 8px; }
  .field-grid label, .payment-select { gap: 3px; }
  .field-grid label > span, .payment-select > span { font-size: 8px; }
  .form-panel { padding: 4px 14px 13px; }

  /* Inbound */
  .inbound-integrity { margin-bottom: 7px; }
  .inbound-builder { grid-template-columns: minmax(720px, 1fr) 280px; gap: 9px; }
  .inbound-order-builder { width: min(1280px, 100%); grid-template-columns: minmax(0, 1fr) 280px; }
  .inbound-form-panel .field-grid.three { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .inbound-form-panel .field-grid.three .field-span-three { grid-column: span 3; }
  .inbound-product-fields { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
  .cost-fields { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
  .inbound-secondary-fields, .inbound-advanced { margin-top: 8px; padding: 0 10px 9px; background: #f5f2eb; border: 1px solid #e3ded3; border-radius: 4px; }
  .inbound-secondary-fields summary, .inbound-advanced summary { padding: 8px 0; color: #514d44; cursor: pointer; font-size: 9px; font-weight: 750; }
  .inbound-secondary-fields summary small, .inbound-advanced summary small { margin-left: 7px; color: #969188; font-size: 7px; font-weight: 500; }
  .inbound-line-remark { margin-top: 8px; }
  .inbound-line-remark textarea { min-height: 46px; }
  .inbound-editor-actions { margin-top: 8px; }
  .inbound-insight { top: 81px; padding: 14px; }
  .inbound-insight h3 { margin: 4px 0 8px; font-size: 16px; }
  .inbound-insight .cost-orbit { height: 64px; background: none; }
  .inbound-insight .cost-orbit::before { display: none; }
  .inbound-insight .cost-orbit div { width: 100%; height: 58px; padding: 8px; display: grid; grid-template-columns: 1fr auto; align-items: center; text-align: left; transform: none; }
  .inbound-insight .cost-orbit div > * { transform: none; }
  .inbound-insight .cost-orbit small { grid-column: 1; }
  .inbound-insight .cost-orbit strong { grid-column: 2; grid-row: 1 / span 2; margin: 0; font-size: 17px; }
  .inbound-insight .cost-orbit span { grid-column: 1; }
  .inbound-insight dl { margin: 7px 0; }
  .inbound-insight dl div { padding: 6px 0; }
  .inbound-draft-mini { margin-top: 8px; }
  .inbound-draft-mini span { padding: 7px; }
  .cost-insight > p { margin-top: 8px; font-size: 7px; line-height: 1.45; }
  .inbound-lines-panel { margin-top: 8px; }
  .inbound-lines-panel .panel-heading { min-height: 44px; padding-top: 8px; padding-bottom: 8px; }
  .inbound-lines-wrap { min-height: 180px; max-height: 330px; }
  .collapsible-workbench { margin-top: 8px; }
  .collapsible-workbench > summary { min-height: 44px; padding: 0 15px; display: flex; align-items: center; gap: 10px; list-style: none; color: #4a4740; background: #f4f1ea; cursor: pointer; }
  .collapsible-workbench > summary::-webkit-details-marker { display: none; }
  .collapsible-workbench > summary::before { content: "+"; color: #9a7738; font-size: 18px; }
  .collapsible-workbench[open] > summary::before { content: "−"; }
  .collapsible-workbench > summary strong { font-size: 10px; }
  .collapsible-workbench > summary span { color: #918d84; font-size: 8px; }
  .collapsible-workbench[open] > summary { border-bottom: 1px solid var(--line); }
  .sales-page-head > div:last-child { position: fixed; right: 20px; bottom: 18px; z-index: 11; padding: 7px; gap: 7px; background: rgba(30,30,26,.94); border: 1px solid #3c392f; border-radius: 7px; box-shadow: 0 15px 35px rgba(20,20,17,.25); backdrop-filter: blur(8px); }

  /* Sales */
  .operational-sales-layout { grid-template-columns: minmax(0, 1fr) 330px; gap: 9px; }
  .operational-sale-entry { padding: 4px 14px 12px; }
  .operational-sale-entry > .field-grid.three { grid-template-columns: repeat(6, minmax(0,1fr)); }
  .operational-sale-entry > .field-grid.three .field-span-three { grid-column: span 3; }
  .operational-member-lookup { grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
  .operational-member-lookup .step-number { display: none; }
  .operational-member-lookup > div { gap: 3px; }
  .operational-member-lookup label input { height: 36px; }
  .sale-member-result .data-empty { min-height: 42px; margin: 6px 0 0; padding: 8px 12px; display: flex; gap: 9px; align-items: center; justify-content: flex-start; text-align: left; }
  .sale-member-result .data-empty p { margin: 0; }
  .sale-new-member { margin: 6px 0; padding: 8px; }
  .sale-scan-row label input, .sale-scan-row > input, .sale-scan-row .button { height: 38px; }
  .sale-draft-lines-wrap { margin-top: 8px; min-height: 220px; max-height: calc(100vh - 520px); }
  .operational-checkout { top: 81px; padding: 15px; }
  .operational-checkout h3 { margin: 4px 0 8px; font-size: 17px; }
  .operational-checkout dl div { padding: 6px 0; }
  .sale-payment-head { margin: 10px 0 6px; }
  .sale-payment-rows { gap: 5px; }
  .sale-payment-row { padding: 6px; gap: 5px; }
  .sale-payment-row input, .sale-payment-row select { height: 30px; }
  .checkout-total { padding: 10px 0 8px; }
  .checkout-total strong { font-size: 21px; }
  .points-earned { padding: 8px; }
  .operational-checkout > p { margin-top: 8px; font-size: 7px; line-height: 1.45; }

  /* Transfer */
  .transfer-builder { grid-template-columns: minmax(720px, 1fr) 280px; gap: 9px; }
  .transfer-form-panel .field-grid.four { grid-template-columns: repeat(6, minmax(0,1fr)); }
  .transfer-form-panel .field-span-two { grid-column: span 2; }
  .transfer-scan-row label input, .transfer-scan-row > input, .transfer-scan-row .button { height: 38px; }
  .transfer-lines-wrap { min-height: 300px; margin-top: 8px; }
  .transfer-summary-card { top: 81px; padding: 15px; }
  .transfer-summary-card h3 { margin: 5px 0 10px; font-size: 17px; }
  .transfer-summary-card dl div { padding: 7px 0; }
  .transfer-summary-card .data-integrity-note.dark { margin: 10px 0; }

  /* Stocktake */
  .stocktake-page-head { margin-bottom: 5px; }
  .stocktake-task-bar { min-height: 50px; padding: 7px 12px; gap: 16px; border-radius: 5px; }
  .stocktake-task-bar p { display: none; }
  .stocktake-task-bar dl { gap: 16px; }
  .stocktake-steps { margin: 6px 0; gap: 5px; }
  .stocktake-steps article { min-height: 42px; padding: 7px 10px; gap: 7px; border-radius: 4px; }
  .stocktake-steps article > span { font-size: 12px; }
  .stocktake-steps strong { font-size: 9px; }
  .stocktake-steps p { display: none; }
  .stocktake-layout { grid-template-columns: 1fr 275px; gap: 8px; }
  .stocktake-workbench .panel-heading { min-height: 44px; padding: 8px 14px; }
  .scan-entry { padding-top: 12px; padding-bottom: 10px; }
  .scan-help { padding-top: 6px; padding-bottom: 7px; }
  .stocktake-mini-metrics div { padding: 8px 12px; }
  .stocktake-mini-metrics strong { font-size: 15px; }
  .stocktake-line-toolbar { min-height: 44px; padding: 7px 12px; }
  .stocktake-scan-table { max-height: calc(100vh - 405px); }
  .stocktake-summary-card { padding: 14px; }
  .stocktake-summary-card h3 { margin: 4px 0 8px; font-size: 17px; }
  .stocktake-progress { width: 104px; height: 104px; margin: 4px auto 9px; }
  .stocktake-progress::before { width: 82px; height: 82px; }
  .stocktake-progress strong { font-size: 20px; }
  .stocktake-summary-card dl div { padding: 5px 0; }
  .stocktake-warning { margin: 8px 0; padding: 8px; }
  .stocktake-warning p { margin-top: 3px; font-size: 7px; line-height: 1.4; }

  /* Query workspaces and master-detail drawers */
  .entity-kpis, .sales-item-kpis { margin: 0 0 7px !important; gap: 6px; }
  .entity-kpis .metric-card, .sales-item-kpis .metric-card { min-height: 54px; padding: 8px 11px; }
  .entity-kpis .metric-card > span, .sales-item-kpis .metric-card > span { color: #77736a; font-size: 8px; }
  .entity-kpis .metric-card > strong, .sales-item-kpis .metric-card > strong { margin-top: 5px; font-size: 16px; }
  .entity-kpis .metric-card > p, .sales-item-kpis .metric-card > p { display: none; }
  .entity-toolbar { padding: 8px 10px; gap: 7px; }
  .entity-toolbar label { gap: 3px; }
  .entity-toolbar input, .entity-toolbar select, .entity-toolbar .store-tree-trigger, .entity-toolbar .button, .entity-toolbar .text-button { height: 33px; min-height: 33px; }
  .entity-table-wrap { min-height: 440px; max-height: calc(100vh - 268px); }
  .entity-pagination { min-height: 40px; padding: 5px 10px; }
  .sales-items-toolbar { padding: 8px 10px; gap: 7px; }
  .sales-items-toolbar label { gap: 3px; }
  .sales-items-table-wrap { min-height: 440px; max-height: calc(100vh - 305px); }
  .entity-table-wrap tr.is-selected { background: #f3ead8; box-shadow: inset 3px 0 #b9954c; }
  .workspace-drawer[open] { position: fixed; inset: 72px 0 0 auto; width: min(760px, 52vw); height: calc(100vh - 72px); max-height: none; margin: 0; display: grid; grid-template-rows: auto minmax(0,1fr) auto; z-index: 18; border-radius: 8px 0 0 0; box-shadow: -22px 0 55px rgba(20,20,17,.22); }
  .workspace-drawer::backdrop { display: none; }
  .workspace-drawer .record-dialog-head { min-height: 76px; padding: 14px 18px; }
  .workspace-drawer .record-dialog-head h2 { margin-top: 4px; font-size: 20px; }
  .workspace-drawer .record-dialog-body { max-height: none; min-height: 0; padding: 8px 15px 15px; }
  .workspace-drawer .record-dialog-actions { min-height: 54px; padding: 8px 15px; }
  .workspace-drawer .profile-hero { margin: 8px 0; padding: 12px; }
  .workspace-drawer .profile-grid { grid-template-columns: 1fr; gap: 8px; }
  .workspace-drawer .profile-block { padding: 12px; }
  .workspace-drawer .order-summary-grid { margin: 8px 0; grid-template-columns: repeat(2,1fr); gap: 6px; }
  .workspace-drawer .order-summary-grid > div { padding: 9px; }

  /* Reports are filter-and-table first */
  .report-filterbar { padding: 8px 10px; gap: 7px; }
  .report-filterbar label { gap: 3px; }
  .report-filterbar input, .report-filterbar .store-tree-trigger, .report-filterbar .button { height: 33px; min-height: 33px; }
  .report-integrity { margin: 7px 10px 0; }
  .report-panel { padding: 8px 10px 12px; }
  .report-title { padding: 1px 1px 7px; }
  .report-title .section-kicker { display: none; }
  .report-title h3 { margin: 0; font-size: 16px; }
  .report-kpi-strip span { padding: 8px 11px; gap: 3px; }
  .report-kpi-strip strong { font-size: 13px; }
  .report-section { margin-top: 9px; }
  .report-section h4 { margin-bottom: 7px; font-size: 12px; }
  .report-table-wrap, .payment-report-wrap { max-height: calc(100vh - 420px); }
  .report-flow-wrap { max-height: calc(100vh - 300px); }
  .report-table-wrap thead, .payment-report-wrap thead, .report-flow-wrap thead { position: sticky; top: 0; z-index: 3; }
  .report-table-wrap th:first-child, .report-table-wrap td:first-child { position: sticky; left: 0; z-index: 2; background: #fffefb; }
  .report-table-wrap thead th:first-child { z-index: 4; background: #ece8df; }
  .payment-report-filters { margin-bottom: 7px; padding: 8px; gap: 7px; }
  .payment-method-summary { gap: 6px; }
  .payment-method-summary > div:not(.source-summary-empty) { padding: 8px 10px; }

  #newPrintTask:disabled { color: #8e8a80; background: #e5e1d8; border-color: #d6d0c4; box-shadow: none; cursor: not-allowed; }
  .toast { top: 16px; bottom: auto; min-width: 0; width: calc(100vw - 32px); }
}

@media print {
  @page { size: landscape; margin: 10mm; }
  @page label { size: 30mm 47mm; margin: 0; }
  @page transfer { size: A4 portrait; margin: 0; }
  @page warranty { size: A4 portrait; margin: 0; }
  @page report { size: A4 portrait; margin: 8mm; }
  @page stocktake { size: A4 portrait; margin: 10mm; }
  html { min-width: 0 !important; }
  html:has(body.printing-transfer) { min-width: 0 !important; width: 100%; background: #fff; }
  body.printing-transfer { width: 100%; min-width: 0; margin: 0; background: #fff; }
  body.printing-transfer > *:not(#transferPrintSheet) { display: none !important; }
  body.printing-transfer #transferPrintSheet { display: block !important; width: 100%; margin: 0; color: #171714; background: #fff; }
  body.printing-transfer .transfer-print-page { page: transfer; width: 210mm; max-width: 100%; margin: 0; padding: 8mm 13mm 8mm; box-sizing: border-box; font-family: "Microsoft YaHei", "PingFang SC", sans-serif; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  body.printing-transfer .transfer-print-head { padding-bottom: 2.5mm; display: flex; align-items: center; justify-content: space-between; border-bottom: .4mm solid #1b1a17; }
  body.printing-transfer .transfer-print-page h1 { margin: 0; font: 700 19pt/1.1 "Songti SC", SimSun, serif; letter-spacing: 2pt; }
  body.printing-transfer .transfer-print-identity { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 2.5mm; }
  body.printing-transfer .transfer-print-identity span { color: #777168; font-size: 7pt; font-weight: 700; }
  body.printing-transfer .transfer-print-identity strong { font: 700 10pt/1.2 Consolas, monospace; font-variant-numeric: tabular-nums; }
  body.printing-transfer .transfer-print-identity em { padding: .7mm 2mm; color: #1b1a17; background: transparent; border: .2mm solid #777168; border-radius: .5mm; font-size: 7pt; font-style: normal; font-weight: 700; }
  body.printing-transfer .transfer-print-route { margin-top: 2.5mm; padding: 2.5mm 3mm; display: grid; grid-template-columns: 1fr 24mm 1fr; align-items: center; background: transparent; border-bottom: .2mm solid #bdb7ab; }
  body.printing-transfer .transfer-print-location { min-width: 0; }
  body.printing-transfer .transfer-print-location > span { color: #8d6b2d; font-size: 6.5pt; font-weight: 800; letter-spacing: .5pt; }
  body.printing-transfer .transfer-print-location strong { margin-top: .8mm; display: block; font: 700 11.5pt/1.15 "Songti SC", SimSun, serif; }
  body.printing-transfer .transfer-print-location p { margin: .5mm 0 0; color: #5f5b53; font-size: 7.5pt; }
  body.printing-transfer .transfer-print-location.is-destination { text-align: right; }
  body.printing-transfer .transfer-print-arrow { display: grid; justify-items: center; gap: 1.2mm; }
  body.printing-transfer .transfer-print-arrow i { position: relative; width: 16mm; height: .25mm; display: block; background: #a4823f; }
  body.printing-transfer .transfer-print-arrow i::after { content: ""; position: absolute; right: 0; top: -1.4mm; width: 3mm; height: 3mm; border-top: .3mm solid #a4823f; border-right: .3mm solid #a4823f; transform: rotate(45deg); }
  body.printing-transfer .transfer-print-arrow b { color: #8d6b2d; font-size: 6pt; font-weight: 700; }
  body.printing-transfer .transfer-print-facts { margin: 2mm 0; display: grid; grid-template-columns: 29mm 29mm 29mm 1fr; border: .2mm solid #d0cbc0; }
  body.printing-transfer .transfer-print-facts > div { min-height: 8mm; padding: 1.4mm 2mm; display: flex; align-items: center; gap: 1.5mm; border-right: .2mm solid #d0cbc0; }
  body.printing-transfer .transfer-print-facts > div:last-child { border-right: 0; }
  body.printing-transfer .transfer-print-facts span { display: inline; color: #7c776e; font-size: 6.5pt; white-space: nowrap; }
  body.printing-transfer .transfer-print-facts strong { margin: 0; display: inline; font-size: 8pt; font-weight: 700; }
  body.printing-transfer .transfer-print-remark strong { overflow-wrap: anywhere; }
  body.printing-transfer table { width: 100%; border: .25mm solid #8c877e; border-collapse: collapse; table-layout: fixed; font-size: 8.3pt; }
  body.printing-transfer .transfer-col-code { width: 14%; }
  body.printing-transfer .transfer-col-name { width: 16%; }
  body.printing-transfer .transfer-col-category { width: 8%; }
  body.printing-transfer .transfer-col-certificate { width: 12%; }
  body.printing-transfer .transfer-col-model { width: 9%; }
  body.printing-transfer .transfer-col-quantity { width: 6%; }
  body.printing-transfer .transfer-col-weight { width: 7%; }
  body.printing-transfer .transfer-col-remark { width: 15%; }
  body.printing-transfer .transfer-col-price { width: 13%; }
  body.printing-transfer th, body.printing-transfer td { height: 9mm; padding: 1.5mm 1mm; overflow: hidden; border: .2mm solid #bbb5aa; text-align: left; vertical-align: middle; white-space: normal; overflow-wrap: anywhere; word-break: break-all; }
  body.printing-transfer th { height: 8mm; color: #1b1a17; background: transparent; border-top: .45mm solid #1b1a17; border-bottom: .35mm solid #1b1a17; font: 700 7.8pt/1.2 "Songti SC", SimSun, serif; }
  body.printing-transfer tbody tr { break-inside: avoid; page-break-inside: avoid; }
  body.printing-transfer tbody tr:nth-child(even) td { background: transparent; }
  body.printing-transfer th:nth-child(n+6), body.printing-transfer .transfer-print-number { text-align: right; font-variant-numeric: tabular-nums; }
  body.printing-transfer td:nth-child(6), body.printing-transfer td:nth-child(7), body.printing-transfer td:nth-child(9) { white-space: nowrap; }
  body.printing-transfer td:nth-child(8) { font-size: 7pt; line-height: 1.25; }
  body.printing-transfer .transfer-print-code { font-family: Consolas, monospace; font-size: 7.5pt; font-variant-numeric: tabular-nums; white-space: nowrap; }
  body.printing-transfer .transfer-print-totals { margin-top: 4mm; padding: 3.5mm 0; display: grid; grid-template-columns: 1fr 1fr 1.2fr 1.8fr; gap: 0; color: #1b1a17; background: transparent; border-top: .45mm solid #1b1a17; border-bottom: .25mm solid #8c877e; }
  body.printing-transfer .transfer-print-totals > div { padding: 0 4mm; display: flex; align-items: baseline; gap: 1.3mm; border-right: .2mm solid #c8c2b7; }
  body.printing-transfer .transfer-print-totals > div:first-child { padding-left: 1mm; }
  body.printing-transfer .transfer-print-totals > div:last-child { padding-right: 1mm; border-right: 0; }
  body.printing-transfer .transfer-print-totals span { margin-right: auto; color: #777168; font-size: 7pt; }
  body.printing-transfer .transfer-print-totals strong { font: 700 13pt/1 Georgia, serif; font-variant-numeric: tabular-nums; }
  body.printing-transfer .transfer-print-totals em { color: #777168; font-size: 7pt; font-style: normal; }
  body.printing-transfer .transfer-print-total-price { padding-left: 4mm; border-left: 0; }
  body.printing-transfer .transfer-print-total-price strong { color: #1b1a17; font-size: 14pt; }
  body.printing-transfer .transfer-print-approvals { margin-top: 10mm; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12mm; }
  body.printing-transfer .transfer-print-approvals > div { display: grid; grid-template-columns: auto 1fr; gap: 3mm; align-items: end; font-size: 9pt; font-weight: 700; }
  body.printing-transfer .transfer-print-approvals i { height: 5mm; display: block; border-bottom: .25mm solid #777168; }
  html:has(body.printing-warranty) { min-width: 0 !important; width: 100%; background: #fff; }
  body.printing-warranty { width: 100%; min-width: 0; margin: 0; color: #2f251f; background: #fff; }
  body.printing-warranty > *:not(#warrantyPrintSheet) { display: none !important; }
  body.printing-warranty #warrantyPrintSheet { display: block !important; width: 100%; margin: 0; background: #fff; }
  body.printing-warranty .warranty-print-page { page: warranty; width: 210mm; min-height: 297mm; max-width: 100%; margin: 0; padding: 9mm 15mm 12mm; box-sizing: border-box; font-family: "Microsoft YaHei", "PingFang SC", sans-serif; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  body.printing-warranty .warranty-print-head { position: relative; padding: 0 0 4.5mm; display: grid; justify-items: center; border-bottom: .45mm solid #555; text-align: center; }
  body.printing-warranty .warranty-print-brand { display: grid; justify-items: center; }
  body.printing-warranty .warranty-print-care { position: absolute; top: 1.5mm; left: 0; display: flex; align-items: center; gap: 1.5mm; text-align: left; }
  body.printing-warranty .warranty-print-care img { width: 22mm; height: 22mm; display: block; }
  body.printing-warranty .warranty-print-care p { margin: 0; color: #8b735d; font: 5.6pt/1.6 "PingFang SC", "Microsoft YaHei", sans-serif; }
  body.printing-warranty .warranty-print-care b { display: block; color: #2f251f; font-weight: 600; }
  body.printing-warranty .warranty-print-logo { position: absolute; top: .5mm; right: 0; width: 36mm; height: 3.2mm; display: block; object-fit: cover; object-position: center; }
  body.printing-warranty .warranty-print-brand h1 { margin: 0 0 1mm; font: 600 23pt/1.05 "Songti SC", SimSun, serif; letter-spacing: 6pt; }
  body.printing-warranty .warranty-print-brand p { margin: 0; color: #8b735d; font: 6.5pt/1.2 Georgia, serif; letter-spacing: 2pt; }
  body.printing-warranty .warranty-print-number { margin-top: 3mm; padding: 1.3mm 4mm; display: flex; align-items: baseline; gap: 4mm; background: #f6f6f5; border-radius: 8mm; }
  body.printing-warranty .warranty-print-number span { color: #9b7d5d; font: 6pt/1 Georgia, serif; letter-spacing: 1.2pt; }
  body.printing-warranty .warranty-print-number strong { font: 700 8.5pt/1.2 Consolas, monospace; font-variant-numeric: tabular-nums; }
  body.printing-warranty .warranty-print-message { margin: 4mm 0 0; text-align: center; }
  body.printing-warranty .warranty-print-message strong { font: 600 10.5pt/1.4 "Songti SC", SimSun, serif; letter-spacing: 1.5pt; }
  body.printing-warranty .warranty-print-message p { margin: 1.2mm 0 0; color: #7f6e61; font-size: 6.8pt; line-height: 1.6; }
  body.printing-warranty .warranty-print-details { margin: 4.5mm 0 5mm; display: grid; grid-template-columns: repeat(3, 1fr); background: #fbfbfa; border: .2mm solid #d5d5d2; }
  body.printing-warranty .warranty-print-details div { min-width: 0; padding: 3mm 4mm; display: grid; gap: 1.2mm; border-right: .2mm solid #ddddda; }
  body.printing-warranty .warranty-print-details div:nth-child(3n) { border-right: 0; }
  body.printing-warranty .warranty-print-details div:nth-child(-n+3) { border-bottom: .2mm solid #ddddda; }
  body.printing-warranty .warranty-print-details span { color: #9a8169; font-size: 6.3pt; letter-spacing: .25pt; }
  body.printing-warranty .warranty-print-details strong { overflow-wrap: anywhere; font-size: 9pt; }
  body.printing-warranty .warranty-print-items { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 7.5pt; }
  body.printing-warranty .warranty-print-items col:nth-child(1) { width: 6%; }
  body.printing-warranty .warranty-print-items col:nth-child(2) { width: 30%; }
  body.printing-warranty .warranty-print-items col:nth-child(3) { width: 12%; }
  body.printing-warranty .warranty-print-items col:nth-child(4) { width: 22%; }
  body.printing-warranty .warranty-print-items col:nth-child(5) { width: 8%; }
  body.printing-warranty .warranty-print-items col:nth-child(6) { width: 22%; }
  body.printing-warranty .warranty-print-items thead { display: table-header-group; }
  body.printing-warranty .warranty-print-items th { height: 8mm; padding: 1.4mm 1.5mm; color: #3f3f3d; background: #f3f3f1; border-top: .35mm solid #666; border-bottom: .25mm solid #888; font: 700 7pt/1.2 "Songti SC", SimSun, serif; text-align: left; }
  body.printing-warranty .warranty-print-items td { min-height: 12mm; padding: 2.5mm 1.5mm; border-bottom: .2mm solid #d6d6d3; vertical-align: top; overflow-wrap: anywhere; }
  body.printing-warranty .warranty-print-items tbody tr { break-inside: avoid; page-break-inside: avoid; }
  body.printing-warranty .warranty-print-items td:first-child { color: #a37a42; font: 700 8pt/1.3 Georgia, serif; }
  body.printing-warranty .warranty-print-items td:nth-last-child(-n+2), body.printing-warranty .warranty-print-items th:nth-last-child(-n+2) { text-align: right; font-variant-numeric: tabular-nums; }
  body.printing-warranty .warranty-print-items strong { display: block; font-size: 8pt; line-height: 1.35; }
  body.printing-warranty .warranty-print-items small { margin-top: .8mm; display: block; color: #777168; font-size: 6.5pt; line-height: 1.4; }
  body.printing-warranty .warranty-print-gifts { margin-top: 4mm; padding: 3mm 4mm 2.5mm; background: #faf8f4; border: .2mm solid #d8cbb8; break-inside: avoid; page-break-inside: avoid; }
  body.printing-warranty .warranty-print-gifts h2 { margin: 0 0 2mm; font: 700 9pt/1.2 "Songti SC", SimSun, serif; letter-spacing: 1pt; }
  body.printing-warranty .warranty-print-gifts h2 small { margin-left: 2mm; color: #a07d50; font: 6pt/1 Georgia, serif; letter-spacing: 1.2pt; }
  body.printing-warranty .warranty-print-gift-items { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 7.5pt; }
  body.printing-warranty .warranty-print-gift-items col:nth-child(1) { width: 6%; }
  body.printing-warranty .warranty-print-gift-items col:nth-child(2) { width: 54%; }
  body.printing-warranty .warranty-print-gift-items col:nth-child(3) { width: 12%; }
  body.printing-warranty .warranty-print-gift-items col:nth-child(4) { width: 28%; }
  body.printing-warranty .warranty-print-gift-items th { padding: 1.2mm 1.5mm; color: #6a5744; background: transparent; border-bottom: .2mm solid #d8cbb8; font: 700 6.5pt/1.2 "Songti SC", SimSun, serif; text-align: left; }
  body.printing-warranty .warranty-print-gift-items td { padding: 2mm 1.5mm; border-bottom: .15mm solid #eadfce; vertical-align: middle; }
  body.printing-warranty .warranty-print-gift-items tr:last-child td { border-bottom: 0; }
  body.printing-warranty .warranty-print-gift-items td:first-child { color: #a37a42; font: 700 8pt/1.3 Georgia, serif; }
  body.printing-warranty .warranty-print-gift-items td:nth-last-child(-n+2), body.printing-warranty .warranty-print-gift-items th:nth-last-child(-n+2) { text-align: right; font-variant-numeric: tabular-nums; }
  body.printing-warranty .warranty-print-gift-items strong { display: block; font-size: 8pt; line-height: 1.35; }
  body.printing-warranty .warranty-print-gift-items small { margin-top: .4mm; display: block; color: #777168; font-size: 6.5pt; }
  body.printing-warranty .warranty-print-gift-items td:last-child { color: #8a6a3d; font-weight: 700; }
  body.printing-warranty .warranty-print-settlement { margin-top: 4mm; padding: 3.5mm 0; display: grid; grid-template-columns: 1fr; color: #2f2f2d; background: #fff; border-top: .45mm solid #555; border-bottom: .2mm solid #aaa; }
  body.printing-warranty .warranty-print-settlement > div { padding: 0 4mm; display: grid; gap: 1.2mm; border-right: .2mm solid #d1d1ce; }
  body.printing-warranty .warranty-print-settlement > div:last-child { border-right: 0; text-align: right; }
  body.printing-warranty .warranty-print-settlement span { color: #777; font-size: 6.3pt; }
  body.printing-warranty .warranty-print-settlement strong { color: #222; font-size: 9pt; }
  body.printing-warranty .warranty-print-settlement > div:last-child strong { color: #222; font: 700 16pt/1.1 Georgia, serif; font-variant-numeric: tabular-nums; }
  body.printing-warranty .warranty-print-service { margin-top: 6mm; padding: 4.5mm 5mm; background: #fafafa; border-left: .6mm solid #999; break-inside: avoid; page-break-inside: avoid; }
  body.printing-warranty .warranty-print-service h2 { margin: 0 0 2.8mm; font: 700 10.5pt/1.2 "Songti SC", SimSun, serif; letter-spacing: 1pt; }
  body.printing-warranty .warranty-print-service h2 small { margin-left: 2mm; color: #a07d50; font: 6pt/1 Georgia, serif; letter-spacing: 1.2pt; }
  body.printing-warranty .warranty-print-service ol { margin: 0; padding-left: 5mm; display: grid; gap: 1.5mm; color: #55483e; font-size: 7.1pt; line-height: 1.6; }
  body.printing-warranty .warranty-print-signatures { margin-top: 10mm; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12mm; break-inside: avoid; page-break-inside: avoid; }
  body.printing-warranty .warranty-print-signatures div { display: grid; grid-template-columns: auto 1fr; gap: 3mm; align-items: end; font-size: 8pt; font-weight: 700; }
  body.printing-warranty .warranty-print-signatures i { height: 5mm; display: block; border-bottom: .25mm solid #8e7b6c; }
  body.printing-warranty .warranty-print-signatures > div { position: relative; }
  body.printing-warranty .warranty-print-stamp { padding-top: 34mm; }
  body.printing-warranty .warranty-print-seal { position: absolute; left: 50%; bottom: -2.5mm; width: 36mm; height: 36mm; transform: translateX(-50%); opacity: .95; }
  body.printing-warranty .warranty-print-footer { margin-top: 8mm; padding-top: 3mm; display: flex; justify-content: space-between; gap: 8mm; color: #927c68; border-top: .3mm solid #b89d76; font-size: 6pt; line-height: 1.5; }
  body:not(.printing-stocktake) #stocktakePrintSheet { display: none !important; }
  html:has(body.printing-stocktake) { min-width: 0 !important; width: 100%; background: #fff; }
  body.printing-stocktake { width: 100%; min-width: 0; margin: 0; background: #fff; }
  body.printing-stocktake > *:not(#stocktakePrintSheet) { display: none !important; }
  body.printing-stocktake #stocktakePrintSheet { display: block !important; width: 100%; margin: 0; color: #171714; background: #fff; }
  body.printing-stocktake .stocktake-print-page { page: stocktake; width: 100%; max-width: 100%; margin: 0; padding: 0; box-sizing: border-box; font-family: "Microsoft YaHei", "PingFang SC", sans-serif; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  body.printing-stocktake .stocktake-print-head { padding-bottom: 2.5mm; display: flex; align-items: baseline; justify-content: space-between; border-bottom: .4mm solid #1b1a17; }
  body.printing-stocktake .stocktake-print-head h1 { margin: 0; font: 700 18pt/1.1 "Songti SC", SimSun, serif; letter-spacing: 1.5pt; }
  body.printing-stocktake .stocktake-print-taskno { font: 700 11pt/1 Consolas, monospace; }
  body.printing-stocktake .stocktake-print-meta { margin: 2.5mm 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5mm 4mm; font-size: 7.5pt; border-bottom: .2mm solid #bbb; padding-bottom: 2mm; }
  body.printing-stocktake .stocktake-print-meta div { display: flex; gap: 1.5mm; }
  body.printing-stocktake .stocktake-print-meta span { color: #666; white-space: nowrap; }
  body.printing-stocktake .stocktake-print-meta strong { color: #111; font-weight: 700; word-break: break-all; }
  body.printing-stocktake .stocktake-print-section-title { margin: 3.5mm 0 1.5mm; font-size: 9pt; font-weight: 700; display: flex; justify-content: space-between; align-items: baseline; border-bottom: .25mm solid #1b1a17; padding-bottom: 1mm; }
  body.printing-stocktake .stocktake-print-section-title small { font-size: 7.5pt; font-weight: normal; color: #666; }
  body.printing-stocktake table { width: 100%; border: .25mm solid #8c877e; border-collapse: collapse; table-layout: fixed; font-size: 8pt; margin-bottom: 3mm; }
  body.printing-stocktake thead { display: table-header-group; }
  body.printing-stocktake th, body.printing-stocktake td { height: 7mm; padding: 1.2mm 1.5mm; overflow: hidden; border: .2mm solid #bbb5aa; text-align: left; vertical-align: middle; white-space: normal; overflow-wrap: anywhere; word-break: break-all; }
  body.printing-stocktake th { height: 6.5mm; color: #1b1a17; background: #f5f3ee; font-weight: 700; }
  body.printing-stocktake tbody tr { break-inside: avoid; page-break-inside: avoid; }
  body.printing-stocktake .num-right { text-align: right; font-variant-numeric: tabular-nums; }
  body.printing-stocktake .text-center { text-align: center; }
  body.printing-stocktake .code-cell { font-family: Consolas, monospace; font-size: 7.5pt; }
  body.printing-stocktake .print-checkbox { font-size: 9.5pt; display: inline-block; line-height: 1; }
  body.printing-stocktake .stocktake-print-signatures { margin-top: 6mm; display: grid; grid-template-columns: repeat(4, 1fr); gap: 5mm; break-inside: avoid; page-break-inside: avoid; }
  body.printing-stocktake .stocktake-print-sign-box { border-top: .3mm solid #333; padding-top: 2mm; font-size: 8pt; display: grid; gap: 4mm; }
  body.printing-stocktake .stocktake-print-sign-box div { display: flex; justify-content: space-between; }
  body.printing-stocktake .stocktake-print-sign-box span { color: #444; }
  body.printing-stocktake .stocktake-full-category-block { margin-bottom: 3.5mm; break-inside: auto; }
  body.printing-stocktake .stocktake-full-category-title { font-size: 9pt; font-weight: 700; margin: 2mm 0 1mm; padding: 1mm 2mm; background: #eae7df; display: flex; justify-content: space-between; break-after: avoid; }
  body.printing-stocktake .stocktake-full-table { font-size: 8.5pt; }
  body.printing-stocktake .stocktake-full-table td { height: 6.2mm; padding: 1mm 1.5mm; }
  body:not(.printing-labels) #labelPrintSheet { display: none !important; }
  body.printing-labels > *:not(#labelPrintSheet) { display: none !important; }
  body.printing-labels #labelPrintSheet { display: block !important; margin: 0; padding: 0; background: #fff; }
  body.printing-labels .print-label-page { page: label; width: 30mm; height: 47mm; margin: 0; padding: 0; overflow: hidden; break-after: page; page-break-after: always; }
  body.printing-labels .print-label-page:last-child { break-after: auto; page-break-after: auto; }
  body.printing-labels .print-label-page svg { width: 30mm; height: 47mm; display: block; }
  body.printing-inventory { background: #fff; }
  body.printing-inventory .sidebar,
  body.printing-inventory .topbar,
  body.printing-inventory .inventory-page-head,
  body.printing-inventory .inventory-live-strip,
  body.printing-inventory .inventory-kpis,
  body.printing-inventory .inventory-commandbar,
  body.printing-inventory .inventory-toolbar,
  body.printing-inventory .advanced-inventory,
  body.printing-inventory .inventory-summary,
  body.printing-inventory .inventory-subtotals,
  body.printing-inventory .inventory-table-foot,
  body.printing-inventory .toast { display: none !important; }
  body.printing-inventory .workspace { margin: 0; }
  body.printing-inventory .view[data-view-panel="inventory"] { padding: 0; }
  body.printing-inventory .inventory-table-panel { margin: 0; border: 0; box-shadow: none; }
  body.printing-inventory .inventory-table-wrap { max-height: none; overflow: visible; border: 0; }
  body.printing-inventory .inventory-detail-table { min-width: 0; font-size: 7px; }
  body.printing-inventory .inventory-detail-table th,
  body.printing-inventory .inventory-detail-table td { padding: 5px 6px; height: auto; }
  body.printing-inventory [data-column="select"] { display: none !important; }

  body.printing-sales-items { background: #fff; }
  body.printing-sales-items .sidebar,
  body.printing-sales-items .topbar,
  body.printing-sales-items .sales-items-page-head,
  body.printing-sales-items .sales-items-toolbar,
  body.printing-sales-items .entity-pagination,
  body.printing-sales-items .toast { display: none !important; }
  body.printing-sales-items .workspace { margin: 0; }
  body.printing-sales-items .view { display: none !important; }
  body.printing-sales-items .view[data-view-panel="sales-items"] { display: block !important; padding: 0; }
  body.printing-sales-items .sales-items-print-heading { margin-bottom: 8px; display: flex; justify-content: space-between; align-items: end; }
  body.printing-sales-items .sales-items-print-heading strong { font: 600 18px/1.2 "Songti SC", STSong, serif; }
  body.printing-sales-items .sales-items-print-heading span { color: #666; font-size: 7px; }
  body.printing-sales-items .sales-items-quality { margin: 0 0 8px; padding: 7px; }
  body.printing-sales-items .sales-item-kpis { margin: 0 0 8px; }
  body.printing-sales-items .sales-item-kpis .metric-card { min-height: 0; padding: 7px; box-shadow: none; }
  body.printing-sales-items .sales-item-kpis .metric-card > strong { margin-top: 4px; font-size: 12px; }
  body.printing-sales-items .sales-item-kpis .metric-card p { display: none; }
  body.printing-sales-items .sales-items-panel { border: 0; box-shadow: none; }
  body.printing-sales-items .sales-items-table-wrap { min-height: 0; max-height: none; overflow: visible; }
  body.printing-sales-items .sales-items-table { min-width: 0; width: 100%; table-layout: fixed; font-size: 6px; }
  body.printing-sales-items .sales-items-table th,
  body.printing-sales-items .sales-items-table td { min-width: 0; height: auto; padding: 3px 2px; white-space: normal; overflow-wrap: anywhere; }
  body.printing-sales-items .sales-items-table td strong { font-size: 6px; }
  body.printing-sales-items .sales-items-table td small,
  body.printing-sales-items .line-match { font-size: 5px; }

  html:has(body.printing-report) { min-width: 0 !important; width: 100%; background: #fff; }
  body.printing-report { width: 100%; min-width: 0; margin: 0; background: #fff; }
  body.printing-report .app-shell { width: 100%; min-width: 0; min-height: 0; display: block; }
  body.printing-report .sidebar,
  body.printing-report .topbar,
  body.printing-report .page-actions,
  body.printing-report .report-filterbar,
  body.printing-report .payment-report-filters,
  body.printing-report .flow-statistics-picker,
  body.printing-report .toast { display: none !important; }
  body.printing-report .workspace { width: 100%; min-width: 0; margin: 0; display: block; }
  body.printing-report .view { display: none !important; }
  body.printing-report .view[data-view-panel="reports"] { page: report; width: 100%; min-width: 0; display: block !important; padding: 0; }
  body.printing-report .report-workspace { width: 100%; min-width: 0; overflow: visible; border: 0; box-shadow: none; }
  body.printing-report .report-panel { display: none !important; padding: 0; }
  body.printing-report .report-panel.is-active { display: block !important; }
  body.printing-report.printing-report-total .report-panel[data-report-panel="summary"],
  body.printing-report.printing-report-total .report-panel[data-report-panel="flow"] { display: block !important; }
  body.printing-report.printing-report-total .report-panel[data-report-panel="flow"] {
    break-before: auto;
    page-break-before: auto;
    break-inside: avoid;
    page-break-inside: avoid;
    margin-top: 18px;
  }
  body.printing-report.printing-report-total .report-panel[data-report-panel="flow"] .report-title {
    break-after: avoid;
    page-break-after: avoid;
  }
  body.printing-report .report-integrity { margin: 0 0 16px; }
  body.printing-report .report-kpi-strip { display: none; }
  body.printing-report .report-table-wrap,
  body.printing-report .report-inbound-wrap,
  body.printing-report .report-flow-wrap,
  body.printing-report .payment-report-wrap { max-height: none; overflow: visible; }
  body.printing-report .report-title { display: block; padding: 0 0 14px; text-align: center; }
  body.printing-report .report-title h3 { margin: 0 0 8px; font: 700 20px/1.2 "Songti SC", STSong, serif; }
  body.printing-report .report-title .section-kicker { display: none; }
  body.printing-report .report-title p { color: #444; font-size: 10px; }
  body.printing-report .report-section { margin-top: 16px; break-inside: auto; }
  body.printing-report .report-section > h4 {
    margin-bottom: 8px;
    padding: 3px 8px 4px;
    font: 700 12px/1.3 "Songti SC", STSong, serif;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  body.printing-report .report-section h4 small { display: none; }
  body.printing-report table { width: 100%; font-size: 9px; line-height: 1.35; }
  body.printing-report table,
  body.printing-report th,
  body.printing-report td { border-color: #777; }
  body.printing-report .report-orders-container { gap: 8px; margin-top: 6px; }
  body.printing-report .report-order-card {
    margin-top: 6px;
    margin-bottom: 8px;
    border: 1px solid #777 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  body.printing-report .report-order-card-header {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: baseline;
    gap: 4px 8px;
    background: transparent !important;
    border-bottom: 1px solid #777 !important;
    padding: 3px 6px !important;
    font-size: 8px !important;
    color: #000 !important;
  }
  body.printing-report .report-card-badge {
    padding: 1px 4px !important;
    font-size: 8px !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  body.printing-report .report-card-no { font-size: 10px !important; color: #000 !important; }
  body.printing-report .report-card-meta { flex-wrap: nowrap; gap: 1px 10px; font-size: 8px !important; }
  body.printing-report .report-card-meta-item small { color: #444 !important; font-size: 7px !important; }
  body.printing-report .report-card-meta-item strong { color: #000 !important; }
  body.printing-report .report-card-meta-item.report-card-note strong { color: #333 !important; font-weight: 400; }
  body.printing-report .report-sale-card .report-order-card-header {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    flex-wrap: unset !important;
  }
  body.printing-report .report-sale-card .report-card-identity { grid-column: 1; grid-row: 1; }
  body.printing-report .report-sale-card .report-card-metrics { grid-column: 2; grid-row: 1; margin-left: 0; }
  body.printing-report .report-sale-card .report-card-meta { grid-column: 1 / -1; grid-row: 2; flex-wrap: wrap; }
  body.printing-report .report-sales-total-bar {
    background: #fff !important;
    border: 1px solid #777 !important;
    border-radius: 0 !important;
    padding: 4px 8px !important;
    font-size: 8px !important;
  }
  body.printing-report .report-sales-line-table { border-color: #777; font-size: 8px; }
  body.printing-report .report-sales-line-table th,
  body.printing-report .report-sales-line-table td { height: auto; padding: 3px 4px; background: #fff; }
  body.printing-report .report-sales-line-table thead { display: table-header-group; }
  body.printing-report .report-sales-line-table tbody tr { break-inside: avoid; page-break-inside: avoid; }
  body.printing-report .report-flow-wrap { max-height: none; overflow: visible; }
  body.printing-report .report-flow-wrap table { min-width: 0 !important; width: 100%; table-layout: fixed; font-size: 7px; line-height: 1.2; border-collapse: collapse; }
  body.printing-report .report-flow-wrap thead { display: table-header-group; }
  body.printing-report .report-flow-wrap th,
  body.printing-report .report-flow-wrap td { height: auto; padding: 2px 1px; text-align: center; vertical-align: middle; white-space: normal; overflow-wrap: break-word; word-break: normal; }
  body.printing-report .report-flow-wrap th:first-child,
  body.printing-report .report-flow-wrap td:first-child { width: 13%; position: static !important; text-align: left; font-weight: 600; padding-left: 3px; }
  body.printing-report .report-flow-wrap thead tr:first-child th { background: #eae4d7 !important; color: #282721 !important; font-size: 7px; border-right: 1px solid #bbb5aa; }
  body.printing-report .report-flow-wrap thead tr:nth-child(2) th { background: #f5f1e8 !important; font-size: 6.5px; }
  body.printing-report .report-flow-wrap tbody tr { break-inside: avoid; page-break-inside: avoid; }
  body.printing-report .report-flow-wrap .report-flow-total td { font-weight: 700; background: #eeeae1 !important; border-top: 1.5px solid #282721; }
  body.printing-report .report-flow-wrap .report-value-missing { color: #bbb; }
  body.printing-report .report-flow-wrap { break-inside: avoid; page-break-inside: avoid; }
  body.printing-report .flow-cell-increase { color: #c0392b !important; font-weight: 700; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.printing-report .flow-cell-decrease { color: #278a5b !important; font-weight: 700; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.printing-report .report-stock-comparison-table td.stock-count-value { color: #c0392b !important; font-weight: 700; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.printing-report .report-note { font-size: 7px; color: #666; margin-top: 6px; line-height: 1.4; }
  body.printing-report .report-integrity { margin: 0 0 8px; padding: 4px 6px; font-size: 7px; line-height: 1.4; }
  body.printing-report th,
  body.printing-report td { height: auto; padding: 7px 6px; white-space: normal; overflow-wrap: break-word; word-break: normal; }
}
.inventory-picker-input { display: flex; align-items: stretch; gap: 6px; }
.inventory-picker-input input { min-width: 0; flex: 1; }
.inventory-picker-button { min-width: 44px; border: 1px solid #c9a85c; background: #f5edda; color: #8b681f; border-radius: 6px; padding: 0 10px; font-weight: 800; letter-spacing: 2px; cursor: pointer; }
.inventory-picker-button:hover { border-color: #9d7732; background: #efe1bd; }
.inventory-picker-button:disabled { color: #aaa49a; background: #ece8df; border-color: #d9d3c8; cursor: not-allowed; }
.sale-scan-row label, .transfer-scan-row label { display: flex; gap: 6px; }
.sale-scan-row label input, .transfer-scan-row label input { min-width: 0; flex: 1; }
.sale-scan-row label .inventory-picker-button, .transfer-scan-row label .inventory-picker-button { height: 42px; flex: 0 0 46px; }

.inventory-picker-dialog { width: min(1320px, 95vw); height: min(830px, 92vh); max-height: 92vh; }
.inventory-picker-dialog[open] { display: flex; flex-direction: column; }
.inventory-picker-dialog .record-dialog-head { min-height: 88px; padding: 18px 24px; flex: 0 0 auto; }
.inventory-picker-dialog .record-dialog-head h2 { margin-top: 5px; }
.inventory-picker-filters { padding: 14px 22px; display: grid; grid-template-columns: minmax(150px, 1.25fr) minmax(150px, 1.25fr) repeat(4, minmax(105px, .75fr)) auto; gap: 10px; align-items: end; background: #f4f1ea; border-bottom: 1px solid #dcd5c8; }
.inventory-picker-filters label { display: grid; gap: 5px; }
.inventory-picker-filters label span { color: #6f6a61; font-size: 9px; font-weight: 700; }
.inventory-picker-filters input { height: 36px; background: #fff; }
.inventory-picker-filter-actions { display: flex; gap: 7px; }
.inventory-picker-filter-actions .button { height: 36px; padding: 0 16px; }
.inventory-picker-workspace { min-height: 0; flex: 1 1 auto; display: grid; grid-template-columns: 205px minmax(0, 1fr); background: #fbfaf6; }
.inventory-picker-categories { min-height: 0; padding: 14px 10px 18px; overflow: auto; background: #f2efe7; border-right: 1px solid #d8d1c4; }
.inventory-picker-categories > strong { display: block; padding: 0 9px 10px; color: #6b675f; font: 700 11px/1.2 "Songti SC", STSong, serif; letter-spacing: 1px; }
.inventory-picker-categories > div { display: grid; gap: 3px; }
.inventory-picker-categories button { width: 100%; min-height: 34px; padding: 7px 9px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #625e56; background: transparent; border: 1px solid transparent; border-radius: 5px; text-align: left; cursor: pointer; }
.inventory-picker-categories button:hover { background: #fffaf0; border-color: #dfd3ba; }
.inventory-picker-categories button.is-active { color: #6f5118; background: #fff8e8; border-color: #cdaa60; font-weight: 700; }
.inventory-picker-categories button em { color: #9b9488; font-size: 8px; font-style: normal; }
.inventory-picker-results { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.inventory-picker-table-wrap { min-height: 0; flex: 1 1 auto; overflow: auto; }
.inventory-picker-table-wrap table { min-width: 980px; }
.inventory-picker-table-wrap thead { position: sticky; top: 0; z-index: 2; }
.inventory-picker-table-wrap th { height: 36px; padding: 8px 10px; background: #ece8df; border-bottom-color: #d2cabd; white-space: nowrap; }
.inventory-picker-table-wrap td { height: 35px; padding: 7px 10px; }
.inventory-picker-table-wrap tbody tr { cursor: pointer; }
.inventory-picker-table-wrap tbody { user-select: none; }
.inventory-picker-table-wrap tbody tr:hover td { background: #faf3df; }
.inventory-picker-table-wrap tbody tr.is-selected td { background: #ead29a; border-bottom-color: #d2ad59; }
.inventory-picker-table-wrap tbody tr.is-selected td:first-child { box-shadow: inset 3px 0 #9d7427; }
.inventory-picker-table-wrap tbody input[type="checkbox"] { width: 14px; height: 14px; margin: 0 5px 0 0; vertical-align: -2px; accent-color: #a47a2d; pointer-events: none; }
.inventory-picker-table-wrap td:nth-child(1), .inventory-picker-table-wrap td:nth-child(4), .inventory-picker-table-wrap td:nth-child(8) { text-align: right; white-space: nowrap; }
.inventory-picker-table-wrap td:nth-child(2) { font-family: ui-monospace, Consolas, monospace; white-space: nowrap; }
.inventory-picker-pager { min-height: 48px; padding: 8px 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; color: #777168; background: #f0ede6; border-top: 1px solid #d8d1c5; font-size: 9px; }
.inventory-picker-pager > div { display: flex; align-items: center; gap: 5px; }
.inventory-picker-pager button { width: 30px; height: 28px; color: #6f5a2c; background: #fff; border: 1px solid #d3c9b6; border-radius: 4px; cursor: pointer; }
.inventory-picker-pager button:disabled { color: #bbb5aa; background: #e8e4dc; cursor: default; }
.inventory-picker-pager strong { min-width: 88px; text-align: center; }
.inventory-picker-actions { min-height: 62px; padding: 10px 22px; flex: 0 0 auto; }
.inventory-picker-actions .button { min-width: 92px; }
.inventory-picker-actions .inventory-picker-batch-action { min-width: 78px; }

@media (max-width: 1000px) {
  .inventory-picker-filters { grid-template-columns: repeat(3, 1fr); }
  .inventory-picker-workspace { grid-template-columns: 165px minmax(0, 1fr); }
  .sale-scan-row label .inventory-picker-button, .transfer-scan-row label .inventory-picker-button { height: 38px; }
}

/* ���῭��ʷ�����������ϸ / ������ʷ / �˳��˻� / ��Ա������ϸ�� */
.archive-detail-dialog .order-summary-grid { margin-bottom: 12px; }
.archive-detail-dialog .order-summary-grid > div > small { color: #77746c; }
.reconciliation-filters { grid-template-columns: repeat(5, minmax(150px, 1fr)); }
.gross-profit-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 14px; padding: 12px; background: #faf9f6; }
.gross-profit-filters > label { width: 150px; max-width: 100%; }
.gross-profit-filters select { width: 100%; min-width: 0; height: 34px; padding: 0 9px; }
.gross-profit-filters .button { height: 34px; min-width: 88px; padding: 0 18px; box-shadow: none; }
.gross-profit-grouping { margin: 0; padding: 0; border: 0; display: flex; gap: 12px; align-self: center; }
.gross-profit-grouping legend { margin-bottom: 9px; font-size: 11px; color: #77746c; }
.gross-profit-grouping label { display: flex; align-items: center; gap: 5px; font-size: 12px; white-space: nowrap; }
.gross-profit-grouping input { width: 15px; height: 15px; min-width: 0; margin: 0; accent-color: #b3934a; }
[data-view-panel="reports"]:has([data-report-panel="gross-profit"].is-active) #runReportQuery { display: none; }
[data-report-panel="gross-profit"] .report-kpi-strip { background: #faf8f2; border: 1px solid #e8e2d5; color: #504b40; }
[data-report-panel="gross-profit"] .report-kpi-strip span { padding: 10px 14px; border-right-color: #e8e2d5; }
[data-report-panel="gross-profit"] .report-kpi-strip strong { color: #7a602b; font: 600 16px/1.3 system-ui, sans-serif; }
[data-report-panel="gross-profit"] .report-kpi-strip small { color: #817a6c; font-size: 11px; }
[data-report-panel="gross-profit"] .gross-profit-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.gross-profit-table-wrap { margin: 12px 0; max-height: 65vh; overflow: auto; }
.gross-profit-table-wrap table { width: 100%; min-width: 0; table-layout: fixed; }
.gross-profit-table-wrap th { position: sticky; top: 0; z-index: 1; background: #f2eee4; color: #6d624d; font-size: 11px; white-space: normal; }
.gross-profit-table-wrap th[data-sort-key] { cursor: pointer; user-select: none; transition: background .15s ease, color .15s ease; }
.gross-profit-table-wrap th[data-sort-key]:hover { background: #eae3d5; }
.gross-profit-table-wrap th[data-sort-key] .sort-icon { display: inline-block; margin-left: 4px; font-size: 10px; color: #b0a797; vertical-align: baseline; }
.gross-profit-table-wrap th[data-sort-key].is-sort-active { color: #1e1b15; background: #e6dfd0; }
.gross-profit-table-wrap th[data-sort-key].is-sort-active .sort-icon { color: #8d6b2d; font-weight: 700; }
.gross-profit-table-wrap td { font-size: 12px; white-space: normal; overflow-wrap: anywhere; vertical-align: middle; }
.gross-profit-table-wrap th, .gross-profit-table-wrap td { padding: 9px 10px; }
.gross-profit-table-wrap th:nth-child(n+4), .gross-profit-table-wrap td:nth-child(n+4) { text-align: right; font-variant-numeric: tabular-nums; }
.gross-profit-table-wrap td small { display: block; margin-top: 4px; color: #928b7f; font-size: 10px; }
.gross-profit-table-wrap .text-button { padding: 0; text-align: left; white-space: normal; font-size: inherit; }
.gross-profit-table-wrap tbody tr:nth-child(even) { background: #fcfbf8; }
.gross-profit-table-wrap .gross-profit-summary-row { cursor: pointer; }
.gross-profit-table-wrap .gross-profit-summary-row:hover,
.gross-profit-table-wrap .gross-profit-summary-row:has([aria-expanded="true"]) { background: #f4f0e7; }
.gross-profit-table-wrap .gross-profit-detail-row { background: #fffefa; }
.gross-profit-table-wrap .gross-profit-detail-row td:first-child { padding-left: 24px; border-left: 2px solid #d8c89f; }
.gross-profit-table-wrap .gross-profit-detail-status { background: #f8f6f0; color: #82755d; }
.gross-profit-table-wrap .gross-profit-detail-status td { font-size: 11px; }
.gross-profit-explanation { margin-top: 12px; color: #938b7b; font-size: 11px; }
.gross-profit-explanation summary { cursor: pointer; }
@media print {
  .gross-profit-filters, #grossProfitPager { display: none !important; }
  .gross-profit-table-wrap { max-height: none; overflow: visible; }
  .gross-profit-table-wrap tr { break-inside: avoid; }
}
.report-note { margin: 10px 0 0; color: #827d72; font-size: 10px; line-height: 1.7; }
.recon-missing-list { margin: 10px 0 0; padding: 12px 12px 12px 30px; background: #f3efe7; border: 1px dashed #d8cdb8; border-radius: 5px; color: #6e5b35; font-size: 10px; line-height: 1.9; }
.recon-missing-list li::marker { color: #bea05e; }
.gross-profit-kpis span, .reconciliation-kpis span { min-width: 0; }

.dialog-drag-handle { cursor: move; touch-action: none; user-select: none; }
.is-dragging .dialog-drag-handle { cursor: grabbing; }
dialog.is-positioned[open] { position: fixed; inset: auto; left: var(--dialog-left); top: var(--dialog-top); width: min(var(--dialog-width), calc(100vw - 16px)); margin: 0; }

.permission-gate { min-height: 300px; margin: 24px; padding: 70px 30px; color: #575148; background: #fbfaf6; border: 1px solid #ddd6c9; border-radius: 8px; text-align: center; }
.permission-gate h2 { margin: 12px 0 8px; color: #28261f; font: 600 25px/1.2 Georgia, "Songti SC", serif; }
.permission-gate p { margin: 0 auto; max-width: 520px; color: #827a6e; font-size: 11px; line-height: 1.8; }
.permission-layout { display: grid; grid-template-columns: minmax(220px, .7fr) minmax(0, 1.7fr); gap: 16px; align-items: start; }
.permission-panel-heading { min-height: 58px; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #e8e2d8; }
.permission-panel-heading h3 { margin: 5px 0 0; color: #29271f; font: 600 19px/1.1 Georgia, "Songti SC", serif; }
.permission-role-list { padding: 10px; display: grid; gap: 7px; }
.permission-role-card { padding: 13px 14px; display: grid; gap: 5px; color: #625d54; background: #fff; border: 1px solid transparent; border-radius: 6px; text-align: left; cursor: pointer; }
.permission-role-card:hover { background: #fffaf0; border-color: #dfd1b3; }
.permission-role-card.is-selected { background: #fff8e7; border-color: #c5a35d; box-shadow: inset 3px 0 #a47a2d; }
.permission-role-card strong { color: #342d20; font-size: 13px; }
.permission-role-card span { overflow: hidden; color: #82796b; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.permission-role-card small { color: #a08e6d; font-size: 9px; }
.permission-editor-panel { min-width: 0; }
.permission-editor-panel > .data-empty { margin: 18px; }
.permission-editor-panel form { padding: 18px; }
.permission-role-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 19px; }
.permission-section { padding-top: 17px; margin-top: 17px; border-top: 1px solid #ebe6dc; }
.permission-section-title { margin-bottom: 11px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.permission-section-title h4 { margin: 0; color: #38342c; font-size: 12px; }
.permission-section-title span { color: #9b9284; font-size: 9px; }
.permission-checkbox-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
.permission-checkbox-group { min-width: 0; padding: 10px; background: #f7f4ee; border: 1px solid #e7e0d3; border-radius: 5px; }
.permission-checkbox-group h5 { margin: 0 0 8px; color: #86672f; font-size: 10px; }
.permission-checkbox-group.is-sensitive { grid-column: 1 / -1; padding: 13px 15px; background: #fff7dd; border-color: #c9a44f; box-shadow: inset 3px 0 #a47a2d; }
.permission-checkbox-group.is-sensitive h5 { color: #6f4b08; font-size: 11px; }
.permission-checkbox-group.is-sensitive label { display: inline-flex; width: calc(25% - 4px); vertical-align: top; }
.permission-checkbox-grid > label, .permission-checkbox-group label, .permission-binding-list label { min-width: 0; padding: 5px 0; display: flex; align-items: flex-start; gap: 7px; color: #5c574f; font-size: 10px; line-height: 1.4; cursor: pointer; }
.permission-checkbox-grid > label { padding: 11px 12px; background: #f7f4ee; border: 1px solid #e7e0d3; border-radius: 5px; }
.permission-checkbox-grid > label > span, .permission-checkbox-group label > span, .permission-binding-list label > span { min-width: 0; flex: 1; }
.permission-checkbox-grid input[type="checkbox"], .permission-checkbox-group input[type="checkbox"], .permission-binding-list input[type="checkbox"] { flex: 0 0 16px; width: 16px; min-width: 16px; height: 16px; margin: 1px 0 0; padding: 0; accent-color: #a47a2d; }
.permission-binding-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 18px; max-height: 230px; overflow: auto; padding: 10px 12px; background: #f7f4ee; border: 1px solid #e7e0d3; border-radius: 5px; }
.permission-binding-list label { padding: 7px 0; }
.permission-binding-list label > span { display: grid; gap: 2px; }
.permission-binding-list strong { overflow: hidden; color: #4d493f; font-size: 10px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.permission-binding-list small { overflow: hidden; color: #928879; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.permission-empty-note { padding: 8px; color: #928879; font-size: 10px; }
.permission-editor-actions { min-height: 58px; padding: 14px 0 0; margin-top: 20px; border-top: 1px solid #ebe6dc; }
.permission-editor-actions > span { margin-right: auto; color: #8a8174; font-size: 9px; }

/* Shared date range: one calm entry, details on hover or click. */
.history-date-range { position: relative; min-width: 0; align-self: end; z-index: 16; }
.entity-toolbar > .history-date-range,
.report-filterbar > .history-date-range,
.payment-report-filters > .history-date-range { grid-column: span 2; }
.transfer-management-toolbar { padding: 16px 20px 18px; display: grid; grid-template-columns: 1fr; gap: 15px; }
.transfer-filter-primary { display: grid; grid-template-columns: 420px 390px 120px 72px; gap: 14px; align-items: end; justify-content: start; }
.transfer-filter-primary > .history-date-range { grid-column: auto; }
.transfer-filter-primary > #resetTransferFilters { width: 72px; }
.transfer-filter-route { padding-top: 14px; display: grid; grid-template-columns: 125px 280px 30px 280px 160px; gap: 14px; align-items: end; justify-content: start; border-top: 1px solid #dfd8cc; }
.transfer-filter-route-title { height: 39px; display: grid; align-content: center; gap: 3px; }
.transfer-filter-route-title strong { color: #4d4941; font-size: 10px; }
.transfer-filter-route-title span { color: #999185; font-size: 8px; }
.transfer-filter-route-arrow { height: 39px; display: grid; place-items: center; color: #a37d36; font: 700 18px/1 Georgia, serif; }
.history-date-range summary { height: 42px; padding: 0 13px; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; color: #36342e; background: #fbfaf6; border: 1px solid #ded9cf; border-radius: 5px; outline: none; cursor: pointer; list-style: none; }
.history-date-range summary::-webkit-details-marker { display: none; }
.history-date-range summary > span { display: grid; gap: 2px; color: #77746c; font-size: 8px; font-weight: 750; white-space: nowrap; }
.history-date-range summary small { color: #9b7735; font-size: 9px; font-weight: 750; }
.history-date-range summary strong { overflow: hidden; font-size: 11px; font-weight: 650; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.history-date-range summary i { color: #9b7735; font-size: 15px; font-style: normal; transition: transform .16s ease; }
.history-date-range[open],
.history-date-range.is-open { z-index: 120; }
.history-date-range[open] summary,
.history-date-range.is-open summary { border-color: #b9964d; box-shadow: 0 0 0 3px rgba(185,150,77,.11); }
.history-date-range[open] summary i,
.history-date-range.is-open summary i { transform: rotate(180deg); }
.history-date-popover { position: absolute; z-index: 200; top: calc(100% + 8px); left: 0; width: min(420px, calc(100vw - 48px)); padding: 17px; background: #fffdfa; border: 1px solid #ddd5c6; border-radius: 10px; box-shadow: 0 20px 48px rgba(38,34,26,.24); }
.history-date-popover.align-right { left: auto; right: 0; }
.history-date-popover.drop-up { top: auto; bottom: calc(100% + 8px); box-shadow: 0 -20px 48px rgba(38,34,26,.24); }
.history-date-presets { padding-bottom: 14px; margin-bottom: 14px; display: grid; grid-template-columns: 1fr repeat(5, auto); gap: 7px; align-items: center; border-bottom: 1px solid #eee7da; }
.history-date-presets > span { color: #777168; font-size: 9px; font-weight: 750; }
.history-date-presets button { height: 31px; padding: 0 12px; color: #6f685c; background: #f4f0e8; border: 1px solid #e2dacb; border-radius: 16px; font-size: 9px; font-weight: 700; cursor: pointer; }
.history-date-presets button:hover,
.history-date-presets button.is-active { color: #fff; background: #a98239; border-color: #a98239; }
.history-date-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.history-date-fields label { display: grid; gap: 7px; }
.history-date-fields label > span { color: #666159; font-size: 9px; font-weight: 750; }
.history-date-fields input { height: 40px !important; font-size: 11px !important; }
.entity-panel:has(.history-date-range[open]),
.sales-items-panel:has(.history-date-range[open]),
.report-workspace:has(.history-date-range[open]),
.operation-log-panel:has(.history-date-range[open]),
.entity-panel.has-open-date-range,
.sales-items-panel.has-open-date-range,
.report-workspace.has-open-date-range,
.operation-log-panel.has-open-date-range { overflow: visible !important; z-index: 40; }
.entity-toolbar:has(.history-date-range[open]),
.sales-items-toolbar:has(.history-date-range[open]),
.report-filterbar:has(.history-date-range[open]),
.transfer-management-toolbar:has(.history-date-range[open]),
.transfer-filter-primary:has(.history-date-range[open]),
.payment-report-filters:has(.history-date-range[open]),
.entity-toolbar.has-open-date-range,
.sales-items-toolbar.has-open-date-range,
.report-filterbar.has-open-date-range,
.transfer-management-toolbar.has-open-date-range,
.transfer-filter-primary.has-open-date-range,
.payment-report-filters.has-open-date-range { position: relative !important; z-index: 100 !important; overflow: visible !important; }
.report-filterbar:has(> .history-date-range) { grid-template-columns: 420px 220px 160px; justify-content: start; }
.report-filterbar:has(> .history-date-range) > .history-date-range { grid-column: auto; }

@media (max-width: 1200px) {
  .transfer-filter-primary { grid-template-columns: 1fr 1fr; }
  .transfer-filter-primary > #resetTransferFilters { width: 100%; }
  .transfer-filter-route { grid-template-columns: 1fr 30px 1fr; }
  .transfer-filter-route-title,
  .transfer-filter-route > label:last-child { grid-column: 1 / -1; }
  .transfer-filter-route-title { height: auto; }
  .report-filterbar:has(> .history-date-range) { grid-template-columns: 1fr 1fr; }
  .report-filterbar:has(> .history-date-range) > .history-date-range { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .entity-toolbar > .history-date-range,
  .report-filterbar > .history-date-range,
  .payment-report-filters > .history-date-range { grid-column: 1 / -1; }
  .history-date-popover { position: fixed; top: 50%; left: 50%; width: min(420px, calc(100vw - 28px)); transform: translate(-50%, -50%); }
  .history-date-presets { grid-template-columns: repeat(5, 1fr); }
  .history-date-presets > span { grid-column: 1 / -1; }
  .transfer-filter-primary,
  .transfer-filter-route { grid-template-columns: 1fr; }
  .transfer-filter-primary > .history-date-range,
  .transfer-filter-route-title,
  .transfer-filter-route > label:last-child { grid-column: auto; }
  .transfer-filter-route-arrow { height: 20px; transform: rotate(90deg); }
  .report-filterbar:has(> .history-date-range) { grid-template-columns: 1fr; }
}

@media (max-width: 850px) {
  .permission-layout { grid-template-columns: 1fr; }
  .permission-checkbox-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .permission-checkbox-group.is-sensitive label { width: calc(50% - 4px); }
}

@media (max-width: 560px) {
  .permission-role-fields, .permission-checkbox-grid, .permission-binding-list { grid-template-columns: 1fr; }
  .permission-checkbox-group.is-sensitive label { width: 100%; }
  .permission-section-title { display: grid; gap: 5px; }
}

/* 管理员只读操作日志。 */
.operation-log-page-head { margin-bottom: 14px; }
.operation-log-panel { overflow: hidden; }
.operation-log-filters { padding: 18px 20px; display: grid; grid-template-columns: minmax(260px,1.7fr) repeat(6,minmax(120px,.7fr)) auto auto; gap: 11px; align-items: end; border-bottom: 1px solid #e6dfd4; }
.operation-log-filters label { min-width: 0; display: grid; gap: 6px; }
.operation-log-filters label > span { color: #6e685e; font-size: 9px; font-weight: 750; }
.operation-log-filters input, .operation-log-filters select { width: 100%; background: #fff; }
.operation-log-filters .button { height: 42px; white-space: nowrap; }
.operation-log-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); background: #ddd6ca; border-bottom: 1px solid #ddd6ca; gap: 1px; }
.operation-log-summary > span { min-height: 58px; padding: 10px 16px; display: grid; gap: 4px; align-content: center; background: #f8f5ef; }
.operation-log-summary small { color: #8d8578; font-size: 8px; font-weight: 700; }
.operation-log-summary strong { color: #463c2c; font: 650 14px/1.1 Georgia,"Songti SC",serif; }
.operation-log-table-wrap { max-height: calc(100vh - 390px); min-height: 300px; overflow: auto; }
.operation-log-table-wrap table { min-width: 1180px; table-layout: fixed; }
.operation-log-table-wrap th:nth-child(1) { width: 145px; }
.operation-log-table-wrap th:nth-child(2) { width: 120px; }
.operation-log-table-wrap th:nth-child(3) { width: 125px; }
.operation-log-table-wrap th:nth-child(4) { width: 170px; }
.operation-log-table-wrap th:nth-child(6) { width: 95px; }
.operation-log-table-wrap th:nth-child(7) { width: 150px; }
.operation-log-table-wrap td { vertical-align: top; line-height: 1.55; }
.operation-log-time, .operation-log-document { color: #625c52; font-family: ui-monospace,Consolas,monospace; white-space: nowrap; }
.operation-log-case { display: inline-flex; min-height: 23px; padding: 4px 8px; align-items: center; color: #74571f; background: #f3e8ca; border: 1px solid #dfca95; border-radius: 12px; font-size: 8px; font-weight: 750; white-space: nowrap; }
.operation-log-content { color: #514c43; font-size: 9px; overflow-wrap: anywhere; white-space: normal; }
.operation-log-foot { min-height: 54px; padding: 9px 16px; display: flex; align-items: center; justify-content: space-between; gap: 14px; color: #837b6f; background: #f3f0ea; border-top: 1px solid #ddd6ca; font-size: 9px; }
.operation-log-foot > div { display: flex; gap: 7px; }

@media (max-width: 1450px) {
  .operation-log-filters { grid-template-columns: repeat(4,minmax(130px,1fr)); }
  .operation-log-query { grid-column: span 2; }
}

@media (max-width: 760px) {
  .operation-log-filters { grid-template-columns: 1fr 1fr; }
  .operation-log-query { grid-column: 1 / -1; }
  .operation-log-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

/* 款式管理：正文是老板端报价页的 iframe，本页只保留款号定位入口。 */
/* 进入款式管理时隐藏进销存左栏与外层大页头，让内层款式列表占满宽高（仅此页生效）。 */
body[data-ji-view="style-admin"] .app-shell { grid-template-columns: minmax(0, 1fr); }
body[data-ji-view="style-admin"] .sidebar,
body[data-ji-view="style-admin"] .topbar { display: none; }
body[data-ji-view="style-admin"] .view[data-view-panel="style-admin"] { padding: 10px 14px 12px; min-width: 0; width: 100%; max-width: 100%; box-sizing: border-box; }
.view[data-view-panel="style-admin"] { padding-bottom: 0; }
.style-admin-workspace { --style-admin-chrome: 120px; height: calc(100vh - var(--style-admin-chrome)); min-height: 420px; display: flex; flex-direction: column; min-width: 0; width: 100%; max-width: 100%; box-sizing: border-box; }
body[data-ji-view="style-admin"] .style-admin-workspace { --style-admin-chrome: 22px; }
.style-admin-toolbar { flex: 0 0 auto; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; min-width: 0; width: 100%; max-width: 100%; box-sizing: border-box; }
.style-admin-back { flex: 0 0 auto; height: 38px; padding: 0 16px; font-weight: 750; flex-shrink: 0; white-space: nowrap; }
.style-admin-back svg { width: 15px; height: 15px; transform: rotate(180deg); }
.style-admin-sources-panel { flex: 1 1 auto; min-width: 0; }
.style-admin-sources-panel > summary { min-height: 38px; padding: 6px 13px; display: flex; align-items: center; gap: 9px; color: #4f4940; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 2px 8px rgba(30,29,24,.03); cursor: pointer; list-style: none; }
.style-admin-sources-panel > summary::-webkit-details-marker { display: none; }
.style-admin-sources-panel[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.style-admin-sources-panel > summary b { color: #2c2b26; font-size: 11px; letter-spacing: .3px; }
.style-admin-sources-panel > summary small { min-width: 0; overflow: hidden; color: #969188; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.style-admin-sources-panel > summary::after { content: "展开 ⌄"; margin-left: auto; flex: 0 0 auto; color: #8a6a24; font-size: 9px; font-weight: 700; }
.style-admin-sources-panel[open] > summary::after { content: "收起 ⌃"; }
.style-admin-sources-body { padding: 10px 12px 12px; background: #fff; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 8px 8px; box-shadow: 0 2px 8px rgba(30,29,24,.03); }
.style-admin-searchbar { display: grid; grid-template-columns: minmax(260px, 1fr) auto; gap: 12px; align-items: end; }
.style-admin-searchbar label { display: grid; gap: 6px; }
.style-admin-searchbar label > span { color: #6e685e; font-size: 9px; font-weight: 750; }
.style-admin-searchbar input, .style-admin-searchbar .button { height: 38px; }
.style-admin-searchbar input { background: #fff; }
.style-admin-status { margin: 0; padding: 8px 0 0; color: #8b8376; font-size: 9px; line-height: 1.6; }
.style-admin-status:empty { display: none; }
.style-admin-sources { margin-top: 8px; padding: 9px 12px; display: flex; align-items: center; gap: 12px; background: #f7f4ed; border: 1px solid var(--line); border-radius: 7px; }
.style-admin-sources > strong { flex: 0 0 auto; color: #2c2b26; font-size: 10px; letter-spacing: .3px; }
.style-admin-sources > strong small { display: block; margin-top: 3px; color: #969188; font-size: 8px; font-weight: 600; letter-spacing: 0; }
.style-admin-source-list { flex: 1 1 auto; min-width: 0; display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.style-admin-source { flex: 0 0 auto; padding: 6px 10px; display: inline-flex; gap: 8px; align-items: center; color: #6e685e; background: #fff; border: 1px solid #e0d9cd; border-radius: 5px; font-size: 9px; }
.style-admin-source b { color: #2f2c25; font: 650 10px/1 ui-monospace, Consolas, monospace; }
.style-admin-source em { font-style: normal; color: #969188; }
.style-admin-source em.is-stock { color: #1f7a4d; }
.style-admin-source button { padding: 0; border: 0; background: none; color: #8a6a24; font: 700 9px/1 inherit; cursor: pointer; text-decoration: underline; }
.style-admin-frame-wrap { flex: 1 1 auto; min-height: 0; min-width: 0; width: 100%; max-width: 100%; box-sizing: border-box; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; box-shadow: 0 8px 28px rgba(30,29,24,.035); }
.style-admin-frame-wrap iframe { width: 100%; height: 100%; display: block; border: 0; background: #fff; box-sizing: border-box; }
@media (min-width: 1101px) {
  .style-admin-workspace { height: calc(100vh - 84px); }
}
@media (max-width: 720px) {
  .style-admin-workspace { height: auto; min-height: 0; }
  .style-admin-toolbar { flex-wrap: wrap; }
  .style-admin-searchbar { grid-template-columns: 1fr; }
  .style-admin-searchbar .button { width: 100%; }
  .style-admin-frame-wrap { min-height: 62vh; }
}

/* 货品轨迹：精准定位单件货品并展示全生命周期。 */
.item-trace-workspace { width: 100%; }
.item-trace-page-head { margin-bottom: 14px; }
.item-trace-page-head > div { max-width: 760px; }
.item-trace-search-panel { margin-bottom: 16px; overflow: visible; }
.item-trace-searchbar { padding: 18px 20px; display: grid; grid-template-columns: 170px minmax(280px, 1fr) auto auto; gap: 12px; align-items: end; }
.item-trace-searchbar label { display: grid; gap: 6px; }
.item-trace-searchbar label > span { color: #6e685e; font-size: 9px; font-weight: 750; }
.item-trace-searchbar select, .item-trace-searchbar textarea { width: 100%; background: #fff; }
.item-trace-searchbar textarea { min-height: 42px; padding: 10px 12px; border: 1px solid #d8d2c7; border-radius: 5px; resize: vertical; font: 500 11px/1.45 ui-monospace, Consolas, monospace; }
.item-trace-searchbar textarea:focus { border-color: #b49149; outline: 3px solid rgba(180,145,73,.12); }
.item-trace-searchbar .button { height: 42px; }
.item-trace-integrity { margin: 0 20px 18px; }
.item-trace-summary { margin: 0 0 16px; padding: 13px 16px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: #d9d2c5; border: 1px solid #d9d2c5; border-radius: 7px; overflow: hidden; }
.item-trace-summary > span { min-height: 58px; padding: 10px 14px; display: grid; gap: 5px; align-content: center; background: #fbfaf6; }
.item-trace-summary small { color: #8b8376; font-size: 8px; font-weight: 700; }
.item-trace-summary strong { color: #362f24; font: 650 16px/1.1 Georgia, "Songti SC", serif; }
.item-trace-results { display: grid; gap: 16px; }
.item-trace-empty { min-height: 230px; display: grid; place-content: center; text-align: center; }
.item-trace-loading { min-height: 220px; display: flex; align-items: center; justify-content: center; }
.item-trace-card { overflow: hidden; }
.item-trace-card > summary { min-height: 88px; padding: 17px 20px; display: grid; grid-template-columns: minmax(230px, .8fr) minmax(420px, 1.5fr) 20px; gap: 20px; align-items: center; color: #343027; background: linear-gradient(135deg,#fffdf8,#f5f0e6); border-bottom: 1px solid transparent; cursor: pointer; list-style: none; }
.item-trace-card > summary::-webkit-details-marker { display: none; }
.item-trace-card[open] > summary { border-bottom-color: #e2dbce; }
.item-trace-card > summary > i { color: #9a7530; font-size: 18px; font-style: normal; transition: transform .18s ease; }
.item-trace-card[open] > summary > i { transform: rotate(180deg); }
.item-trace-card-title { min-width: 0; display: flex; align-items: center; gap: 12px; }
.item-trace-card-title > div { min-width: 0; display: grid; gap: 4px; }
.item-trace-card-title strong { overflow: hidden; color: #29251d; font: 700 18px/1 ui-monospace, Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.item-trace-card-title span:not(.item-trace-status) { overflow: hidden; color: #777064; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.item-trace-status { min-width: 56px; height: 30px; padding: 0 10px; display: inline-grid; place-items: center; border-radius: 16px; font-size: 9px; font-weight: 800; white-space: nowrap; }
.item-trace-status.is-stocked { color: #176a42; background: #dff3e9; border: 1px solid #aed9c4; }
.item-trace-status.is-sold { color: #785617; background: #f6e8c2; border: 1px solid #dfc27b; }
.item-trace-status.is-transfer { color: #345f86; background: #e0ebf5; border: 1px solid #adc6dc; }
.item-trace-status.is-returned { color: #8c3932; background: #f5dfdd; border: 1px solid #ddb3af; }
.item-trace-status.is-empty { color: #706b63; background: #ece8e1; border: 1px solid #d6d0c6; }
.item-trace-fingerprint { min-width: 0; display: grid; grid-template-columns: minmax(110px,.7fr) minmax(100px,.6fr) minmax(190px,1.4fr); gap: 10px; }
.item-trace-fingerprint > span { min-width: 0; display: grid; gap: 4px; color: #948a79; font-size: 8px; }
.item-trace-fingerprint b { overflow: hidden; color: #4c463c; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.item-trace-card-body { padding: 20px; display: grid; gap: 18px; }
.item-trace-current { display: grid; grid-template-columns: 190px minmax(0,1fr); gap: 18px; align-items: start; }
.item-trace-current h3, .item-trace-section-head h3 { margin: 5px 0 0; color: #322e26; font: 600 17px/1.15 Georgia, "Songti SC", serif; }
.item-trace-locations { display: flex; flex-wrap: wrap; gap: 9px; }
.item-trace-location { min-width: 220px; padding: 11px 13px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 3px 12px; color: #4d493f; background: #f8f5ed; border: 1px solid #dfd7c8; border-radius: 6px; text-align: left; cursor: pointer; }
.item-trace-location:hover { background: #fff8e8; border-color: #c8a85e; }
.item-trace-location span { overflow: hidden; font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.item-trace-location strong { color: #87621d; font-size: 11px; }
.item-trace-location small { grid-column: 1 / -1; color: #9a9286; font-size: 8px; }
.item-trace-no-location { min-height: 56px; padding: 11px 14px; display: grid; gap: 4px; align-content: center; background: #f1eee8; border: 1px dashed #cfc7bb; border-radius: 6px; }
.item-trace-no-location strong { color: #6e675c; font-size: 10px; }
.item-trace-no-location span { color: #9a9286; font-size: 8px; }
.item-trace-counters { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 8px; }
.item-trace-counters > span { min-height: 58px; padding: 10px 12px; display: grid; gap: 4px; align-content: center; background: #f4f1ea; border: 1px solid #e5ded2; border-radius: 5px; }
.item-trace-counters small { color: #8f877a; font-size: 8px; }
.item-trace-counters strong { color: #5e4b28; font: 650 17px/1 Georgia, serif; }
.item-trace-timeline { padding-top: 2px; }
.item-trace-section-head { margin-bottom: 14px; display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.item-trace-section-tools { display: flex; align-items: center; gap: 12px; }
.item-trace-section-tools > span { color: #8f8779; font-size: 9px; white-space: nowrap; }
.item-trace-mode-switch { flex: 0 0 auto; border: 1px solid #e0dbd1; }
.item-trace-mode-switch button { min-width: 58px; cursor: pointer; }
.item-trace-event-list { margin: 0; padding: 0; list-style: none; }
.item-trace-event { position: relative; min-height: 76px; padding: 0 0 15px 48px; }
.item-trace-event:not(:last-child)::before { content: ""; position: absolute; left: 17px; top: 34px; bottom: 0; width: 1px; background: #d9d1c4; }
.item-trace-event-dot { position: absolute; z-index: 1; left: 0; top: 1px; width: 35px; height: 35px; display: grid; place-items: center; color: #fff; background: #8b8275; border: 4px solid #f8f6f1; border-radius: 50%; box-shadow: 0 0 0 1px #d4ccbf; font-size: 9px; font-weight: 800; }
.item-trace-event.is-inbound .item-trace-event-dot { background: #3f7959; }
.item-trace-event.is-transfer .item-trace-event-dot { background: #557aa0; }
.item-trace-event.is-stocktake .item-trace-event-dot { background: #6c5b8f; }
.item-trace-event.is-sale .item-trace-event-dot { background: #a47b2d; }
.item-trace-event.is-sale-return .item-trace-event-dot { background: #b16e49; }
.item-trace-event.is-supplier-return .item-trace-event-dot { background: #9b4f49; }
.item-trace-event-main { padding: 11px 13px; background: #fbfaf7; border: 1px solid #e5ded2; border-radius: 6px; }
.item-trace-event-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.item-trace-event-title > span { min-width: 0; display: flex; align-items: center; gap: 8px; }
.item-trace-event-title b { color: #3e392f; font-size: 11px; }
.item-trace-event-title em { padding: 3px 7px; color: #887753; background: #eee7d8; border-radius: 9px; font-size: 7px; font-style: normal; font-weight: 700; }
.item-trace-event-title time { flex: 0 0 auto; color: #8d8579; font-size: 9px; }
.item-trace-event-meta { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 6px 14px; color: #766f64; font-size: 9px; }
.item-trace-event-meta strong { color: #4f493f; font-family: ui-monospace,Consolas,monospace; }
.item-trace-quantity { color: #8a641d; font-weight: 750; }
.item-trace-event-main p { margin: 7px 0 0; color: #91897e; font-size: 8px; line-height: 1.6; overflow-wrap: anywhere; }
.item-trace-category-list { display: grid; gap: 9px; }
.item-trace-category { overflow: hidden; background: #fbfaf7; border: 1px solid #e3dccf; border-radius: 7px; }
.item-trace-category > summary { min-height: 58px; padding: 10px 13px; display: grid; grid-template-columns: 34px minmax(0,1fr) auto 18px; gap: 11px; align-items: center; cursor: pointer; list-style: none; }
.item-trace-category > summary::-webkit-details-marker { display: none; }
.item-trace-category > summary:hover { background: #fffdf8; }
.item-trace-category > summary > span:nth-child(2) { min-width: 0; display: grid; gap: 3px; }
.item-trace-category > summary strong { color: #3e392f; font-size: 11px; }
.item-trace-category > summary small { overflow: hidden; color: #91897e; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.item-trace-category > summary em { color: #806934; font-size: 9px; font-style: normal; font-weight: 750; white-space: nowrap; }
.item-trace-category > summary > i { color: #9a7530; font-size: 14px; font-style: normal; transition: transform .18s ease; }
.item-trace-category[open] > summary { background: #f6f1e7; border-bottom: 1px solid #e3dccf; }
.item-trace-category[open] > summary > i { transform: rotate(180deg); }
.item-trace-category-glyph { width: 32px; height: 32px; display: grid; place-items: center; color: #fff; background: #8b8275; border-radius: 50%; font-size: 9px; font-weight: 800; }
.item-trace-category.is-inbound .item-trace-category-glyph { background: #3f7959; }
.item-trace-category.is-transfer .item-trace-category-glyph { background: #557aa0; }
.item-trace-category.is-stocktake .item-trace-category-glyph { background: #6c5b8f; }
.item-trace-category.is-sale .item-trace-category-glyph { background: #a47b2d; }
.item-trace-category.is-supplier-return .item-trace-category-glyph { background: #9b4f49; }
.item-trace-category-events { padding: 14px 14px 0; }

@media (max-width: 1050px) {
  .item-trace-searchbar { grid-template-columns: 150px minmax(220px,1fr) auto; }
  .item-trace-searchbar #resetItemTrace { grid-column: 3; }
  .item-trace-card > summary { grid-template-columns: 1fr 20px; }
  .item-trace-fingerprint { grid-column: 1 / -1; grid-row: 2; }
  .item-trace-card > summary > i { grid-column: 2; grid-row: 1; }
  .item-trace-counters { grid-template-columns: repeat(3,minmax(0,1fr)); }
}

.crm-delivery-panel { margin: 16px 0 8px; padding: 14px 16px; border: 1px solid var(--gold-soft); border-radius: 14px; background: #fbf7ef; }
.crm-delivery-summary { margin-bottom: 10px; font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.crm-delivery-summary b { display: block; margin-bottom: 4px; }
.crm-delivery-buckets { display: grid; gap: 8px; }
.crm-delivery-bucket { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.crm-delivery-bucket.is-done { border-color: #b7d7c4; background: #f4faf6; }
.crm-delivery-bucket.is-over { border-color: #e0b4ad; background: #fdf6f4; }
.crm-delivery-bucket strong, .crm-delivery-bucket small { display: block; }
.crm-delivery-bucket small { margin-top: 4px; color: var(--muted); }
.sale-crm-record { min-width: 168px; }
.crm-delivery-lock { background: #f3f1eb; pointer-events: none; }

@media (max-width: 700px) {
  .item-trace-searchbar { grid-template-columns: 1fr; }
  .item-trace-searchbar #resetItemTrace { grid-column: auto; }
  .item-trace-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .item-trace-fingerprint { grid-template-columns: 1fr; }
  .item-trace-current { grid-template-columns: 1fr; }
  .item-trace-counters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .item-trace-section-head { align-items: stretch; flex-direction: column; }
  .item-trace-section-tools { justify-content: space-between; }
  .item-trace-event-title { align-items: flex-start; flex-direction: column; gap: 5px; }
}

/* 客户权益目录管理 */
.benefit-definition-terms { display: block; margin-top: 12px; }
.benefit-definition-terms textarea { width: 100%; resize: vertical; }
.benefit-definition-flags { display: flex; gap: 20px; margin-top: 10px; font-size: 13px; }
.benefit-definition-flags label { display: flex; align-items: center; gap: 6px; }

/* 入库明细：紧凑选择与原位调拨。 */
.inbound-detail-lines input[type="checkbox"] { width: 16px; min-width: 16px; height: 16px; margin: 0; padding: 0; vertical-align: middle; accent-color: #a9853e; cursor: pointer; }
.inbound-detail-lines tr:has([data-inbound-transfer-line]:checked) td { background: #f8f3e7; }
.inbound-selection-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.inbound-selection-tools .button { padding: 6px 12px; }
.inbound-selection-tools span { color: var(--ink); font-size: 11px; }
.is-selecting-inbound, .is-selecting-inbound * { user-select: none !important; cursor: pointer; }
.inbound-transfer-panel { padding: 16px 28px; border-top: 1px solid #e3dccd; background: #faf7ef; }
.inbound-transfer-panel[hidden], .inbound-transfer-result[hidden] { display: none; }
.inbound-transfer-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; font-size: 12px; }
.inbound-transfer-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.inbound-transfer-fields label { min-width: 0; }
.inbound-transfer-fields label span { display: block; margin-bottom: 6px; color: #817969; font-size: 10px; }
.inbound-transfer-result { margin: 0; padding: 14px 28px; color: #526344; background: #f1f5ed; font-size: 12px; }

.inbound-detail-dialog[open] { display: flex; flex-direction: column; max-height: calc(100dvh - 48px); }
.inbound-detail-dialog > .record-dialog-body { flex: 1 1 auto; min-height: 0; max-height: none; overflow: auto; }
.inbound-detail-dialog > .record-dialog-head,
.inbound-detail-dialog > .inbound-transfer-panel,
.inbound-detail-dialog > .inbound-transfer-result,
.inbound-detail-dialog > .record-dialog-actions { flex-shrink: 0; }
.inbound-detail-dialog > .record-dialog-actions { flex-wrap: wrap; }
.inbound-detail-dialog > .record-dialog-actions .button { flex-shrink: 0; white-space: nowrap; }

.supplies-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; padding: 0 4px 16px; }
.supplies-toolbar label span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; }
.supplies-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.supplies-table-wrap { min-height: 360px; }
.supply-inline-setting { display: inline-flex; gap: 5px; align-items: center; white-space: nowrap; }
.supply-inline-setting select,
.supplies-table-wrap [data-supply-inline-source] { min-width: 86px; padding: 6px 8px; font-size: 10px; }
.supply-inline-setting input { width: 52px; padding: 6px 8px; font-size: 10px; }
.supply-thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 4px; background: #f3efe6; }
.supply-item-dialog { width: min(720px, calc(100vw - 32px)); }
.supply-document-dialog { width: min(680px, calc(100vw - 32px)); }
.supply-item-dialog .record-dialog-head,
.supply-document-dialog .record-dialog-head { min-height: 84px; padding: 17px 22px; }
.supply-item-dialog .record-dialog-head h2,
.supply-document-dialog .record-dialog-head h2 { margin-top: 5px; font-size: 22px; }
.supply-item-dialog .record-dialog-body,
.supply-document-dialog .record-dialog-body { padding: 18px 22px 22px; }
.supply-item-fields,
.supply-quick-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.supply-dialog-note { margin-bottom: 16px; padding: 12px 14px; display: flex; gap: 10px; align-items: baseline; color: #625b4e; background: #f3ecdc; border-left: 3px solid var(--gold); border-radius: 4px; }
.supply-dialog-note strong { flex: 0 0 auto; color: #3e392f; font-size: 11px; }
.supply-dialog-note span { font-size: 10px; line-height: 1.55; }
.supply-item-fields label small,
.supply-quick-fields label small { margin-top: -2px; color: #969188; font-size: 9px; }
.supply-stock-settings { margin-top: 18px; padding: 0 14px; background: #f5f2eb; border: 1px solid #e2ddd2; border-radius: 5px; }
.supply-deduction-settings { margin-top: 18px; }
.supply-deduction-settings .data-integrity-note { margin-bottom: 12px; }
.supply-stock-settings-title { padding: 12px 0; color: #575146; font-size: 11px; font-weight: 700; }
.supply-stock-settings-title small { margin-left: 8px; color: #99948a; font-size: 9px; font-weight: 500; }
.supply-store-settings-head { padding: 0 0 6px; display: grid; grid-template-columns: 120px 1fr 1fr; gap: 8px; color: #8e897f; font-size: 9px; }
.supply-store-settings-note { margin: 0; color: #8e897f; font-size: 9px; line-height: 1.6; }
.sale-supplies-panel { margin-top: 18px; padding-top: 8px; }
.sale-supplies-toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.sale-supplies-panel input[type="number"] { width: 72px; }
.sale-supplies-panel input[type="text"] { min-width: 160px; }
.sale-supplies-return { margin: 16px 0; padding: 12px; background: #f7f4ee; border-radius: 8px; }
.sale-supplies-return p { margin: 4px 0 10px; color: var(--muted); font-size: 12px; }
.supply-store-settings { display: grid; gap: 8px; margin: 12px 0; }
.supply-store-settings label { display: grid; grid-template-columns: 120px 1fr 1fr; gap: 8px; align-items: center; }
.supply-image-dropzone { margin-top: 18px; min-height: 82px; padding: 14px; display: grid; gap: 5px; place-content: center; text-align: center; color: #6d665a; background: #faf8f2; border: 1px dashed #c9b98f; border-radius: 6px; cursor: pointer; transition: .15s ease; }
.supply-image-dropzone:hover,
.supply-image-dropzone.is-dragging { color: #3d372d; background: #f3ead6; border-color: #aa8745; box-shadow: 0 0 0 3px rgba(185,149,76,.1); }
.supply-image-dropzone strong { font-size: 11px; }
.supply-image-dropzone span { color: #989187; font-size: 9px; }
.supply-image-dropzone.is-uploading { cursor: progress; color: #6b5628; background: #f6eeda; border-style: solid; border-color: #b9924b; }
.supply-image-dropzone.is-error { color: #8c3b30; background: #fbeeec; border-color: #c9756a; }
.supply-image-list { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; align-items: flex-start; }
.supply-image-list img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; }
.supply-image-empty { color: #989187; font-size: 9px; line-height: 1.6; }
.supply-image-cell { position: relative; margin: 0; width: 72px; height: 72px; border-radius: 6px; overflow: hidden; background: #f3f0e8; }
.supply-image-cell img { display: block; width: 72px; height: 72px; object-fit: cover; cursor: zoom-in; transition: transform .16s ease; }
.supply-image-cell:hover img { transform: scale(1.05); }
.supply-image-cell img.is-broken { opacity: .25; }
.supply-image-cell.is-broken { display: grid; place-items: center; text-align: center; border: 1px dashed #c9b98f; }
.supply-image-missing { color: #8c3b30; font-size: 9px; line-height: 1.3; }
.supply-image-remove { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; padding: 0; display: grid; place-items: center; color: #fff; background: rgba(28,26,22,.62); border: 0; border-radius: 50%; font-size: 12px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .15s ease, background .15s ease; }
.supply-image-cell:hover .supply-image-remove,
.supply-image-cell:focus-within .supply-image-remove { opacity: 1; }
.supply-image-remove:hover { background: #b4463a; }
.supply-image-viewer { width: 94vw; max-width: 1500px; height: 92vh; max-height: 92vh; margin: auto; padding: 0; overflow: hidden; color: #f0eadd; background: #181713; border: 1px solid rgba(255,255,255,.1); border-radius: 10px; }
.supply-image-viewer::backdrop { background: rgba(12,12,10,.86); backdrop-filter: blur(3px); }
.supply-image-viewer-head { height: 46px; padding: 0 10px 0 18px; display: flex; gap: 12px; align-items: center; justify-content: space-between; background: #201f1a; font-size: 12px; }
.supply-image-viewer-head strong { font-weight: 500; color: #f0eadd; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.supply-image-viewer-head .dialog-close { position: static; color: #cfcabd; background: rgba(255,255,255,.08); }
.supply-image-viewer-body { height: calc(100% - 90px); padding: 12px; display: grid; place-items: center; background: #121110; }
.supply-image-viewer-body img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 4px; }
.supply-image-viewer-foot { height: 44px; padding: 0 18px; display: flex; gap: 12px; align-items: center; justify-content: space-between; color: #8e8a80; background: #201f1a; font-size: 10px; }
.supply-image-viewer-foot a { color: #d7b978; text-decoration: none; border-bottom: 1px solid rgba(215,185,120,.4); }
.supply-image-viewer-foot a:hover { color: #f0d9a4; }
.supply-rule-preview { white-space: pre-wrap; background: #f7f4ee; padding: 12px; border-radius: 8px; font-size: 12px; }

@media (max-width: 640px) {
  .supply-item-fields,
  .supply-quick-fields { grid-template-columns: 1fr !important; }
  .supply-store-settings-head,
  .supply-store-settings label { grid-template-columns: 90px 1fr 1fr; }
  .supply-item-dialog .record-dialog-actions,
  .supply-document-dialog .record-dialog-actions { flex-wrap: wrap; }
}

/* 手机适配（仅排版，不改逻辑）：取消桌面最小宽度 1180px，侧栏改成顶部紧凑导航，宽表格在框内横滑 */
@media (max-width: 767px) {
  html { min-width: 0; }
  body { overflow-x: hidden; }
  .app-shell { display: block; min-height: 100dvh; }
  .sidebar { position: relative; height: auto; padding-top: env(safe-area-inset-top); }
  .brand { min-height: 0; padding: 10px 16px; }
  .brand-logo { max-height: 34px; width: auto; }
  .primary-nav { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 10px; }
  .primary-nav .nav-label { display: none; }
  .primary-nav > .nav-item, .nav-group { width: auto; flex: 0 0 auto; }
  .nav-group:has(.nav-submenu.is-open) { flex-basis: 100%; }
  .primary-nav > .nav-item, .nav-group-toggle { width: auto; height: 44px; padding: 0 12px; gap: 6px; grid-template-columns: auto auto auto; }
  .nav-submenu { margin: 0 0 6px 10px; }
  .nav-submenu.is-open { display: flex; flex-wrap: wrap; gap: 4px; }
  .nav-item.sub { width: auto; height: 44px; padding: 0 12px; font-size: 13px; }
  .nav-item::before { display: none; }
  .sidebar-footer { display: none; }
  .workspace { min-width: 0; }
  .topbar { height: auto; padding: 12px 14px; flex-wrap: wrap; gap: 10px; }
  .topbar h1 { font-size: 21px; }
  .topbar-actions { width: 100%; flex-wrap: wrap; gap: 8px; }
  .global-search { width: 100%; height: 44px; }
  .global-search kbd { display: none; }
  .gold-rate-button { height: 48px; }
  .view { padding: 14px 12px calc(36px + env(safe-area-inset-bottom)); }
  [class*="-wrap"], [class*="table-wrap"] { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .view table:not([class*="label"]) { max-width: none; }
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]), select, textarea { font-size: 16px !important; }
  button, select, input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=hidden]) { min-height: 44px; }
  .view button, .command-button, .column-settings summary { min-height: 44px !important; }
  .column-settings summary { display: inline-flex; align-items: center; }
  .global-search input { min-height: 0; }
  .panel, .form-panel { width: auto; min-width: 0; max-width: 100%; }
  .view [class*="-layout"], .view [class*="-builder"], .view [class*="-grid"], .field-grid { grid-template-columns: minmax(0, 1fr) !important; }
  .view [class*="-grid"] > *, .view [class*="-layout"] > *, .view [class*="-builder"] > * { min-width: 0; grid-column: auto !important; }
  .inventory-command-group, .supplier-return-start { display: flex; flex-wrap: wrap; width: 100%; max-width: 100%; gap: 8px; }
  .view [class*="-toolbar"], .view [class*="-filters"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; flex-wrap: wrap; }
  .view [class*="-toolbar"] > *, .view [class*="-filters"] > * { min-width: 0; max-width: 100%; grid-column: auto !important; }
  .column-settings-popover { position: fixed; left: 12px; right: 12px; width: auto; max-width: none; }
  .label-preview-workspace { width: 100%; min-width: 0; max-width: 100%; overflow-x: auto; }
  .label-preview-toolbar { flex-wrap: wrap; max-width: 100%; }
  .text-button { min-width: 44px; }
  .inventory-query-actions { flex-wrap: wrap; grid-column: 1 / -1 !important; }
  dialog, .modal, [class*="dialog"] { max-width: 100vw; }
}
