:root {
  --green: #183b2b;
  --mint: #dbebdf;
  --lime: #c9de78;
  --bg: #f3f5f1;
  --ink: #233028;
  --muted: #788278;
  --line: #e2e7de;
  --red: #a4433c;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font:
    14px "Microsoft YaHei",
    "PingFang SC",
    Arial,
    sans-serif;
  color: var(--ink);
  background: var(--bg);
}
button,
input,
select {
  font: inherit;
}
button,
a {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
a {
  color: inherit;
  text-decoration: none;
}
button,
.button {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  padding: 10px 15px;
  border-radius: 7px;
  white-space: nowrap;
  font-size: 12px;
}
button:hover,
.button:hover {
  border-color: #9aaf91;
}
.primary {
  background: var(--green);
  color: white;
  border-color: var(--green);
}
.primary:hover {
  background: #28553e;
}
.dark {
  background: #dae9c6;
  border-color: #dae9c6;
  color: #2d4620;
}
.full {
  width: 100%;
  margin-top: 10px;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
  line-height: 1.9;
}
.error {
  font-size: 12px;
  color: var(--red);
  white-space: pre-line;
  line-height: 1.8;
  min-height: 0;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--muted);
  text-transform: uppercase;
}
.mark {
  display: grid;
  place-items: center;
  background: var(--lime);
  color: var(--green);
  width: 42px;
  height: 44px;
  font-weight: bold;
  font-size: 25px;
  border-radius: 8px;
}
.auth {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 35px;
  background: var(--bg);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 30px;
}
.auth-brand small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
  margin-top: 6px;
}
.auth-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  width: 420px;
  max-width: 100%;
  padding: 36px;
  box-shadow: 0 20px 60px #1733240a;
}
.auth-card h1 {
  font-size: 26px;
  margin: 22px 0 12px;
}
.auth-foot {
  font-size: 11px;
  color: var(--muted);
  margin-top: 25px;
}
label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  margin: 16px 0;
}
label input,
label select {
  display: block;
  margin-top: 9px;
}
input,
select {
  border: 1px solid #dbe1d5;
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
  background: white;
  min-width: 0;
  max-width: 100%;
  width: 100%;
}
input:focus,
select:focus {
  outline: 2px solid #a2b891;
  outline-offset: 0;
}
input[type="checkbox"] {
  width: auto;
}
.workspace {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  background: var(--green);
  color: #dde7dc;
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.logo {
  display: flex;
  align-items: center;
  gap: 13px;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 2px;
}
.logo small {
  display: block;
  font-size: 8px;
  letter-spacing: 1px;
  color: #9fb49f;
  font-weight: 400;
  margin-top: 5px;
}
.nav-label {
  font-size: 9px;
  letter-spacing: 2px;
  color: #8eaa91;
  margin: 43px 13px 17px;
}
nav {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
nav button {
  border: 0;
  background: transparent;
  color: #b8c9b9;
  text-align: left;
  padding: 13px 14px;
  font-size: 18px;
  display: flex;
  gap: 13px;
  align-items: center;
}
nav button span {
  font-size: 12px;
}
nav button.active {
  background: #2c503b;
  color: #e5f2df;
}
nav button:hover {
  background: #254a35;
}
.sidebar-bottom {
  margin-top: auto;
  padding: 25px 12px 0;
}
.connection {
  font-size: 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.connection i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e1b865;
}
.connection i.online {
  background: #a5ce86;
}
.sidebar-bottom p {
  font-size: 10px;
  line-height: 2;
  color: #90ab93;
}
.sidebar-bottom button {
  border: 1px solid #3c5c43;
  background: transparent;
  color: #c9d8c9;
  font-size: 10px;
}
.main {
  padding: 32px 38px;
  max-width: 1700px;
  width: 100%;
  margin: auto;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
header h1 {
  font-size: 27px;
  font-weight: 700;
  margin: 9px 0 12px;
}
header .eyebrow {
  margin-top: 0;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}
.badge {
  padding: 4px 8px;
  border-radius: 4px;
  background: #e1e9da;
  font-size: 10px;
}
.icon-button {
  font-size: 19px;
  padding: 5px 11px;
}
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 15px 0 29px;
}
.toolbar > p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}
.toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
}
.stat {
  padding: 23px 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  position: relative;
}
.stat:first-child {
  background: var(--green);
  color: #f6f8ee;
  border-color: var(--green);
}
.stat p {
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 14px;
}
.stat:first-child p {
  color: #b1c5ae;
}
.stat strong {
  font-size: 29px;
  letter-spacing: -1px;
  display: block;
}
.stat small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 13px;
}
.stat:first-child small {
  color: #a6c297;
}
.stat .unit {
  font-size: 12px;
  letter-spacing: 0;
  margin-left: 6px;
  font-weight: 400;
}
.finance {
  margin: 32px 0;
}
.section-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}
.section-label h2 {
  font-size: 15px;
  margin: 0;
}
.section-label > span {
  font-size: 10px;
  color: var(--muted);
}
.finance-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.finance-stats .stat {
  background: #eef2e7;
  color: var(--ink);
  padding: 18px;
  border-color: var(--line);
}
.finance-stats .stat strong {
  font-size: 23px;
}
.finance-stats .stat p,
.finance-stats .stat small {
  color: var(--muted);
}
.overview-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  margin: 25px 0;
}
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px;
  margin-bottom: 20px;
}
.overview-grid .panel {
  margin-bottom: 0;
}
.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: center;
  margin-bottom: 18px;
}
.panel-heading h2 {
  font-size: 15px;
  margin: 0;
}
.panel-heading > div {
  display: flex;
  gap: 8px;
}
.link {
  border: 0;
  background: transparent;
  font-size: 11px;
  color: #577048;
  padding: 5px;
}
.inline-field{display:flex;align-items:center;gap:8px}
.inline-field select{flex:1;min-width:0}
.document-form-actions{display:flex;gap:8px;align-items:center}
.document-form-actions .full{flex:1}
#quick-sale-options{margin:12px 0}
.payment-inline{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:10px;border:1px solid var(--line);background:var(--bg);font-size:12px}
.segmented{display:inline-flex;gap:2px;padding:2px;border:1px solid var(--line);border-radius:4px}
.segmented button{border:0;background:transparent;padding:4px 9px;color:var(--muted);font-size:12px}
.segmented button.active{background:var(--green);color:#fff;border-radius:3px}
.payment-inline label{display:flex;align-items:center;gap:5px}
.empty {
  padding: 55px 20px;
  text-align: center;
  font-size: 12px;
  line-height: 1.9;
  color: var(--muted);
}
.small-empty {
  padding: 40px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.getting-started {
  display: flex;
  align-items: center;
  gap: 20px;
  background: #e8edde;
}
.step-icon {
  border: 1px solid #c3d1b4;
  border-radius: 50%;
  font-size: 15px;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.getting-started h2 {
  font-size: 14px;
  margin: 0 0 9px;
}
.getting-started p {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.9;
  margin: 0;
}
.getting-started > div {
  flex: 1;
}
.filters {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
}
.filters > input {
  flex: 1;
}
.filters > select {
  width: 180px;
}
.check {
  display: flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
  margin: 0;
  color: var(--muted);
}
.check input {
  margin: 0;
}
.table-wrap {
  overflow: auto;
}
.history-grid,
.sales-grid {
  table-layout: fixed;
}
.history-grid .history-time-col { width: 70px; }
.history-grid .history-operator-col { width: 104px; }
.history-grid .history-product-col { width: 270px; }
.history-grid .history-location-col { width: 100px; }
.history-grid .history-kind-col { width: 90px; }
.history-grid .history-delta-col { width: 90px; }
.history-grid .history-balance-col { width: 110px; }
.history-grid .history-reason-col { width: auto; }
.sales-grid .sales-date-col { width: 150px; }
.sales-grid .sales-customer-col { width: 92px; }
.sales-grid .sales-channel-col { width: 120px; }
.sales-grid .sales-items-col { width: 136px; }
.sales-grid .sales-status-col { width: 160px; }
.sales-grid .sales-money-col { width: 96px; }
.sales-grid .sales-action-col { width: 84px; }
.sales-grid .pill { white-space: normal; text-align: left; }
.history-grid td:nth-child(2) { white-space: nowrap; text-overflow: ellipsis; }
.history-grid td,
.sales-grid td {
  overflow: hidden;
}
.history-thumb,
.sale-thumb {
  width: 36px;
  height: 50px;
  object-fit: cover;
  border: 1px solid #dfe4dc;
  border-radius: 4px;
  background: #eef0ea;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: #879080;
}
.history-product {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}
.history-product > div {
  min-width: 0;
  overflow: hidden;
}
.truncated {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-day td {
  background: #f4f6f0;
  color: #315b43;
  font-weight: 600;
  padding: 6px 12px;
}
.sale-thumbs {
  display: flex;
  gap: 4px;
  align-items: center;
  min-width: 0;
}
.sale-thumbs .sale-thumb {
  width: 28px;
  height: 39px;
  flex: 0 0 auto;
}
.sale-thumbs .more {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.platform-ref {
  display: inline-block;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}
.doc-number {
  display: flex !important;
  align-items: center;
  gap: 4px;
  min-width: 0;
  font-family: ui-monospace, Consolas, monospace;
}
.doc-number .truncated { flex: 1 1 auto; }
.copy-doc {
  flex: 0 0 auto;
  height: 18px !important;
  min-height: 18px !important;
  padding: 0 4px !important;
  font-size: 11px !important;
}
.channel-tag {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid #cfd8cc;
  border-radius: 4px;
  font-size: 10px;
  color: #526756;
}
.sales-grid tbody tr,
.history-grid tbody tr:not(.history-day) {
  cursor: pointer;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  text-align: left;
}
th {
  padding: 12px;
  background: #f4f6f0;
  color: #7b8576;
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
}
td {
  padding: 15px 12px;
  border-bottom: 1px solid #edf0e9;
  vertical-align: middle;
  line-height: 1.8;
}
td small {
  display: block;
  font-size: 10px;
  color: var(--muted);
}
td strong {
  font-size: 12px;
}
td button {
  padding: 5px 8px;
  font-size: 10px;
  margin: 2px;
}
.pill {
  display: inline-block;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 10px;
  background: #eef1e9;
  color: #6f7e60;
  white-space: nowrap;
}
.pill.green {
  color: #38633c;
  background: #e5efe1;
}
.pill.orange {
  color: #a27b36;
  background: #faf0d8;
}
.pill.red {
  color: #a75447;
  background: #faeae4;
}
.delta.positive {
  color: #42753e;
}
.delta.negative {
  color: #b4713d;
}
.mini-row {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  border-bottom: 1px solid #edf0e9;
  padding: 13px 0;
  font-size: 12px;
  align-items: center;
}
.mini-row:last-child {
  border: 0;
}
.mini-row p {
  margin: 0 0 4px;
}
.mini-row small {
  color: var(--muted);
  font-size: 10px;
}
.mini-row > .mini-right {
  text-align: right;
  flex-shrink: 0;
}
.mini-row button {
  font-size: 10px;
  padding: 5px 9px;
}
.offline {
  border: 1px solid #e6ceb1;
  background: #faf0df;
  padding: 14px;
  color: #8c692e;
  font-size: 12px;
  margin: 15px 0;
  border-radius: 7px;
}
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--green);
  color: white;
  padding: 14px 23px;
  border-radius: 8px;
  z-index: 50;
  box-shadow: 0 10px 30px #0002;
  font-size: 13px;
}
footer {
  font-size: 9px;
  color: #95a08d;
  display: flex;
  justify-content: space-between;
  margin-top: 30px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}
dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--ink);
  padding: 26px;
  width: 620px;
  max-width: 94vw;
  max-height: 92vh;
}
dialog.compact {
  width: 420px;
}
dialog.wide {
  width: 960px;
}
dialog::backdrop {
  background: #10241785;
}
.dialog-heading {
  position: sticky;
  top: -1px;
  left: 0;
  z-index: 10;
  background: white;
  padding: 8px 0;
  width: 100%;
  gap: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
}
.dialog-heading h2 {
  font-size: 20px;
  margin: 0;
}
.dialog-heading button {
  margin-left: auto;
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  font-size: 25px;
  padding: 0 7px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
}
.selection-info {
  font-size: 12px;
  border: 1px solid #dfe8d5;
  border-radius: 6px;
  padding: 12px;
  background: #f3f6ec;
  line-height: 1.9;
  color: #658054;
  min-height: 43px;
}
.line-editor {
  min-width: 700px;
}
.line-editor select {
  max-width: 330px;
  font-size: 11px;
}
.line-editor td:first-child {
  width: 42%;
}
.line-editor input {
  width: 90px;
  padding: 8px;
}
.line-editor td {
  padding: 8px 5px;
}
.line-editor th {
  padding: 8px;
}
.document-total {
  text-align: right;
  margin: 24px 0;
  font-size: 12px;
}
.document-total strong {
  font-size: 22px;
  margin-left: 15px;
}
.detail-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: #f5f7ef;
  border-radius: 7px;
  padding: 15px;
  font-size: 12px;
}
.detail-info p {
  margin: 3px 0;
}
.detail-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
}
.detail-actions button {
  flex: 1;
}
.return-row {
  display: grid;
  grid-template-columns: 1fr 130px;
  gap: 20px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.return-row p {
  font-size: 13px;
  margin: 0;
}
.return-row small {
  color: var(--muted);
  font-size: 11px;
}
.return-row label {
  margin: 0;
}
.section-label + h3 {
  font-size: 14px;
}
[hidden] {
  display: none !important;
}
:focus-visible {
  outline: 2px solid #81a864;
  outline-offset: 3px;
}
@media (min-width: 1500px) {
  .main {
    padding: 40px 55px;
  }
}
@media (max-width: 1150px) {
  .workspace {
    grid-template-columns: 185px minmax(0, 1fr);
  }
  .sidebar {
    padding: 25px 15px;
  }
  .main {
    padding: 28px 22px;
  }
  .toolbar {
    align-items: start;
    flex-direction: column;
  }
  .stats {
    gap: 10px;
  }
  .stat {
    padding: 20px 15px;
  }
  .stat strong {
    font-size: 25px;
  }
  .overview-grid {
    grid-template-columns: 1fr;
  }
  .finance-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 720px) {
  .workspace {
    display: block;
  }
  .sidebar {
    position: relative;
    height: auto;
    padding: 17px;
  }
  .logo {
    font-size: 17px;
  }
  .mark {
    width: 35px;
    height: 35px;
    font-size: 22px;
  }
  .nav-label,
  .sidebar-bottom p {
    display: none;
  }
  nav {
    flex-direction: row;
    overflow: auto;
    margin-top: 14px;
    gap: 4px;
  }
  nav button {
    padding: 10px;
    gap: 5px;
    font-size: 12px;
  }
  nav button span {
    font-size: 11px;
  }
  .sidebar-bottom {
    margin: 10px 0 0;
    padding: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .main {
    padding: 24px 15px;
  }
  .header-right {
    gap: 7px;
  }
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stat strong {
    font-size: 26px;
  }
  .finance-stats .stat strong {
    font-size: 21px;
  }
  .toolbar-actions button {
    font-size: 11px;
  }
  .filters {
    flex-wrap: wrap;
  }
  .filters > input {
    flex-basis: 100%;
  }
  .filters > select {
    width: 145px;
  }
  .panel {
    padding: 15px;
  }
  .panel-heading {
    flex-wrap: wrap;
  }
  .getting-started {
    align-items: start;
    flex-wrap: wrap;
  }
  .getting-started .step-icon {
    display: none;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .detail-info {
    grid-template-columns: 1fr;
  }
  header h1 {
    font-size: 24px;
  }
  .section-label {
    gap: 10px;
  }
  .section-label > span {
    text-align: right;
    font-size: 9px;
  }
  dialog {
    padding: 20px;
  }
  .return-row {
    grid-template-columns: 1fr 100px;
  }
  footer {
    gap: 10px;
  }
}
/* Keep every menu reachable without dragging a horizontal scrollbar. */
@media (min-width: 721px) {
  .sidebar {
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    padding-top: 22px;
    padding-bottom: 20px;
  }
  .sidebar .logo,
  .sidebar .nav-label,
  .sidebar-bottom {
    flex-shrink: 0;
  }
  .sidebar .nav-label {
    margin: 26px 13px 14px;
  }
  .sidebar nav {
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #8eaa91 #254a35;
    padding: 3px 6px 3px 3px;
    gap: 5px;
  }
  .sidebar nav button {
    flex-shrink: 0;
    padding: 11px 12px;
    min-height: 42px;
  }
  .sidebar-bottom {
    padding-top: 16px;
  }
}
@media (max-width: 720px) {
  .sidebar nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
    gap: 6px;
    margin-top: 14px;
  }
  .sidebar nav button {
    min-width: 0;
    min-height: 40px;
    justify-content: flex-start;
    padding: 9px 8px;
    gap: 6px;
    background: #254a35;
    white-space: normal;
  }
  .sidebar nav button span {
    font-size: 12px;
    line-height: 1.5;
  }
  .sidebar nav button.active {
    background: #3a6047;
    box-shadow: inset 3px 0 var(--lime);
  }
}
@media (max-width: 380px) {
  .sidebar nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Long-term operation: search, bounded lists and quick SKU entry. */
.document-filters {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto auto;
  gap: 8px;
  margin: 16px 0;
}
.history-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 18px 0;
  font-size: 12px;
}
.line-search {
  width: 100% !important;
  margin-bottom: 7px;
}
.line-stock-hint {
  color: #557348 !important;
}
.document-filters input {
  min-width: 0;
}
@media (max-width: 1100px) {
  .document-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  .document-filters {
    grid-template-columns: 1fr 1fr;
  }
  .document-filters input[type="search"] {
    grid-column: 1/-1;
  }
}
.document-filters {
  align-items: end;
}
.document-filters label {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}
.document-filters label input {
  margin-top: 5px;
}

.order-import {
  margin: 20px 0;
  padding: 16px;
  background: var(--surface, #f6f7f8);
  border: 1px solid var(--border, #d5d9df);
  border-radius: 8px;
}
.order-import .toolbar-actions {
  flex-wrap: wrap;
  align-items: end;
}
.order-import label {
  margin: 0;
}
.order-import p {
  margin: 10px 0 0;
}
.order-import select {
  min-width: 150px;
}

.inventory-jump {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.inventory-jump select {
  width: auto;
  min-width: 110px;
}
#price-preview td {
  font-variant-numeric: tabular-nums;
}
.history-pager {
  flex-wrap: wrap;
}

.inventory-summary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 18px 0;
}
.inventory-summary > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.inventory-summary strong {
  font-size: 28px;
  font-variant-numeric: tabular-nums;
}
.inventory-summary small {
  color: var(--muted, #526453);
}
@media (max-width: 540px) {
  .inventory-summary {
    grid-template-columns: 1fr;
  }
}

.cost-overall {
  display: block;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border, #d5d9df);
}
[data-inventory-cost] {
  min-width: 190px;
  font-variant-numeric: tabular-nums;
}
#catalog-plan-dialog select {
  max-width: 100%;
}
#catalog-plan-rows td {
  vertical-align: top;
}
#catalog-final-numbering {
  overflow-wrap: anywhere;
  max-height: 140px;
  overflow: auto;
}

.catalog-bulk-controls {
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--border, #d5d9df);
  border-radius: 8px;
}
.catalog-bulk-controls legend {
  font-weight: 600;
  padding: 0 6px;
}
.catalog-bulk-controls label {
  margin: 0;
}
.catalog-bulk-controls .toolbar-actions {
  align-items: end;
  flex-wrap: wrap;
}
.catalog-bulk-controls p {
  margin: 10px 0 0;
}

.art-thumb {
  float: left;
  width: 58px;
  min-height: 80px;
  padding: 3px;
  margin: 0 10px 6px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1.5;
  white-space: normal;
  overflow: hidden;
  background: var(--surface, #f6f7f8);
}
.art-thumb img {
  display: block;
  width: 50px;
  height: 70px;
  object-fit: contain;
  border-radius: 3px;
}
.art-current {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 16px 0;
}
.art-current > img {
  width: min(280px, 100%);
  max-height: 400px;
  object-fit: contain;
  align-self: flex-start;
  border-radius: 8px;
}
.art-current > p {
  flex-basis: 100%;
}
.art-candidates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 16px 0;
}
.art-candidate {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border, #d5d9df);
  border-radius: 8px;
  margin: 0;
  cursor: pointer;
}
.art-candidate:has(input:checked) {
  outline: 2px solid #183b2b;
}
.art-candidate input {
  width: auto;
  flex: none;
}
.art-candidate img {
  width: 90px;
  object-fit: contain;
  border-radius: 4px;
}
.art-candidate div {
  font-size: 13px;
  overflow-wrap: anywhere;
}
.art-candidate small {
  display: block;
  margin-top: 8px;
}
.art-job {
  margin: 14px 0;
  padding: 12px;
  background: #f2f5ef;
  border: 1px solid #d5d9df;
  border-radius: 8px;
}
.art-job[hidden] {
  display: none;
}
.art-job details {
  margin-top: 10px;
}
.art-upload-label {
  margin: 0;
}
#art-dialog .toolbar-actions {
  flex-wrap: wrap;
  align-items: end;
}
#art-current:empty {
  display: none;
}
@media (max-width: 720px) {
  .art-candidates {
    grid-template-columns: 1fr;
  }
  .art-current > img {
    width: min(220px, 100%);
  }
}

.art-current.art-original {
  display: block;
  border: 1px solid var(--border, #d5d9df);
  padding: 8px;
}
.art-current.art-original > img {
  width: auto;
  max-width: none;
  height: auto;
  max-height: none;
  display: block;
  margin-bottom: 12px;
}
.art-review-item {
  padding: 18px 0;
  border-bottom: 1px solid var(--border, #d5d9df);
}
.art-review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
}
.art-review-grid .art-review-item {
  border: 1px solid var(--border, #d5d9df);
  border-radius: 8px;
  padding: 14px;
}
.art-review-level { font-size: 12px; padding: 2px 6px; border-radius: 999px; }
.art-review-level.exact { color: #176b45; background: #e3f4e9; }
.art-review-level.check { color: #8a5a00; background: #fff1cf; }
.art-review-level.blocked { color: #666; background: #eceff1; }
.art-review-blocked { opacity: .78; }
.art-review-batch { display: flex; gap: 8px; align-items: center; margin: 5px 0; }
.art-review-item h3 {
  margin: 0 0 10px;
}
.art-review-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 14px 0;
}
.art-review-compare > div {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.art-review-compare img {
  width: 120px;
  max-height: 175px;
  object-fit: contain;
  align-self: flex-start;
  border-radius: 4px;
}
.art-review-compare small {
  overflow-wrap: anywhere;
}
.art-review-item .toolbar-actions {
  flex-wrap: wrap;
  gap: 8px;
}
#art-review-dialog .history-pager {
  position: sticky;
  bottom: 0;
  background: white;
  padding: 12px 0;
}
#art-original-size,
#art-review-original {
  margin-top: 12px;
}
[data-section="inventory"] .panel-heading {
  flex-wrap: wrap;
  gap: 12px;
}
[data-section="inventory"] .panel-heading > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 100%;
}

/* Scroll the whole management rail, including the menu's details wrapper. */
@media (min-width: 721px) {
  .sidebar {
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    scrollbar-width: thin;
    scrollbar-color: #8eaa91 #183b2b;
  }
  .sidebar .navigation-menu {
    flex: 0 0 auto;
    min-height: auto;
    overflow: visible;
  }
  .sidebar nav {
    flex: none;
    overflow: visible;
    min-height: auto;
  }
  .sidebar-bottom {
    margin-top: auto;
  }
}
.fulfill-bulk-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}
.fulfill-bulk-actions button {
  min-height: 44px;
}
.basic-product-name {
  min-width: 180px;
}
.basic-version-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.basic-version-fields label {
  margin: 0;
}
.basic-version-fields input,
.basic-version-fields select {
  width: 100%;
  min-width: 0;
}
.basic-catalog-row {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.basic-catalog-row h3 {
  font-size: 14px;
  margin: 0 0 8px;
}
.basic-import-actions {
  margin: 14px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}
#basic-catalog-rows {
  max-height: 58vh;
  overflow: auto;
}
#basic-catalog-dialog .basic-pager {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
}
.panel-heading > div {
  flex-wrap: wrap;
}
.basic-save-state {
  min-height: 24px;
}
@media (max-width: 720px) {
  .basic-version-fields {
    grid-template-columns: 1fr 1fr;
  }
}

/* A single scroll surface and a reachable confirmation for long imports. */
.basic-import-actions {
  align-items: flex-end;
}
.basic-import-actions > label {
  margin: 0;
}
.basic-import-actions > button {
  align-self: flex-end;
  min-height: 42px;
}
.basic-version-fields {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}
#basic-catalog-rows {
  max-height: none;
  overflow: visible;
}
#basic-catalog-dialog {
  scroll-padding-bottom: 78px;
}
#basic-form > button[type="submit"] {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin-top: 16px;
  box-shadow: 0 -6px 12px #ffffff;
}
.basic-catalog-row small {
  display: block;
  line-height: 1.7;
  color: var(--muted);
}

#art-network-result {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
}
/* 0.11.7: 配图批量确认——滚动预览网格时批量按钮和“已选 N 项”保持可见 */
#art-review-dialog > .toolbar-actions {
  position: sticky;
  top: 31px; /* 紧贴吸顶的标题栏下方（标题栏 top:-20px、高约 51px） */
  z-index: 2;
  background: white;
  margin: 0 -20px;
  padding: 8px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.reservation-banner {
  border-color: #e3b1a8;
  background: #fbebe7;
  color: #8e3524;
}
.reservation-banner ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

/* Cost CSV preview needs room for SKU, amounts and validation messages. */
.cost-batch-dialog { width: min(1000px, calc(100vw - 32px)); }
.cost-batch-dialog textarea { display: block; width: 100%; min-height: 80px; margin: 12px 0; }

[data-movement-detail], tr[data-detail] { cursor: pointer; }
[data-movement-detail]:focus-visible { outline: 2px solid currentColor; }
.art-enlarged img { display: block; max-height: 80vh; max-width: 85vw; }
.art-thumb:has(small) {
  flex-direction: column;
}
.art-thumb small {
  font-size: 9px;
  line-height: 1.3;
  color: var(--muted, #667085);
}

.card-filters { position: relative; font-size: 13px; }
.card-filters summary, .card-details summary { cursor: pointer; }
.card-filters > div { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px; }
.card-filters label { min-width: 90px; }
.card-fields { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 13px; }
.card-fields dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.card-details pre { white-space: pre-wrap; }
.card-review { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid #dfe8d5; }
.card-review img { width: 90px; object-fit: contain; align-self: start; }
.card-review select { max-width: 100%; }

#network-routing-settings textarea { display: block; width: 100%; min-height: 240px; margin: 12px 0; }
#network-routing-settings textarea[hidden] { display: none; }
#network-routing-settings button { margin: 4px 8px 8px 0; }
/* 104: keep the green palette while separating independent sale states. */
.sales-grid { min-width: 1400px; table-layout: auto; }
.sales-grid .sales-status-col { width: 130px; }
.sales-grid .sales-money-col { width: 160px; }
.sales-grid td.sale-money, .sales-grid td.sale-money small { white-space: nowrap; }
.sales-grid .pill { background: #e8f3ec; color: #286441; white-space: nowrap; }
.sales-grid td { overflow: visible; }
.art-field-compare { table-layout: fixed; margin-top: 12px; }
.art-field-compare th, .art-field-compare td { white-space: normal; overflow-wrap: anywhere; vertical-align: top; }
.art-field-compare .art-review-differences td { background: #fff8e8; }
