:root {
  --primary: #6d5dfc;
  --primary-dark: #5647e8;
  --ink: #20222a;
  --muted: #747986;
  --line: #e8e9ef;
  --panel: #ffffff;
  --bg: #f6f7fb;
  --positive: #15956c;
  --warning: #c57913;
  --negative: #d64b55;
  --radius: 18px;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif; }
button, input, select, textarea { font: inherit; }
button, .button { min-height: 40px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; transition: .18s ease; }
button:hover, .button:hover { border-color: #bfc1ce; transform: translateY(-1px); }
button:disabled { opacity: .55; cursor: wait; transform: none; }
.primary { border-color: var(--primary); background: var(--primary); color: #fff; font-weight: 700; }
.primary:hover { border-color: var(--primary-dark); background: var(--primary-dark); }
.danger { color: var(--negative); }
input, select, textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #dfe1e8; border-radius: 11px; outline: none; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px #6d5dfc18; }
textarea { min-height: 80px; resize: vertical; }
label { display: grid; gap: 7px; color: #505460; font-size: 13px; font-weight: 650; }
label small, .hint { color: var(--muted); font-weight: 400; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: 25px; }
h2 { margin-bottom: 6px; font-size: 18px; }
h3 { font-size: 15px; }
p { color: var(--muted); line-height: 1.55; }
.hidden { display: none !important; }
.positive { color: var(--positive) !important; }
.warning { color: var(--warning) !important; }
.negative { color: var(--negative) !important; }
.muted { color: var(--muted); }
.empty { padding: 22px; color: var(--muted); text-align: center; }
.autocomplete-field { position: relative; }
.autocomplete-field > input:not([type="hidden"]) { padding-right: 42px; }
.autocomplete-clear { position: absolute; z-index: 35; top: 31px; right: 10px; display: none; width: 26px; min-height: 26px; height: 26px; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 50%; background: #f0f1f6; color: #777c89; font-size: 18px; line-height: 1; }
.autocomplete-clear:hover { background: #e7e8f0; color: var(--ink); transform: none; }
.autocomplete-clear.visible { display: flex; }
.autocomplete-menu { position: absolute; z-index: 30; top: calc(100% + 6px); right: 0; left: 0; display: grid; min-width: min(430px,calc(100vw - 32px)); max-height: 320px; overflow: auto; padding: 6px; border: 1px solid #dfe1e8; border-radius: 12px; background: #fff; box-shadow: 0 14px 34px #20222a24; }
.autocomplete-menu button { display: grid; min-height: 48px; justify-items: start; gap: 3px; padding: 9px 10px; border: 0; border-radius: 9px; text-align: left; }
.autocomplete-menu button:hover, .autocomplete-menu button.active { background: #f1efff; color: var(--primary-dark); transform: none; }
.autocomplete-menu button b { max-width: 100%; overflow-wrap: anywhere; line-height: 1.35; white-space: normal; }
.autocomplete-menu button small { max-width: 100%; overflow-wrap: anywhere; color: var(--muted); font-size: 11px; line-height: 1.35; white-space: normal; }
.autocomplete-empty { padding: 14px 10px; font-size: 12px; }

.shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
aside { position: sticky; top: 0; height: 100vh; padding: 22px 14px; background: #24232d; color: #fff; }
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 9px 26px; }
.brand > span { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 13px; background: linear-gradient(135deg,#8e7cff,#5e4df3); font-weight: 800; }
.brand div { display: grid; gap: 3px; }
.brand strong { font-size: 17px; }
.brand small { color: #aaa8b5; font-size: 11px; }
nav { display: grid; gap: 7px; }
nav button { display: flex; align-items: center; gap: 11px; min-height: 48px; border: 0; background: transparent; color: #bebcc9; text-align: left; }
nav button i { display: grid; width: 26px; height: 26px; place-items: center; border-radius: 8px; background: #ffffff0d; font-size: 12px; font-style: normal; }
nav button.active { background: #fff; color: #24232d; font-weight: 750; }
nav button.active i { background: #6d5dfc18; color: var(--primary); }

main { width: 100%; min-width: 0; padding: 24px 24px 50px; }
header { display: flex; align-items: center; justify-content: space-between; max-width: 1480px; margin: 0 auto 20px; }
header p { margin-bottom: 0; font-size: 13px; }
.status-dot { color: var(--muted); font-size: 12px; }
.status-dot::before { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #aeb1ba; content: ""; }
.status-dot.online::before { background: var(--positive); box-shadow: 0 0 0 4px #15956c18; }
.page { display: none; width: 100%; max-width: 1480px; margin: 0 auto; }
.page.active { display: grid; gap: 16px; }
.card { padding: 20px; border: 1px solid #ececf1; border-radius: var(--radius); background: var(--panel); box-shadow: 0 5px 24px #29253d0a; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-head p { margin-bottom: 0; }

.entry-page { max-width: 1040px; }
.entry-hero { display: flex; align-items: center; gap: 12px; padding: 0 4px; }
.entry-hero h2 { margin: 0; font-size: 18px; }
.entry-hero p { margin: 3px 0 0; font-size: 13px; }
.form-heading { margin-top: 8px; }
.step-number { display: grid; flex: 0 0 34px; width: 34px; height: 34px; place-items: center; border-radius: 11px; background: var(--primary); color: #fff; font-weight: 800; }
.photo-card { overflow: hidden; border: 1px solid #e3e2eb; border-radius: 21px; background: #fff; box-shadow: 0 8px 30px #2f295712; }
.photo-upload-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.photo-title { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.photo-title span { color: var(--muted); font-size: 11px; }
.photo-title .recommended { color: var(--primary); }
.photo-picker { position: relative; display: grid; min-height: 240px; place-items: center; overflow: hidden; background: linear-gradient(145deg,#f2f0ff,#fafafe); cursor: pointer; }
.photo-picker.compact { min-height: 180px; }
.photo-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.photo-picker > span { display: grid; gap: 8px; text-align: center; }
.photo-picker b { color: var(--primary); font-size: 20px; }
.photo-picker small { color: var(--muted); font-size: 13px; }
.photo-picker img { width: 100%; max-height: 420px; object-fit: contain; background: #181820; }
.recognize-status { display: flex; min-height: 50px; align-items: center; justify-content: center; gap: 10px; padding: 11px 16px; color: var(--muted); text-align: center; font-size: 13px; }
.recognize-status b { color: var(--ink); }
.recognize-status span { color: var(--muted); }
.recognize-status.working { color: var(--primary); }
.recognize-status.done { background: #effaf6; color: var(--positive); }
.recognize-status.warning { background: #fff8ec; color: var(--warning); }
.recognize-status.error { display: grid; gap: 3px; background: #fff2f3; color: var(--negative); }
.recognize-status.standalone { border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.quick-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.field-wide { grid-column: 1 / -1; }
.profit-box { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px; padding: 15px 17px; border-radius: 14px; background: #272532; color: #fff; }
.profit-box strong { font-size: 25px; }
.profit-box small { grid-column: 1 / -1; color: #aaa8b4; }
.advanced { border-top: 1px dashed var(--line); padding-top: 12px; }
.advanced summary { color: var(--primary); cursor: pointer; font-size: 13px; font-weight: 700; }
.advanced-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; padding-top: 14px; }
.check { display: flex; min-height: 44px; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; }
.check input { width: auto; min-height: auto; }
.big-button { min-height: 52px; font-size: 16px; }
.success-card { display: grid; gap: 9px; padding: 24px; border: 1px solid #bce9d7; border-radius: var(--radius); background: #f0fbf7; text-align: center; }
.success-card b { color: var(--positive); font-size: 22px; }
.success-card span { color: #4d6d61; }
.success-card div { display: flex; justify-content: center; gap: 8px; margin-top: 7px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.current-user { max-width: 180px; overflow: hidden; padding: 5px 9px; border: 1px solid #e5e4ed; border-radius: 999px; background: #fff; color: var(--ink); font-size: 12px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.small-button { min-height: 32px; padding: 5px 10px; font-size: 12px; }
.ghost { background: transparent; }
.recognize-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fast-save { border-color: #24222d; background: #24222d; color: #fff; font-weight: 800; }
.fast-save:hover { border-color: #15131c; background: #15131c; }

.today-page { max-width: 1380px; }
.today-order-card { display: grid; gap: 16px; }
.today-order-form { display: grid; grid-template-columns: 1.1fr 1.2fr .8fr .8fr .8fr auto; align-items: end; gap: 12px; }
.today-order-form .profit-box { min-height: 74px; padding: 12px 14px; }
.today-order-form .profit-box strong { font-size: 21px; }
.today-order-form #today-save-button { order: 1; grid-column: 1 / 2; width: min(100%, 360px); justify-self: start; }
.today-order-form .today-profit-box { order: 2; grid-column: 5 / 7; }
.today-filter { display: grid; grid-template-columns: minmax(240px,1.2fr) minmax(130px,.75fr) repeat(2,minmax(140px,.8fr)) minmax(190px,1fr) auto; align-items: end; gap: 12px; }
.inventory-filter { display: grid; grid-template-columns: minmax(260px,1.4fr) minmax(130px,.7fr) repeat(2,minmax(140px,.75fr)) auto; align-items: end; gap: 12px; }
.inventory-filter .field-wide { grid-column: auto; }
.today-summary { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 13px; }
.today-breakdown { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; }
.today-stat-list { display: grid; align-content: start; gap: 11px; }
.today-stat-list h3 { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0; font-size: 15px; }
.today-stat-list h3 small { color: var(--muted); font-size: 12px; font-weight: 650; }
.today-stat-list ul { display: grid; max-height: 230px; gap: 7px; margin: 0; padding: 0; overflow: auto; list-style: none; }
.today-stat-list li { display: flex; min-height: 42px; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 10px; background: #f7f7fb; }
.today-stat-list li span { display: grid; min-width: 0; gap: 3px; }
.today-stat-list li b { overflow-wrap: anywhere; font-size: 13px; }
.today-stat-list li small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.today-stat-list li strong { flex: 0 0 auto; color: var(--primary-dark); font-size: 15px; }
.today-stat-list .today-account-result { display: grid; gap: 2px; text-align: right; }
.today-stat-list .today-account-result em { font-style: normal; }
.today-stat-list .today-account-result small { font-size: 12px; font-weight: 800; white-space: nowrap; }
.today-stat-list li.empty { display: block; color: var(--muted); text-align: center; }
.sale-form { display: grid; grid-template-columns: 1.1fr 1.2fr .8fr .8fr .8fr auto; align-items: end; gap: 12px; }
.sale-form .profit-box { min-height: 74px; padding: 12px 14px; }
.sale-form .profit-box strong { font-size: 21px; }
.sale-form #add-sale-item { grid-column: 1 / 2; width: min(100%, 360px); justify-self: start; }
.sale-form .sale-shipping-field { grid-column: 2 / 4; }
.sale-form .sale-amount-field { grid-column: 4 / 7; }
.sale-form #sale-save-button { order: 1; grid-column: 1 / 2; width: min(100%, 360px); justify-self: start; }
.sale-items { display: grid; gap: 9px; }
.sale-item-row { display: grid; grid-template-columns: minmax(260px,1fr) 96px minmax(130px,.45fr) 74px; gap: 9px; align-items: end; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fafbff; }
.sale-product-field .autocomplete-menu { z-index: 90; right: auto; width: min(820px, calc(100vw - 320px)); max-height: min(460px, 58vh); }
.sale-product-field .autocomplete-menu button { min-height: 62px; padding: 11px 13px; }
.sale-product-field .autocomplete-menu button b { font-size: 15px; }
.sale-product-summary { display: flex; min-height: 46px; align-items: center; padding: 8px 10px; border: 1px solid #e3e2eb; border-radius: 11px; background: #fff; color: var(--muted); font-size: 12px; font-weight: 800; }
.sale-remove-item { min-height: 46px; }
.sale-items-cell { display: grid; gap: 5px; }
.sale-items-cell span { display: grid; gap: 2px; }
.record-note { display: block; margin-top: 3px; color: var(--muted); line-height: 1.45; }
.category-search { width: 100%; margin: 10px 0; }

.task-center { overflow: hidden; border: 1px solid #e2def5; border-radius: 17px; background: #fff; box-shadow: 0 5px 22px #29253d0b; }
.task-center-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: linear-gradient(120deg,#f5f2ff,#fafaff); }
.task-center-head > div { display: grid; gap: 3px; }
.task-center-head span { color: var(--muted); font-size: 12px; }
.task-center-head > strong { display: grid; min-width: 34px; height: 34px; place-items: center; border-radius: 11px; background: var(--primary); color: #fff; }
.task-center.all-clear .task-center-head > strong { background: var(--positive); }
.task-grid { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); }
.task-item { display: grid; grid-template-columns: auto 1fr auto; min-height: 64px; align-items: center; gap: 6px; padding: 10px 12px; border: 0; border-right: 1px solid var(--line); border-radius: 0; background: #fff; text-align: left; }
.task-item:last-child { border-right: 0; }
.task-item:hover { border-color: var(--line); background: #faf9ff; transform: none; }
.task-item strong { color: var(--muted); font-size: 18px; }
.task-item.needs-action strong { color: var(--negative); }
.task-item span { color: #5b5765; font-size: 12px; }
.task-item i { color: var(--muted); font-style: normal; }

.toolbar, .inline-form { display: flex; gap: 9px; }
.toolbar input { flex: 1; }
.toolbar select { width: 170px; }
.account-total-badge { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; padding: 8px 14px; border: 1px solid #dedafc; border-radius: 12px; background: #f4f1ff; color: var(--primary-dark); font-size: 13px; font-weight: 800; white-space: nowrap; }
.order-batch-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 10px 12px; border: 1px solid #e5e2f0; border-radius: 13px; background: #faf9ff; }
.order-batch-actions > span { margin-right: auto; color: var(--muted); font-size: 13px; }
.mobile-select-all { display: none; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.columns { display: grid; grid-template-columns: minmax(260px,.75fr) minmax(0,1.5fr); gap: 16px; }
.card-grid, .metrics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; }
.metrics { grid-template-columns: repeat(4,minmax(0,1fr)); }
.metric { display: grid; gap: 7px; }
.metric span { color: var(--muted); font-size: 12px; }
.metric strong { font-size: 25px; }
.mini-card { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.mini-card > div:first-child { display: grid; gap: 5px; }
.mini-card span { color: var(--muted); font-size: 12px; }
.mini-card em { color: var(--positive); font-size: 12px; font-style: normal; }
.mini-card .actions { grid-column: 1 / -1; }
.account-card { display: block; padding: 12px; }
.account-card-main { display: grid; width: 100%; gap: 10px; padding: 8px; }
.account-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.account-card-head > span { display: grid; min-width: 0; gap: 5px; }
.account-card-head b { overflow-wrap: anywhere; color: var(--text); }
.account-card-head small { color: var(--muted); }
.account-card-head em { flex: 0 0 auto; color: var(--positive); font-size: 12px; font-style: normal; }
.account-note { display: flex; align-items: flex-start; gap: 7px; margin: 0; padding: 8px 10px; border-radius: 9px; background: #f7f5ff; color: var(--text); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.account-note span { flex: 0 0 auto; color: var(--primary-dark); font-weight: 800; }
.account-stats { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 7px; }
.account-stats > span { display: grid; gap: 2px; padding: 8px 6px; border-radius: 9px; background: #f7f7fa; text-align: center; }
.account-stats b { overflow: hidden; color: var(--text); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.account-stats small { color: var(--muted); font-size: 10px; }
.account-card .actions { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 7px; padding: 5px 8px 8px; }
.account-card .actions button { min-width: 0; padding: 7px 8px; }
.select-cell { width: 38px; text-align: center; }
.select-cell input { width: 18px; min-height: 18px; cursor: pointer; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row span { display: grid; gap: 4px; }
.list-row small { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.actions button { min-height: 34px; padding: 6px 9px; font-size: 12px; }

.product-manager { display: grid; grid-template-columns: minmax(250px,330px) minmax(0,1fr); align-items: stretch; gap: 14px; }
.category-panel { position: sticky; top: 12px; display: flex; height: calc(100vh - 150px); max-height: calc(100vh - 150px); flex-direction: column; overflow: hidden; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-heading h2, .product-panel-head h2 { margin-bottom: 3px; }
.panel-heading p, .eyebrow { margin-bottom: 0; color: var(--muted); font-size: 12px; }
.count-badge { display: grid; min-width: 30px; height: 30px; place-items: center; padding: 0 8px; border-radius: 999px; background: #f0eefe; color: var(--primary-dark); font-size: 12px; font-weight: 800; }
.category-create { margin: 16px 0 14px; }
.category-nav { display: grid; gap: 5px; min-height: 0; overflow-y: auto; padding-right: 4px; }
.category-nav-item { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 3px; padding: 3px; border: 1px solid transparent; border-radius: 13px; transition: .18s ease; }
.category-nav-item:hover { background: #f8f8fb; }
.category-nav-item.active { border-color: #dcd7ff; background: #f4f2ff; box-shadow: inset 3px 0 var(--primary); }
.category-nav-item.category-dragging { z-index: 3; opacity: .68; border-color: var(--primary); background: #eeebff; box-shadow: 0 10px 28px #4637b82b; }
.category-drag-handle { width: 26px; min-height: 40px; padding: 0; border: 0; background: transparent; color: #aaa5c2; font-size: 18px; cursor: grab; touch-action: none; }
.category-drag-handle:hover { border-color: transparent; color: var(--primary); transform: none; }
.category-drag-handle:active { cursor: grabbing; }
.category-select { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 7px; min-width: 0; min-height: 46px; padding: 5px 7px; border: 0; background: transparent; text-align: left; }
.category-select:hover { border-color: transparent; transform: none; }
.category-select > span { display: grid; min-width: 0; gap: 3px; }
.category-select strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-select small { color: var(--muted); font-size: 11px; }
.category-select > b { color: #aaa5c2; font-size: 23px; font-weight: 400; }
.category-nav-item.active .category-select > b { color: var(--primary); }
.category-item-actions { display: grid; gap: 2px; opacity: 0; transition: .18s ease; }
.category-nav-item:hover .category-item-actions, .category-nav-item.active .category-item-actions { opacity: 1; }
.category-item-actions button { min-height: 26px; padding: 3px 6px; border: 0; background: transparent; font-size: 10px; }
.category-empty { padding: 24px 8px; }
.product-panel { position: sticky; top: 12px; display: flex; height: calc(100vh - 150px); max-height: calc(100vh - 150px); min-height: 520px; flex-direction: column; overflow: hidden; }
.product-panel-head { padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.product-panel-head .eyebrow { margin-bottom: 5px; color: var(--primary); font-weight: 750; }
.product-panel-head .hint { margin-bottom: 0; }
.product-create-panel { margin: 16px 0; padding: 17px; border: 1px solid #dedafc; border-radius: 15px; background: #faf9ff; }
.product-search { margin-top: 14px; }
.product-batch-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #faf9ff; }
.product-batch-bar .check { display: flex; align-items: center; gap: 8px; margin-right: auto; color: var(--primary-dark); font-weight: 750; }
.product-batch-bar .check input { width: 18px; min-height: 18px; }
.product-batch-bar > span { color: var(--muted); font-size: 13px; }
.product-batch-bar button { min-height: 36px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.form-actions button { min-width: 110px; }
.product-list { display: grid; min-height: 0; gap: 9px; margin-top: 16px; overflow-y: auto; padding-right: 2px; }
.product-row { display: grid; grid-template-columns: auto auto 56px minmax(0,1fr) auto; align-items: center; gap: 10px 12px; padding: 12px 14px 12px 8px; border: 1px solid var(--line); border-radius: 14px; transition: .18s ease; }
.product-row:hover { border-color: #d8d4f3; box-shadow: 0 5px 18px #2f29570b; }
.product-row.product-dragging { z-index: 2; opacity: .68; border-color: var(--primary); background: #f4f2ff; box-shadow: 0 10px 28px #4637b82b; }
.product-select-box { display: grid; place-items: center; width: 22px; min-height: 22px; }
.product-select-box input { width: 18px; min-height: 18px; }
.product-drag-handle { width: 32px; min-height: 50px; padding: 0; border: 0; background: transparent; color: #aaa5c2; font-size: 21px; cursor: grab; touch-action: none; }
.product-drag-handle:hover { border-color: transparent; color: var(--primary); transform: none; }
.product-drag-handle:active { cursor: grabbing; }
.product-row-main { display: grid; min-width: 0; gap: 5px; }
.product-title-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.product-title-line h3 { margin: 0; overflow-wrap: anywhere; font-size: 16px; }
.product-title-line strong { flex: 0 0 auto; color: var(--primary-dark); }
.product-row-main p, .product-row-main small { margin: 0; overflow-wrap: anywhere; color: var(--muted); font-size: 12px; }
.product-row-main small { color: #9599a4; }
.product-thumb { display: block; width: 56px; height: 56px; border: 1px solid #e4e5ec; border-radius: 12px; background: #f4f5f8; object-fit: cover; }
.product-thumb-empty { display: grid; place-items: center; color: #aaaeba; font-size: 13px; font-weight: 800; }
.today-product-cell { display: grid; grid-template-columns: 48px minmax(0,1fr); align-items: center; gap: 10px; }
.today-product-cell .product-thumb { width: 48px; height: 48px; border-radius: 10px; }
.today-product-cell > span { min-width: 0; overflow-wrap: anywhere; }
.inventory-product-cell { display: grid; grid-template-columns: 48px minmax(0,1fr); align-items: center; gap: 10px; }
.inventory-product-cell .product-thumb { width: 48px; height: 48px; border-radius: 10px; }
.inventory-product-cell > span { min-width: 0; overflow-wrap: anywhere; }
.product-image-preview { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fafbff; color: var(--muted); }
.product-image-preview img { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; }
.product-empty { display: grid; min-height: 260px; place-content: center; gap: 7px; padding: 32px; border: 1px dashed #dfe0e8; border-radius: 15px; color: var(--muted); text-align: center; }
.product-empty b { color: var(--ink); }
.product-empty span { font-size: 12px; }

.bulk-import-card .section-head { margin-bottom: 15px; }
.bulk-import-card .section-head p, #failed-import-card .section-head p { margin-bottom: 0; color: var(--muted); font-size: 12px; }
.bulk-import-form { display: grid; grid-template-columns: minmax(220px,.8fr) minmax(280px,1.35fr) auto; align-items: end; gap: 12px; }
.bulk-file-picker { position: relative; display: block; min-width: 0; }
.bulk-file-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.bulk-file-picker > span { display: grid; min-height: 44px; align-content: center; gap: 2px; padding: 8px 13px; border: 1px dashed #c8c3f4; border-radius: 11px; background: #faf9ff; color: var(--primary-dark); cursor: pointer; }
.bulk-file-picker small { color: var(--muted); font-size: 11px; }
.message.done { background: #eef9f5; color: var(--positive); }
.message.warning { background: #fff7e8; color: var(--warning); }
.message.error { background: #fff0f1; color: var(--negative); }
.failed-import-list { display: grid; gap: 11px; margin-top: 15px; }
.failed-import-item { display: grid; grid-template-columns: 92px minmax(160px,.7fr) minmax(350px,1.3fr); align-items: center; gap: 13px; padding: 12px; border: 1px solid #f0d9b3; border-radius: 14px; background: #fffaf2; }
.failed-image { overflow: hidden; width: 92px; height: 76px; min-height: 0; padding: 0; border-radius: 10px; background: #222; }
.failed-image img { width: 100%; height: 100%; object-fit: cover; }
.failed-import-info { display: grid; min-width: 0; gap: 5px; }
.failed-import-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.failed-import-info small { color: var(--warning); }
.failed-import-item form { display: grid; grid-template-columns: minmax(150px,1fr) minmax(130px,.8fr) auto; gap: 8px; }
.failed-import-item form button { white-space: nowrap; }
.package-toolbar { margin-top: 2px; }
.bulk-details { border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.bulk-details > summary { display: flex; min-height: 52px; align-items: center; justify-content: space-between; padding: 12px 16px; color: var(--primary-dark); font-weight: 800; cursor: pointer; }
.bulk-details > summary small { color: var(--muted); font-weight: 500; }
.bulk-details .bulk-import-card { border: 0; border-top: 1px solid var(--line); border-radius: 0 0 15px 15px; box-shadow: none; }
.scan-feedback { padding: 18px; font-size: 16px; }
.scan-success { border: 2px solid #74d9b5; background: #eafaf4; }
.scan-duplicate { border: 2px solid #f0c56a; background: #fff7e8; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
th { color: var(--muted); font-size: 12px; font-weight: 650; white-space: nowrap; }
td > small, td b + small { display: block; margin-top: 5px; color: var(--muted); }
.today-account-name { display: block; font-weight: 750; }
.today-account-note { max-width: 220px; overflow-wrap: anywhere; color: #565c68; line-height: 1.45; }
.order-main, .finance-cell, .package-account { display: grid; min-width: 0; gap: 5px; }
.copy-link { min-height: 0; justify-content: flex-start; padding: 0; overflow: hidden; border: 0; background: transparent; color: var(--text); font-weight: 800; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.copy-link:hover { border: 0; background: transparent; color: var(--primary); transform: none; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
.badge { display: inline-flex; width: fit-content; align-items: center; padding: 3px 7px; border-radius: 999px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.success-badge { background: #e8f8f2; color: var(--positive); }
.warning-badge { background: #fff5df; color: #a56c00; }
.danger-badge { background: #fff0f2; color: var(--negative); }
.neutral-badge { background: #f0f1f5; color: var(--muted); }
.order-count-badge { background: #eeeafe; color: var(--primary-dark); font-size: 11px; }
.history-image-badge { background: #f0f1f5; color: var(--muted); font-size: 11px; }
.package-orders { display: grid; width: fit-content; gap: 5px; }
#page-orders table { table-layout: fixed; min-width: 850px; }
#page-orders th:nth-child(1) { width: 42px; }
#page-orders th:nth-child(2) { width: 23%; }
#page-orders th:nth-child(3) { width: 18%; }
#page-orders th:nth-child(4) { width: 22%; }
#page-orders th:nth-child(5) { width: 18%; }
#page-orders th:nth-child(6) { width: 150px; }
#page-inventory table { min-width: 860px; }
.inventory-click-row { cursor: pointer; transition: .16s ease; }
.inventory-click-row:hover { background: #faf9ff; }
.inventory-click-row:focus-visible { outline: 3px solid #6d5dfc26; outline-offset: -3px; }
.inventory-detail-head { display: grid; gap: 4px; margin-bottom: 13px; }
.inventory-detail-head h3 { margin: 0; font-size: 17px; }
.inventory-detail-head p { margin: 0; color: var(--muted); font-size: 13px; }
.inventory-detail-filter { display: grid; grid-template-columns: minmax(130px,.75fr) minmax(150px,1fr) minmax(150px,1fr) auto; align-items: end; gap: 10px; margin-bottom: 13px; padding: 12px; border: 1px solid #ebeaf4; border-radius: 13px; background: #fafbff; }
.inventory-detail-filter button { min-height: 44px; }
.inventory-detail-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin-bottom: 14px; }
.inventory-detail-summary span { display: grid; gap: 5px; padding: 12px; border: 1px solid #ebeaf4; border-radius: 12px; background: #fafbff; }
.inventory-detail-summary small { color: var(--muted); font-size: 12px; }
.inventory-detail-summary b { font-size: 18px; }
.inventory-purchase-list { display: grid; gap: 8px; }
.inventory-purchase-item { display: grid; grid-template-columns: minmax(130px,.9fr) minmax(170px,1fr) minmax(150px,.9fr) minmax(110px,.7fr); gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.inventory-purchase-item div { display: grid; min-width: 0; gap: 4px; }
.inventory-purchase-item b, .inventory-purchase-item span { overflow-wrap: anywhere; }
.inventory-purchase-item small { color: var(--muted); font-size: 12px; }
#page-sales table { min-width: 850px; }
.sticky-actions { position: sticky; right: 0; z-index: 2; background: #fff; box-shadow: -8px 0 12px #fff; }
.pagination-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; padding: 10px 2px 0; color: var(--muted); font-size: 13px; }
.pagination-bar > span { margin-right: auto; }
.pagination-bar label { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); font-weight: 650; }
.pagination-bar select { width: 92px; min-height: 38px; padding: 7px 9px; border-radius: 10px; }
.pagination-bar button { min-height: 38px; }
.announcement-list { display: grid; gap: 14px; }
.announcement-card .section-head { align-items: flex-start; }
.announcement-card .section-head small { display: block; margin-top: 6px; color: var(--muted); }
.announcement-products { display: grid; grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); gap: 10px; margin-top: 12px; }
.announcement-product { display: grid; grid-template-columns: 58px minmax(0,1fr); align-items: center; gap: 10px; min-height: 76px; padding: 9px; border: 1px solid var(--line); border-radius: 12px; background: #fafbfe; }
.announcement-product img, .announcement-product .product-placeholder { width: 58px; height: 58px; border-radius: 10px; object-fit: cover; }
.announcement-product .product-placeholder { display: grid; place-items: center; background: #eef0f6; color: var(--muted); font-size: 12px; }
.announcement-product b { display: block; overflow-wrap: anywhere; }
.announcement-product small { display: block; margin-top: 4px; color: var(--muted); }

.more-title { margin-bottom: -2px; }
.more-title select { width: 150px; }
.ranking-card { padding-top: 16px; }
.ranking-list { display: grid; margin-top: 12px; }
.ranking-list > div { display: grid; grid-template-columns: 26px minmax(0,1fr) auto auto; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.ranking-list > div > b { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 8px; background: #f0edff; color: var(--primary); }
.ranking-list small { color: var(--muted); }
.ranking-list strong { color: var(--positive); }
.export-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.export-grid select, .export-grid button { grid-column: 1 / -1; }
.recycle-list { display: grid; margin-top: 12px; }
.recycle-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.recycle-toolbar .check { margin-right: auto; }
.recycle-item { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.recycle-item > span { display: grid; gap: 4px; }
.recycle-item small { color: var(--muted); }

.scan-card { position: relative; overflow: hidden; text-align: center; }
.scan-icon { display: grid; width: 54px; height: 54px; margin: 0 auto 9px; place-items: center; border-radius: 17px; background: #6d5dfc12; color: var(--primary); font-size: 30px; }
.scan-card p { margin-bottom: 16px; }
.scan-card form { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 9px; max-width: 680px; margin: auto; }
.scan-card input { min-height: 52px; font-size: 19px; letter-spacing: .04em; }
.message { display: grid; gap: 4px; margin-top: 13px; padding: 11px 13px; border-radius: 12px; background: #f4f4f8; color: var(--muted); font-size: 13px; }
.message:empty { display: none; }
.bind-panel { max-width: 680px; margin: 16px auto 0; padding: 16px; border: 1px solid #dedbea; border-radius: 15px; background: #fbfaff; text-align: left; }
.bind-panel p { margin-bottom: 10px; }
.candidate-list { display: grid; gap: 8px; max-height: 330px; overflow-y: auto; }
.candidate { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: #fff; cursor: pointer; }
.candidate input { width: 18px; min-height: 18px; }
.candidate span { display: grid; gap: 4px; }
.candidate small { color: var(--muted); font-weight: 400; }
.bind-panel > button { width: 100%; margin-top: 12px; }

.edit-item-row { display: grid; grid-template-columns: 1.7fr 1fr 80px 120px auto; gap: 8px; padding: 10px; margin-bottom: 9px; border: 1px solid var(--line); border-radius: 12px; background: #fafafd; }
.edit-item-row button { align-self: end; }
.modal { width: min(720px,calc(100vw - 28px)); max-height: 90vh; padding: 0; border: 0; border-radius: 18px; box-shadow: 0 25px 90px #15131f55; }
.modal.wide-modal { width: min(1080px,calc(100vw - 28px)); }
.modal::backdrop { background: #19172399; backdrop-filter: blur(3px); }
.modal > form { display: block; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; }
.modal-head button { min-height: 32px; border: 0; font-size: 24px; }
.modal-body { max-height: calc(90vh - 135px); overflow: auto; padding: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 20px; border-top: 1px solid var(--line); }
.image-modal { width: min(900px,calc(100vw - 28px)); }
.image-gallery { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; max-height: 78vh; overflow: auto; padding: 16px; }
.image-gallery figure { margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; }
.image-gallery img { display: block; width: 100%; height: auto; max-height: 68vh; object-fit: contain; background: #222; }
.image-gallery figcaption { padding: 8px 11px; color: var(--muted); font-size: 12px; }
#toast { position: fixed; z-index: 1000; right: 20px; bottom: 20px; max-width: 420px; padding: 12px 16px; border-radius: 12px; background: #26242f; color: #fff; opacity: 0; pointer-events: none; transform: translateY(8px); transition: .2s; }
#toast.show { opacity: 1; transform: translateY(0); }

/* Brand refresh: UI-only theme aligned with the supplied dashboard reference. */
:root {
  --primary: #2463eb;
  --primary-dark: #174fc8;
  --ink: #10213b;
  --muted: #6f809d;
  --line: #dfe7f2;
  --panel: #ffffff;
  --bg: #f5f7fb;
  --positive: #20a071;
  --warning: #c17a18;
  --negative: #dc5360;
  --radius: 12px;
}
body { background: var(--bg); color: var(--ink); }
button, .button { border-radius: 9px; }
button:hover, .button:hover { border-color: #b7c8e2; transform: translateY(-1px); }
input, select, textarea { border-color: #d8e2ef; border-radius: 9px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px #2463eb1c; }
.shell { grid-template-columns: 230px minmax(0, 1fr); }
aside { padding: 27px 16px 22px; border-right: 1px solid #dfe7f2; background: #fff; color: #253754; }
.brand { gap: 11px; padding: 1px 9px 31px; }
.brand > span { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(145deg,#4a8cf7,#2e6ce7); color: #fff; font-size: 0; box-shadow: 0 6px 13px #2463eb2e; }
.brand > span::after { width: 18px; height: 3px; border-radius: 3px; background: #fff; content: ""; }
.brand strong { color: #142744; font-size: 17px; letter-spacing: .02em; }
.brand small { color: #7488a7; font-size: 11px; }
nav { gap: 6px; }
nav button { min-height: 49px; padding: 8px 12px; border-radius: 9px; color: #476181; }
nav button i { width: 25px; height: 25px; border-radius: 7px; background: transparent; color: #7a91b1; }
nav button.active { background: #eaf2ff; color: #2160dc; font-weight: 750; }
nav button.active i { background: transparent; color: #2463eb; }
main { padding: 24px 32px 56px; }
header { max-width: 1620px; margin-bottom: 25px; }
header h1 { color: #10213b; font-size: 27px; letter-spacing: -.02em; }
header p { color: #6c83a4; }
.header-actions { gap: 11px; }
.current-user { border-color: #dce5f1; color: #1d3558; }
.status-dot { color: #7185a2; }
.page { max-width: 1620px; }
.page.active { gap: 18px; }
.card { border-color: #dfe7f2; border-radius: 13px; box-shadow: 0 4px 14px #2f5b9810; }
.section-head h2, .entry-hero h2 { color: #132846; }
.section-head p, .entry-hero p { color: #7387a5; }
.primary { border-color: var(--primary); background: var(--primary); box-shadow: 0 5px 12px #2463eb24; }
.primary:hover { border-color: var(--primary-dark); background: var(--primary-dark); }
.task-center, .photo-card, .success-card { border-color: #dfe7f2; box-shadow: 0 4px 14px #2f5b980d; }
.task-center-head { background: linear-gradient(120deg,#eef5ff,#f8fbff); }
.task-center-head > strong, .step-number { background: var(--primary); }
.task-item:hover { background: #f5f9ff; }
.photo-picker { background: linear-gradient(145deg,#f0f6ff,#fbfdff); }
.photo-picker b { color: var(--primary); }
.profit-box { background: #15315d; }
.advanced summary { color: var(--primary); }
.account-total-badge, .count-badge { border-color: #cfe0fb; background: #edf4ff; color: #2560c9; }
.order-batch-actions { border-color: #dfe7f2; background: #f7faff; }
.today-stat-list li { background: #f5f8fd; }
.category-nav-item.active { border-color: #cfe0fb; background: #edf4ff; box-shadow: inset 3px 0 var(--primary); }
.category-nav-item:hover { background: #f7faff; }
.category-select > b, .category-drag-handle { color: #91a4bf; }
.product-create-panel { border-color: #cfe0fb; background: #f5f9ff; }
#toast { background: #18345f; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 190px minmax(0,1fr); }
  main { padding: 20px 18px 40px; }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .columns { grid-template-columns: 1fr; }
  .edit-item-row { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
