:root {
  font-family: "Inter", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  color: #152937;
  background: #f3f6f7;
  font-synthesis: none;
  font-size: 14px;
  --ink: #152937;
  --muted: #596c76;
  --line: #e2e9eb;
  --green: #11654f;
  --soft: #e7f3ee;
  --amber: #825316;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid #188668; outline-offset: 3px; }
.shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 28px 17px; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 7px; margin-bottom: 36px; white-space: nowrap; }
.mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--green); color: white; font-size: 24px; font-weight: 740; }
.brand strong { display: block; letter-spacing: .04em; font-size: 16px; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
nav { display: grid; gap: 5px; }
nav button { text-align: left; background: transparent; border: 0; color: var(--muted); border-radius: 8px; padding: 11px 12px; white-space: nowrap; }
nav button span { display: inline-block; text-align: center; margin-right: 9px; width: 18px; }
nav button:hover, nav button[aria-current="page"] { color: var(--green); background: var(--soft); }
nav button[aria-current="page"] { font-weight: 700; }
main { width: 100%; max-width: 1560px; padding: 34px clamp(20px, 3vw, 50px); margin: 0 auto; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 29px; line-height: 1.25; letter-spacing: -.035em; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
.sub { color: var(--muted); margin-top: 7px; line-height: 1.55; font-size: 13px; }
.pagehead { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 24px; }
.actions, .filters, .rowactions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn { background: white; color: var(--ink); border: 1px solid #d9e3e5; border-radius: 8px; padding: 9px 13px; font-weight: 650; white-space: nowrap; }
.btn:hover { border-color: #8aa9a0; background: #f7faf8; }
.primary { background: var(--green); border-color: var(--green); color: white; }
.primary:hover { background: #0c523e; color: white; }
.quiet { background: transparent; border: 0; color: var(--green); font-weight: 650; padding: 5px 3px; }
.quiet:hover { text-decoration: underline; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 20px; }
.metric { min-width: 0; border: 1px solid var(--line); border-radius: 11px; background: white; padding: 16px; text-align: left; color: var(--ink); }
.metric:first-child { background: #e9f4ef; border-color: #d3e9dd; }
.metric label { font-size: 13px; color: #435b60; display: block; pointer-events: none; }
.metric strong { display: block; margin: 7px 0 5px; font-variant-numeric: tabular-nums; font-size: clamp(19px, 2.1vw, 31px); letter-spacing: -.045em; overflow-wrap: anywhere; }
.metric small { display: block; color: var(--muted); line-height: 1.5; }
.metric-amount { display: block; margin-top: 4px; }
.metric-amount > span, .metric-amount b, .metric-missing { white-space: nowrap; }
.metric-amount b { color: var(--ink); font-variant-numeric: tabular-nums; }
.metric-missing { display: block; }
.metric.alert strong { color: var(--amber); }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.panel + .panel { margin-top: 18px; }
.panelhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 17px; }
.tablewrap { overflow: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; white-space: nowrap; font-variant-numeric: tabular-nums; }
th, td { padding: 11px 13px; }
th:first-child, td:first-child { padding-left: 17px; }
th { font-size: 12px; font-weight: 600; color: #536971; background: #f7f9fa; }
td { border-top: 1px solid #eaf0f1; }
tbody tr:hover { background: #fcfdfd; }
.item { display: flex; align-items: center; gap: 9px; min-width: 115px; }
.item img, .placeholder { width: 37px; height: 37px; border-radius: 7px; object-fit: cover; background: #edf2f2; }
.placeholder { display: grid; place-items: center; color: #526f68; font-weight: 750; font-size: 16px; }
.item strong, .item small { display: block; max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
.item small, .muted { color: var(--muted); font-size: 12px; }
.pill { display: inline-block; padding: 4px 8px; border-radius: 20px; color: var(--green); background: var(--soft); font-size: 12px; }
.pill.warn { background: #fff2db; color: var(--amber); }
.pill.neutral { background: #edf2f5; color: #456270; }
.empty { text-align: center; padding: 47px 16px; }
.empty p { margin: 8px 0 15px; color: var(--muted); font-size: 13px; }
.loading { color: var(--muted); padding-top: 12px; }
input, select, textarea { width: 100%; min-width: 0; background: #fff; color: var(--ink); border: 1px solid #d5e0e3; padding: 9px 10px; border-radius: 7px; }
.filters input { width: min(42vw, 210px); }
.filters select { width: auto; }
input[type="month"] { width: auto; }
dialog { width: min(510px, calc(100% - 22px)); max-height: calc(100dvh - 30px); border: 1px solid var(--line); border-radius: 13px; padding: 0; color: var(--ink); box-shadow: 0 18px 65px #162d3a42; }
dialog::backdrop { background: #15293770; }
.modal-head, .modal-foot { padding: 16px 21px; display: flex; gap: 10px; justify-content: space-between; align-items: center; }
.modal-head { border-bottom: 1px solid var(--line); }
.modal-foot { border-top: 1px solid var(--line); justify-content: end; }
.modal-body { padding: 17px 21px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.fields label { display: grid; gap: 5px; align-content: start; font-size: 13px; font-weight: 600; }
.fields .wide { grid-column: 1 / -1; }
.fields textarea { resize: vertical; line-height: 1.5; font-weight: 400; }
.product-picker { display: grid; gap: 6px; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 10px 0 0; }
.error { color: #a3282b; font-size: 13px; margin-top: 12px; }
#toast { position: fixed; right: 22px; bottom: 22px; border-radius: 9px; background: #153e32; color: white; padding: 11px 16px; box-shadow: 0 3px 12px #172e3840; }
@media (max-width: 1040px) { .shell { grid-template-columns: 177px minmax(0, 1fr); } .sidebar { padding-inline: 11px; } .pagehead { align-items: flex-start; } }
@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { padding: 12px 13px 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { margin-bottom: 10px; padding: 0; }
  .mark { width: 32px; height: 32px; font-size: 20px; }
  nav { grid-template-columns: repeat(3, 1fr); }
  nav button { text-align: center; padding: 8px 4px; }
  nav button span { margin-right: 3px; }
  main { padding: 20px 12px; }
  .pagehead { flex-wrap: wrap; margin-bottom: 15px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 13px; }
  .metric { padding: 12px; }
  .panelhead { flex-wrap: wrap; padding-inline: 12px; }
}

.actions select { width: auto; max-width: 100%; }

.stock-metrics { grid-template-columns: repeat(6,minmax(0,1fr)); }
.stock-metrics .metric { display: flex; flex-direction: column; justify-content: flex-start; padding: 14px; }
.stock-metrics .metric > :is(label, h2) { line-height: 1.4; }
.stock-metrics .metric > strong { line-height: 1.2; }
.metrics button:hover { border-color: #91b9ab; background: #f3f9f6; }
.metrics .metric strong { letter-spacing: -.035em; }
.panelhead .filters { margin-left: auto; }
.filters input[type="search"] { width: clamp(145px,17vw,215px); }
.actions select, .filters select { max-width: 210px; }
.rangebar { border-top: 1px solid var(--line); padding: 11px 17px; }
.rangebar.standalone { background: #fff; border: 1px solid var(--line); border-radius: 10px; margin: -8px 0 16px; }
.date-range { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); }
.date-range label { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.date-range input { width: auto; padding-block: 7px; }
.history-metrics { padding: 12px 16px 0; margin-bottom: 12px; }
.history-metrics .metric { padding: 11px 14px; }
.history-metrics .metric strong { font-size: clamp(18px,2vw,24px); }
th, td { padding: 9px 11px; }
.item { min-width: 85px; gap: 8px; }
.item strong { max-width: 150px; }
.item img, .placeholder { width: 32px; height: 32px; flex: 0 0 32px; }
.sku, .shop-cell { display: block; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.sku { color: var(--ink); }
.shop-cell { color: var(--muted); }
.product-picker { gap: 5px; }
.picker-input { position: relative; }
.picker-input input { padding: 10px 32px; background: #fff; }
.picker-input input[aria-expanded="true"] { border-color: #6fa899; }
.search-mark, .picker-arrow { position: absolute; pointer-events: none; top: 50%; }
.search-mark { width: 12px; height: 12px; border: 1.5px solid #678178; border-radius: 50%; left: 11px; transform: translateY(-58%); }
.search-mark::after { content: ""; width: 5px; height: 1.5px; background: #678178; position: absolute; right: -4px; bottom: -2px; transform: rotate(45deg); }
.picker-arrow { width: 7px; height: 7px; right: 14px; border: solid #526f68; border-width: 0 1.5px 1.5px 0; transform: translateY(-75%) rotate(45deg); }
.picker-menu { border: 1px solid var(--line); border-radius: 8px; background: white; overflow: hidden; box-shadow: 0 6px 16px #193c3116; }
.picker-menu ul { list-style: none; margin: 0; padding: 3px; max-height: 176px; overflow: auto; }
.picker-menu li { cursor: pointer; border-radius: 5px; padding: 6px 9px; display: flex; align-items: center; gap: 10px; }
.picker-menu li strong, .picker-menu li small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-menu li small, .picker-note { color: var(--muted); font-size: 12px; }
.picker-menu li:hover, .picker-menu li[aria-selected="true"] { background: var(--soft); color: var(--green); }
.picker-note { padding: 6px 12px 9px; }
@media (max-width: 1080px) {
  .stock-metrics { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 760px) {
  nav { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .stock-metrics, .history-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .panelhead .filters { margin-left: 0; }
  .rangebar { padding-inline: 12px; }
  .date-range { column-gap: 7px; }
}
@media (max-width: 390px) {
  nav button span { display: none; }
  .date-range > span { display: none; }
  .date-range label { width: 100%; justify-content: space-between; }
}

.sidebar { display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; overflow: auto; }
.audit-nav { margin-top: auto; padding-top: 15px; border-top: 1px solid var(--line); }
.main-nav { margin-bottom: 22px; }
.overview-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; align-items: start; margin-top: 18px; }
.overview-grid .panel { margin-top: 0; min-width: 0; }
.overview-grid .tablewrap { border-top: 1px solid var(--line); }
.result-summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; margin: 0; padding: 12px 17px 14px; border-top: 1px solid var(--line); }
.result-summary > div { padding: 10px 13px; border: 1px solid var(--line); border-radius: 8px; background: #f7f9fa; }
.result-summary dt { color: var(--muted); font-size: 12px; }
.result-summary dd { margin: 4px 0 0; font-size: clamp(19px,2vw,27px); font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.result-summary dd small { font-size: 12px; font-weight: 600; }
.result-summary .result-value { background: #e9f4ef; border-color: #d3e9dd; }
.result-summary .result-pending { background: #fff8eb; border-color: #f3e5cd; }
.result-pending dd { color: var(--amber); }
@media (max-width: 480px) {
  .result-summary { gap: 6px; padding-inline: 10px; }
  .result-summary > div { padding-inline: 8px; }
}
.audit-details { min-width: 200px; max-width: 380px; white-space: normal; overflow-wrap: anywhere; line-height: 1.55; }
.list-footer { display: flex; justify-content: center; padding: 14px; }
.danger-text { color: #a12f33; }
.danger-button { background: #a12f33; color: #fff; border-color: #a12f33; }
.danger-button:hover { background: #85252a; color: #fff; border-color: #85252a; }
@media (max-width: 760px) {
  .overview-grid { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .sidebar { position: static; height: auto; }
  .main-nav { grid-template-columns: repeat(3,minmax(0,1fr)); margin-bottom: 7px; }
  .audit-nav { display: flex; justify-content: flex-end; padding-top: 4px; }
}

.task-card h2 { color: #435b60; font-size: 13px; font-weight: 400; }
.overview-reminders { display: grid; }
.overview-reminders button { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 5px; align-items: center; padding: 3px 0; border: 0; background: transparent; color: var(--ink); text-align: left; font-size: 12px; }
.overview-reminders button + button { border-top: 1px solid var(--line); }
.overview-reminders button:hover { background: transparent; color: var(--green); text-decoration: underline; }
.metric .overview-reminders strong { margin: 0; color: var(--amber); font-size: 12px; white-space: nowrap; letter-spacing: normal; }
.trend-scroll { overflow-x: auto; }
.trend-columns { display: grid; grid-template-columns: repeat(30,minmax(0,1fr)); min-width: 970px; gap: 4px; padding: 24px 16px 14px; }
.trend-day { display: grid; grid-template-rows: 105px auto; gap: 7px; text-align: center; color: var(--muted); font-size: 11px; }
.trend-track { position: relative; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to top,transparent 0,transparent 32%,#eef3f1 32%,#eef3f1 33%); display: flex; align-items: flex-end; justify-content: center; }
.trend-bar { position: relative; width: min(64%,36px); background: #5da48d; border-radius: 5px 5px 0 0; min-height: 2px; }
.trend-day:last-child .trend-bar { background: #18795e; }
.trend-bar strong { position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); color: var(--ink); white-space: nowrap; }

.overview-scroll { --summary-header: 36px; --summary-row: 48px; }
.overview-scroll.rows-6 { max-height: calc(1px + var(--summary-header) + var(--summary-row) * 6); }
.overview-scroll.rows-8 { max-height: calc(1px + var(--summary-header) + var(--summary-row) * 8); }
.overview-scroll table { border-collapse: separate; border-spacing: 0; }
.overview-scroll th { position: sticky; top: 0; z-index: 1; height: var(--summary-header); padding-block: 6px; }
.overview-scroll td { height: var(--summary-row); padding-block: 5px; }
.overview-scroll:focus-visible, .trend-scroll:focus-visible { outline: 2px solid #188668; outline-offset: -2px; }
.product-thumbnail { display: block; width: 32px; height: 32px; flex: 0 0 auto; border-radius: 7px; object-fit: cover; background: #edf2f2; }
.product-thumbnail.placeholder { display: grid; }
.team-shops { display: flex; flex-wrap: wrap; gap: 10px 16px; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 7px; }
.fields .team-shops label { display: flex; align-items: center; gap: 6px; font-weight: 400; }
.team-shops input { width: auto; margin: 0; }
.team-submit { margin-top: 12px; }
#employee-session { font-size: 12px; color: var(--muted); }
#employee-session a { color: var(--green); }
a.btn { display: inline-block; text-decoration: none; }
.photo-trigger { flex: none; padding: 0; border: 0; border-radius: 7px; background: transparent; cursor: zoom-in; }
.photo-trigger:hover { box-shadow: 0 0 0 2px #8aa9a0; }
#photo-preview { width: min(810px,calc(100% - 22px)); }
#photo-preview::backdrop { background: #152937a6; }
.photo-preview-body { padding: clamp(12px,3vw,22px); text-align: center; }
.photo-preview-body img { max-width: 100%; max-height: min(720px,calc(100dvh - 140px)); vertical-align: middle; }
.picker-option-text { display: grid; min-width: 0; gap: 2px; }
.selected-product, .batch-product { display: flex; align-items: center; gap: 12px; min-width: 0; }
.selected-product[hidden] { display: none; }
.selected-product { padding: 9px 11px; margin-top: 3px; border-radius: 9px; background: #f2f7f5; border: 1px solid #dcebe5; }
.selected-product .product-thumbnail { width: 57px; height: 57px; }
.selected-product > div, .batch-product > div { display: grid; min-width: 0; gap: 5px; }
.selected-product strong, .batch-product strong { overflow-wrap: anywhere; }
.selected-product span:not(.placeholder), .batch-meta { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.selected-product .selected-stock { margin-left: auto; text-align: right; white-space: nowrap; }
dialog:has(.batch-detail) { width: min(620px,calc(100% - 22px)); }
.batch-detail { display: grid; gap: 19px; padding: 21px 24px 24px; }
.batch-product .product-thumbnail { width: 54px; height: 54px; }
.batch-product > div { flex: 1; }
.batch-product strong { font-size: 16px; }
.batch-product .pill { align-self: flex-start; white-space: nowrap; }
.batch-meta { display: flex; flex-wrap: wrap; gap: 3px 13px; }
.batch-cost { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px; margin: 0; }
.batch-cost > div { padding: 11px 14px; border-radius: 9px; background: #f5f8f7; border: 1px solid var(--line); }
.batch-cost dt { color: var(--muted); font-size: 12px; }
.batch-cost dd { margin: 4px 0 0; color: var(--green); font-size: clamp(17px,3vw,23px); font-weight: 700; overflow-wrap: anywhere; }
.batch-note { min-width: 0; }
.batch-note p { margin-top: 6px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.batch-timeline { display: grid; margin: 8px 0 0; padding: 0; list-style: none; }
.batch-timeline li { position: relative; display: grid; grid-template-columns: minmax(34px,1fr) auto minmax(54px,.7fr); align-items: center; gap: 12px; padding: 10px 0 10px 17px; }
.batch-timeline li::before { content: ""; position: absolute; left: 1px; top: 50%; transform: translateY(-50%); width: 7px; height: 7px; border-radius: 50%; background: #44947c; }
.batch-timeline li:not(:last-child)::after { content: ""; position: absolute; left: 4px; width: 1px; height: calc(100% - 9px); top: calc(50% + 5px); background: #dcebe5; }
.batch-timeline time { color: var(--muted); font-variant-numeric: tabular-nums; }
.batch-timeline li > span { text-align: right; font-weight: 650; }
@media (max-width: 480px) {
  .batch-detail { gap: 15px; padding: 16px; }
  .batch-cost > div { padding-inline: 9px; }
  .selected-product { gap: 8px; }
  .selected-product .product-thumbnail { width: 49px; height: 49px; }
}
