:root {
  color-scheme: light;
  --bg: #f3f4f2;
  --surface: #ffffff;
  --surface-2: #f7f8f6;
  --ink: #0b0d0e;
  --muted: #6b706d;
  --line: #dedfdb;
  --accent: #111315;
  --accent-2: #2b2f31;
  --warning: #8a5a00;
  --danger: #a22d27;
  --good: #1f6d43;
  --shadow: 0 1px 0 rgba(10, 12, 12, 0.03);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(243, 244, 242, 0.96);
}

.login-screen[hidden] {
  display: none;
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(11, 13, 14, 0.12);
}

.login-card h1 {
  margin: 0;
  font-size: 28px;
}

.login-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-hint,
.user-chip {
  color: var(--muted);
  font-size: 12px;
}

.user-chip {
  align-self: center;
  white-space: nowrap;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 100vh;
  width: 72px;
  padding: 16px 10px;
  background: #0a0c0d;
  color: #f7f7f4;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: hidden;
  transition: width 160ms ease, box-shadow 160ms ease;
}

.sidebar:hover,
.sidebar:focus-within {
  width: 168px;
  box-shadow: 18px 0 42px rgba(0, 0, 0, 0.16);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 148px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: #f7f7f4;
  color: #0a0c0d;
  border-radius: 4px;
  font-weight: 800;
  flex: 0 0 40px;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.sidebar-note span {
  color: rgba(247, 251, 247, 0.68);
  font-size: 12px;
  margin-top: 4px;
}

.nav-tabs {
  display: grid;
  gap: 6px;
}

.nav-tab {
  border: 0;
  border-radius: 4px;
  position: relative;
  min-width: 148px;
  padding: 11px 12px 11px 50px;
  background: transparent;
  color: rgba(247, 247, 244, 0.72);
  text-align: left;
  font-size: 14px;
  font-weight: 700;
}

.nav-tab::before {
  content: attr(data-short);
  position: absolute;
  left: 10px;
  top: 50%;
  width: 32px;
  height: 28px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: #f7f7f4;
  font-size: 13px;
}

.nav-tab:nth-child(1)::before {
  background: #2f6bff;
}

.nav-tab:nth-child(2)::before {
  background: #00a676;
}

.nav-tab:nth-child(3)::before {
  background: #d98c00;
}

.nav-tab:nth-child(4)::before {
  background: #8f5cff;
}

.nav-tab.is-active,
.nav-tab:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.sidebar:not(:hover):not(:focus-within) .brand > div:not(.brand-mark),
.sidebar:not(:hover):not(:focus-within) .sidebar-note {
  opacity: 0;
  pointer-events: none;
}

.sidebar:not(:hover):not(:focus-within) .nav-tab {
  color: transparent;
}

.sidebar:not(:hover):not(:focus-within) .nav-tab::before {
  color: #f7f7f4;
}

.sidebar-note {
  margin-top: auto;
  min-width: 204px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

.sidebar-note strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
}

.main {
  min-width: 0;
  padding: 18px 22px 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 4px;
  font-size: 16px;
}

.panel-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.topbar-actions,
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
}

.primary-button,
.ghost-button {
  min-height: 34px;
  border-radius: 4px;
  padding: 0 12px;
  border: 1px solid transparent;
  white-space: nowrap;
  font-weight: 800;
  font-size: 13px;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-2);
}

.ghost-button {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.inline-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  min-width: 0;
}

.danger-button {
  border-color: #fecaca !important;
  background: #fff7f7 !important;
  color: #b42318 !important;
}

.danger-button:hover {
  border-color: #fca5a5 !important;
  background: #fee2e2 !important;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.metric,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.metric {
  min-height: 72px;
  padding: 12px 14px;
}

.metric-button {
  display: block;
  width: 100%;
  text-align: left;
  cursor: default;
}

.metric-button.is-clickable {
  cursor: pointer;
}

.metric-button.is-clickable:hover {
  border-color: rgba(20, 113, 93, 0.35);
  transform: translateY(-1px);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.metric strong {
  font-size: 22px;
  line-height: 1;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 12px;
  align-items: start;
}

.order-layout {
  display: grid;
  gap: 12px;
  min-width: 0;
}

#ordersView.is-order-sheet .order-layout {
  grid-template-columns: minmax(0, 1fr);
}

#ordersView.is-order-sheet .order-records-panel {
  min-width: 0;
}

#movementsView.is-movement-sheet .work-grid {
  grid-template-columns: minmax(0, 1fr);
}

#movementsView.is-movement-sheet .records-list {
  max-height: calc(100vh - 190px);
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.panel-heading {
  display: flex;
  justify-content: flex-start;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.inventory-panel .panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding-block: 8px;
}

.status-segment {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.status-segment button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 11px;
  background: #f7f8f6;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.status-segment button:hover,
.status-segment button.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.toolbar {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
}

input,
select {
  min-height: 34px;
  padding: 0 10px;
}

input[type="date"] {
  min-width: 150px;
  cursor: pointer;
}

textarea {
  min-height: 84px;
  padding: 10px 12px;
  resize: vertical;
}

.toolbar input {
  flex: 1;
}

.toolbar .inventory-series-filter {
  flex: 0 0 min(260px, 28vw);
}

.toolbar .compact-filter {
  flex: 0 0 92px;
}

.toolbar .number-filter {
  flex-basis: 78px;
}

.toolbar select,
.panel-heading select {
  max-width: 168px;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 244px);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f0f1ee;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.is-selected {
  background: #f2f3f0;
}

.item-no {
  font-weight: 800;
  font-size: 14px;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 0 8px;
  background: #eef3ec;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.good {
  background: #e8f5ea;
  color: var(--good);
}

.badge.warning {
  background: #fff3df;
  color: var(--warning);
}

.badge.danger {
  background: #fdeceb;
  color: var(--danger);
}

.bulk-series-bar {
  display: grid;
  grid-template-columns: auto minmax(112px, 1fr) auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  color: var(--muted);
  font-size: 12px;
  border-bottom: 1px solid var(--line);
  background: #fafbf9;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
}

.check-label input {
  width: 15px;
  min-height: auto;
}

.mini-button {
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.mini-button.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.check-column {
  width: 36px;
}

.sortable-th {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: auto;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  padding: 0;
  text-align: inherit;
}

.sortable-th::after {
  content: "↕";
  opacity: 0.35;
  font-size: 10px;
}

.sortable-th.is-active::after {
  content: "↑";
  opacity: 0.9;
}

.sortable-th.is-active[data-sort-dir="desc"]::after {
  content: "↓";
}

.inventory-table th:nth-child(4),
.inventory-table th:nth-child(5),
.inventory-table th:nth-child(6),
.inventory-table td:nth-child(4),
.inventory-table td:nth-child(5),
.inventory-table td:nth-child(6) {
  text-align: right;
}

.inventory-table th:nth-child(4) .sortable-th,
.inventory-table th:nth-child(5) .sortable-th,
.inventory-table th:nth-child(6) .sortable-th {
  justify-content: flex-end;
  width: 100%;
}

.row-check {
  inline-size: 15px;
  block-size: 15px;
}

.product-detail {
  padding: 12px;
}

.product-image-wrap {
  display: block;
  width: 76px;
  height: 76px;
  flex: 0 0 76px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f8faf7;
  margin: 0;
  padding: 0;
  cursor: zoom-in;
}

.product-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  place-items: center;
  padding: 24px;
}

.image-modal.is-open {
  display: grid;
}

.image-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(19, 35, 29, 0.58);
}

.image-modal-panel {
  position: relative;
  z-index: 1;
  width: min(880px, 92vw);
  max-height: 88vh;
  border-radius: 8px;
  background: #fff;
  padding: 18px;
  box-shadow: var(--shadow);
}

.image-modal-panel img {
  display: block;
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
}

.product-hero-row,
.product-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.product-hero-row h3,
.product-title h3 {
  margin: 0 0 6px;
  font-size: 18px;
  line-height: 1.2;
}

.stock-pill {
  min-width: 68px;
  padding: 8px 10px;
  border-radius: 4px;
  background: var(--surface-2);
  text-align: center;
  font-weight: 800;
  font-size: 14px;
}

.product-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
  min-width: 72px;
}

.form-actions {
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(220px, 1fr);
  gap: 10px;
  align-items: center;
}

.recent-movement-card {
  position: relative;
  display: grid;
  grid-template-rows: 20px 20px 46px 18px;
  align-items: start;
  gap: 6px;
  min-height: 136px;
  padding: 10px 42px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  overflow: hidden;
}

.recent-movement-card + .recent-movement-card {
  margin-top: 8px;
}

.recent-movement-card strong {
  margin: 0;
  font-size: 13px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-product-name {
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-movement-card .record-meta {
  max-height: 46px;
  overflow: hidden;
  gap: 5px;
}

.recent-movement-card p {
  margin: 0;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-movement-edit {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  min-height: 28px;
  border-radius: 4px;
  background: #f7f8f6;
  color: var(--ink);
}

.recent-movement-edit:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.detail-cell {
  padding: 8px;
  background: #f8faf7;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.detail-cell span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 4px;
}

.detail-cell strong {
  word-break: break-word;
}

.record-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.product-edit-drawer-panel {
  width: min(760px, 94vw);
  padding: 12px;
}

.product-edit-drawer-panel > .drawer-close {
  position: absolute;
  top: 10px;
  right: 10px;
  margin: 0;
}

.product-edit-drawer-panel .panel {
  overflow: hidden;
}

.product-edit-drawer-panel .panel-heading {
  padding: 16px 54px 14px 18px;
}

#productEditForm {
  grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  padding: 14px 16px 16px;
}

#productEditForm > label,
#productEditForm > fieldset {
  min-width: 0;
}

#productEditForm .span-2 {
  grid-column: 1 / -1;
}

.product-image-uploader {
  grid-row: span 2;
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 170px;
  padding: 10px;
  border: 1px dashed #b8c8dc;
  border-radius: 8px;
  background: #f7fbff;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.product-image-uploader:hover,
.product-image-uploader:focus,
.product-image-uploader.is-dragging {
  outline: none;
  border-color: #2f6df6;
  background: #eef5ff;
  box-shadow: 0 0 0 3px rgba(47, 109, 246, 0.12);
}

.product-image-uploader img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.product-image-uploader strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
}

.product-image-uploader span {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.35;
}

#productEditDrawer .product-edit-drawer-panel {
  width: min(760px, 94vw);
  padding: 10px;
}

#productEditForm .price-pair-field {
  grid-column: 2 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

#productEditForm .price-pair-field legend {
  grid-column: 1 / -1;
  padding: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

#productEditForm .price-pair-field label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.product-stock-view {
  grid-column: 2 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid #d7e2ef;
  border-left: 4px solid #2f6df6;
  border-radius: 8px;
  background: #f8fbff;
}

.product-stock-view span,
.product-stock-view small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.product-stock-view strong {
  display: block;
  margin: 2px 0;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.1;
}

.stock-unit-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, 42px);
  padding: 3px;
  border: 1px solid #cfdceb;
  border-radius: 7px;
  background: #fff;
}

.stock-unit-switch button {
  min-height: 30px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}

.stock-unit-switch button.is-active {
  background: #111820;
  color: #fff;
}

.product-log-list {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.product-log-item {
  display: grid;
  gap: 4px;
  padding: 8px 9px;
  border: 1px solid #dfe7ef;
  border-radius: 5px;
  background: #fbfdff;
}

.product-log-item strong {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.35;
}

.product-log-item span,
.product-log-item p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.compact-empty {
  min-height: 42px;
  padding: 10px;
  font-size: 12px;
}

#productEditDrawer .product-edit-drawer-panel > .drawer-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  margin: 0;
}

#customerFormPanel {
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

#customerFormPanel.is-editing {
  border-color: #d98c00;
  background: #fffaf0;
  box-shadow: 0 0 0 3px rgba(217, 140, 0, 0.12), var(--shadow);
}

#customerFormPanel.is-editing .panel-heading {
  background: #fff3df;
  border-bottom-color: rgba(217, 140, 0, 0.32);
}

#customerFormPanel.is-editing .panel-heading h2::before {
  content: "修改中";
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-right: 10px;
  padding: 0 9px;
  border-radius: 999px;
  background: #111315;
  color: #fff;
  font-size: 12px;
  vertical-align: middle;
}

#customerFormPanel.is-editing .record-form {
  background: linear-gradient(90deg, #d98c00 0 5px, #fffaf0 5px);
}

.edit-mode-banner {
  display: flex;
  gap: 10px;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 12px 14px;
  border: 1px solid rgba(217, 140, 0, 0.34);
  border-left: 5px solid #d98c00;
  border-radius: 4px;
  background: #fff3df;
  color: #6d4300;
  font-size: 13px;
  font-weight: 800;
}

.edit-mode-banner[hidden] {
  display: none;
}

.edit-mode-banner span {
  color: #8a5a00;
  font-weight: 700;
}

.partner-lists {
  display: grid;
  gap: 18px;
}

#customersView.is-partner-sheet .work-grid {
  grid-template-columns: minmax(0, 1fr);
}

#customersView.is-partner-sheet .partner-lists {
  min-width: 0;
}

#customersView.is-partner-sheet .records-list {
  max-height: calc(100vh - 190px);
}

.compact-form {
  padding-bottom: 14px;
}

.record-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.movement-lines {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.movement-line-head,
.movement-line-row {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) 92px 82px 92px 36px;
  gap: 8px;
  align-items: center;
}

.movement-line-head {
  min-height: 32px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.movement-lines-body {
  display: grid;
  gap: 8px;
}

.movement-new-product {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.movement-new-product[hidden] {
  display: none;
}

.add-line-row-button {
  width: 100%;
  margin-top: 10px;
  min-height: 36px;
  border-style: dashed;
}

.movement-document-card {
  background: #fff;
  cursor: pointer;
}

.movement-document-card:hover {
  background: #f7f8f6;
}

.movement-document-preview {
  display: grid;
  gap: 0;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.movement-document-preview > div {
  display: grid;
  grid-template-columns: 130px minmax(160px, 1fr) 90px;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.movement-document-preview > div:last-child {
  border-bottom: 0;
}

.movement-document-preview span {
  color: var(--muted);
}

.movement-document-preview b {
  text-align: right;
}

.movement-document-sheet .sheet-head,
.movement-document-sheet .sheet-row {
  grid-template-columns: minmax(180px, 1.3fr) 108px 120px 74px 90px 120px minmax(220px, 1fr);
}

.movement-document-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.movement-document-row:hover {
  background: #f7f8f6;
}

.open-detail-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.movement-detail-lines {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: visible;
}

.movement-detail-line {
  display: grid;
  grid-template-columns: 150px minmax(180px, 1fr) 110px 100px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.movement-detail-line:last-child {
  border-bottom: 0;
}

.movement-detail-line span {
  color: var(--muted);
  min-width: 0;
  overflow-wrap: anywhere;
}

.movement-detail-line .mini-button {
  min-width: 52px;
  justify-self: end;
}

.movement-inline-edit {
  background: #f7f8f6;
  grid-template-columns: minmax(220px, 1.6fr) 110px 96px minmax(160px, 1fr) minmax(160px, 1fr) auto;
}

.document-inline-edit {
  display: grid;
  grid-template-columns: 150px 160px minmax(180px, 1fr);
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid #dfe3de;
  border-left: 5px solid var(--accent);
  border-radius: 4px;
  background: #f7f8f6;
}

.document-inline-edit label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.document-inline-edit .inline-edit-actions {
  grid-column: 1 / -1;
}

.document-actor-chip {
  display: grid;
  gap: 6px;
  min-height: 66px;
  align-content: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.document-actor-chip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.document-edit-lines {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(217, 140, 0, 0.2);
  border-radius: 4px;
  background: #fff;
}

.document-edit-line {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 90px 76px 90px 36px;
  gap: 8px;
  align-items: center;
}

.document-edit-line [name="packing"] {
  background: #f1f3f0;
  color: var(--muted);
}

.document-edit-head {
  min-height: 26px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.movement-inline-edit input,
.movement-inline-edit select {
  min-height: 40px;
  width: 100%;
}

.inline-edit-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.inline-action-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.inline-action-field button {
  min-height: 42px;
}

.span-2 {
  grid-column: span 2;
}

.span-3 {
  grid-column: span 3;
}

.order-form {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.order-head {
  display: grid;
  grid-template-columns: minmax(240px, 1.35fr) 140px repeat(4, minmax(130px, 1fr));
  gap: 12px;
  align-items: end;
}

.customer-picker-field {
  grid-column: span 1;
}

.order-customer-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 8px;
  align-items: end;
}

.order-customer-actions .selector-button,
.order-customer-actions .mini-button {
  min-height: 34px;
  height: 34px;
  padding: 0 10px;
}

.order-customer-actions .selector-button {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-head label,
.fee-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.subsection-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.subsection-heading.compact {
  margin-bottom: 10px;
}

.subsection-heading h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.subsection-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.order-lines-section,
.shipping-box,
.fees-box,
.fulfillment-box {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.shipping-box {
  border-left: 4px solid #2f6bff;
}

.shipping-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.shipping-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.inline-check input {
  width: 15px;
  min-height: auto;
}

.custom-fees {
  display: grid;
  gap: 8px;
}

.custom-fee-row {
  display: grid;
  grid-template-columns: 130px minmax(160px, 1fr) 120px 36px;
  gap: 8px;
  align-items: center;
}

.custom-fee-row [hidden] {
  display: none;
}

.custom-fee-row:has([name="feeReason"][hidden]) {
  grid-template-columns: minmax(160px, 1fr) 120px 36px;
}

.product-pick-cell {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) 38px;
  gap: 6px;
  align-items: center;
}

.series-pick-field,
.product-pick-cell input[type="search"] {
  min-width: 0;
}

.series-pick-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 0;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
  transition: border-color .12s ease, box-shadow .12s ease;
}

.series-pick-field input[type="search"] {
  min-width: 0;
  width: 100%;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.series-pick-field:focus-within {
  border-color: #2f6bff;
  box-shadow: 0 0 0 2px rgba(47, 107, 255, .15);
}

.selector-dot-button {
  min-height: 34px;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}

.selector-dot-button:hover {
  border-color: #9db9e7;
  color: #1d4ed8;
  background: #f5f9ff;
}

.product-pick-cell .selector-dot-button {
  border: 1px solid var(--line);
  border-radius: 6px;
}

.inline-field-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 8px;
}

.carton-dimension-field {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.carton-dimension-field legend {
  grid-column: 1 / -1;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.product-image-edit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 10px;
  align-items: center;
}

.product-image-edit-row img {
  width: 92px;
  height: 68px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.stock-combo-cell {
  text-align: right;
  white-space: nowrap;
}

.stock-combo-cell strong {
  font-weight: 900;
  display: inline-block;
  min-width: 58px;
}

.stock-combo-cell em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
  font-weight: 800;
  margin-left: 6px;
}

.stock-combo-cell span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

#inventoryTable tr[draggable="true"] {
  cursor: grab;
}

#inventoryTable tr.is-dragging {
  opacity: 0.45;
}

#inventoryTable tr.is-drop-target {
  outline: 2px solid #2f6bff;
  outline-offset: -2px;
}

.order-lines-wrap {
  overflow-x: auto;
}

.order-lines-table {
  min-width: 1120px;
}

.order-lines-table th,
.order-lines-table td {
  padding: 9px;
}

.order-lines-table th:nth-child(1) {
  width: 270px;
}

.order-lines-table th:nth-child(2),
.order-lines-table th:nth-child(3),
.order-lines-table th:nth-child(4) {
  width: 110px;
}

.order-lines-table th:nth-child(5) {
  width: 190px;
}

.order-lines-table th:nth-child(6) {
  width: 130px;
}

.order-lines-table th:nth-child(8) {
  width: 52px;
}

.line-amount {
  font-weight: 800;
  white-space: nowrap;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--danger);
  font-size: 18px;
  line-height: 1;
}

.stock-status {
  display: inline-flex;
  min-width: 168px;
  min-height: 32px;
  align-items: center;
  border-radius: 8px;
  padding: 0 10px;
  background: #eef3ec;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.stock-status.is-short {
  background: #fdeceb;
  color: var(--danger);
}

.order-tools-button {
  display: grid;
  gap: 2px;
  min-width: 118px;
  min-height: 44px;
  border: 1px solid rgba(20, 113, 93, 0.2);
  border-radius: 8px;
  padding: 7px 12px;
  background: #eef8f2;
  color: var(--accent-2);
  text-align: left;
}

.order-tools-button:hover {
  border-color: var(--accent);
  background: #e4f4ec;
}

.order-tools-button span {
  font-size: 12px;
  color: var(--muted);
}

.order-tools-button strong {
  font-size: 14px;
}

.order-drawer {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
}

#insightDrawer {
  z-index: 70;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(19, 35, 29, 0.18);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(560px, 92vw);
  height: 100%;
  overflow: auto;
  padding: 22px;
  background: var(--bg);
  box-shadow: -18px 0 45px rgba(30, 47, 37, 0.16);
  transform: translateX(100%);
  transition: transform 0.2s ease;
}

.drawer-panel > .drawer-close {
  position: sticky;
  top: 0;
  z-index: 5;
  margin-left: auto;
  margin-bottom: 8px;
}

.drawer-actions {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 12px;
}

.compact-drawer {
  width: min(460px, 92vw);
}

.order-detail-drawer {
  width: min(1040px, 96vw);
  padding-top: 14px;
}

.order-drawer.is-open {
  pointer-events: auto;
}

.order-drawer.is-open .drawer-backdrop {
  opacity: 1;
}

.order-drawer.is-open .drawer-panel {
  transform: translateX(0);
}

.drawer-close,
.drawer-action-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 22px;
}

.drawer-action-button {
  font-size: 18px;
  font-weight: 800;
}

.order-drawer.is-expanded .drawer-panel {
  left: 18px;
  right: 18px;
  top: 18px;
  bottom: 18px;
  width: auto;
  height: auto;
  border-radius: 8px;
}

.order-drawer.is-expanded .stack-grid {
  grid-template-columns: minmax(360px, 0.7fr) minmax(520px, 1.3fr);
  align-items: start;
}

.order-drawer.is-expanded #orderList {
  max-height: calc(100vh - 238px);
}

.order-filter-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1.15fr) 108px 150px 150px minmax(150px, 0.8fr) minmax(150px, 0.8fr) 132px auto;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #f7f8f6;
}

.movement-filter-bar {
  display: grid;
  grid-template-columns: 108px 150px 150px 140px minmax(150px, 0.8fr) minmax(220px, 1.2fr) auto;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #f7f8f6;
}

.selector-button {
  height: 36px;
  overflow: hidden;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selector-button::after {
  float: right;
  color: var(--muted);
  content: "···";
  letter-spacing: 2px;
}

.selector-search-line {
  padding: 0 0 10px;
}

.selector-search-line input {
  width: 100%;
}

.selector-table {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.selector-head,
.selector-row {
  display: grid;
  grid-template-columns: 1.1fr 1.2fr 0.8fr 0.7fr;
  min-width: 640px;
}

.selector-series-table .selector-head,
.selector-series-table .selector-row {
  grid-template-columns: minmax(180px, .9fr) 100px minmax(300px, 1.5fr);
  min-width: 520px;
}

.selector-head {
  background: #e9f2ff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.selector-row,
.selector-clear-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  text-align: left;
}

.selector-row:nth-child(odd) {
  background: #f8fbff;
}

.selector-row:hover,
.selector-clear-row:hover {
  background: #fff8d8;
}

.selector-head span,
.selector-row span {
  min-height: 34px;
  padding: 7px 10px;
  border-right: 1px solid var(--line);
}

.selector-series-table .selector-head span,
.selector-series-table .selector-row span {
  min-height: 30px;
  padding: 6px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.selector-clear-row {
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 900;
}

.order-records-panel {
  scroll-margin-top: 18px;
}

.order-sheet-list {
  padding: 0;
  max-height: none;
}

.order-sheet {
  min-width: 1120px;
  overflow: auto;
}

.order-sheet-head,
.order-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.35fr) minmax(110px, 0.8fr) 110px 96px 76px 110px 110px 110px minmax(220px, 1.5fr);
  align-items: center;
  gap: 0;
}

.order-sheet-head {
  position: sticky;
  top: 0;
  z-index: 1;
  min-height: 38px;
  background: #f0f1ee;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.order-sheet-head span,
.order-cell {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.order-row {
  width: 100%;
  border: 0;
  border-left: 4px solid #aeb5b1;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.order-row:hover {
  background: #f7f8f6;
}

.order-row.order-status-待确认 {
  border-left-color: #8e9692;
}

.order-row.order-status-备货中,
.order-row.order-status-待发货,
.order-row.order-status-待收款 {
  border-left-color: #d98c00;
}

.order-row.order-status-已发货,
.order-row.order-status-已出库 {
  border-left-color: #2f6bff;
}

.order-row.order-status-已完成 {
  border-left-color: #00a676;
}

.order-no-cell {
  display: grid;
  align-content: center;
}

.order-no-cell strong,
.order-no-cell em {
  display: block;
}

.order-no-cell em {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.order-tail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.fee-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.order-summary-bar {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr)) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -10px 24px rgba(30, 47, 37, 0.08);
}

.order-summary-bar span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.order-summary-bar strong {
  font-size: 18px;
}

.records-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 230px);
  overflow: auto;
  padding: 12px;
}

.sheet-table {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  border-top: 1px solid var(--line);
}

.sheet-head,
.sheet-row {
  display: grid;
  align-items: center;
}

.partner-sheet .sheet-head,
.partner-sheet .sheet-row {
  grid-template-columns: minmax(130px, 1.3fr) minmax(80px, 0.7fr) minmax(100px, 0.8fr) 70px minmax(90px, 0.75fr) minmax(105px, 0.85fr) minmax(105px, 0.85fr) minmax(120px, 1fr) 70px;
}

.supplier-sheet .sheet-head,
.supplier-sheet .sheet-row {
  grid-template-columns: minmax(130px, 1.3fr) minmax(80px, 0.7fr) minmax(100px, 0.8fr) 70px minmax(100px, 0.8fr) minmax(110px, 0.9fr) minmax(115px, 0.9fr) minmax(120px, 1fr) 70px;
}

.movement-sheet .sheet-head,
.movement-sheet .sheet-row {
  grid-template-columns: 120px 140px 80px 130px minmax(160px, 1.2fr) 90px 120px 110px minmax(180px, 1.2fr);
}

.sheet-head {
  position: sticky;
  top: 0;
  z-index: 1;
  min-height: 38px;
  background: #f0f1ee;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.sheet-head span,
.sheet-row span {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  word-break: break-word;
}

.sheet-row {
  background: #fff;
  width: 100%;
  border: 0;
  color: var(--ink);
  font: inherit;
}

.sheet-row:hover {
  background: #f7f8f6;
}

.movement-sheet .sheet-row,
.order-row,
.partner-row {
  cursor: pointer;
}

.panel-heading-action {
  flex: 0 0 auto;
  margin-right: 10px;
}

.mini-records {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.mini-record-row {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.mini-record-row:hover {
  background: #f7f8f6;
}

.mini-record-row span {
  color: var(--muted);
  font-size: 12px;
}

.record-card {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px;
  background: #fbfcfb;
}

.order-card {
  position: relative;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  background: #fff;
  border-left: 4px solid #aeb5b1;
}

.order-card:hover {
  border-color: #8e9692;
  background: #f5f6f4;
}

.order-card.order-status-待确认 {
  border-left-color: #8e9692;
}

.order-card.order-status-备货中,
.order-card.order-status-待发货,
.order-card.order-status-待收款 {
  border-left-color: #d98c00;
}

.order-card.order-status-已发货,
.order-card.order-status-已出库 {
  border-left-color: #2f6bff;
}

.order-card.order-status-已完成 {
  border-left-color: #00a676;
}

.order-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px 12px 8px;
  background: #fbfcfb;
  border-bottom: 1px solid var(--line);
}

.order-card-head strong {
  margin: 0;
  font-size: 15px;
}

.order-card-balance {
  min-width: 96px;
  padding: 7px 9px;
  border-radius: 4px;
  background: #eef3ec;
  text-align: right;
}

.order-card-balance span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.order-card-balance strong {
  margin: 0;
  font-size: 14px;
}

.order-card-balance.is-unpaid {
  background: #fff3df;
  color: var(--warning);
}

.order-card .record-meta,
.order-card .order-items-preview,
.order-card .finance-row,
.order-card .fee-preview,
.order-card > p,
.order-card .order-card-timeline {
  margin-left: 12px;
  margin-right: 12px;
}

.order-card .record-meta {
  margin-top: 10px;
}

.record-card strong {
  display: block;
  margin-bottom: 6px;
}

.card-topline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  margin-bottom: 4px;
}

.card-topline strong {
  margin: 0;
}

.partner-card {
  cursor: pointer;
}

.partner-card:hover {
  border-color: #c8cbc6;
  background: #f7f8f6;
}

.movement-edit-button {
  margin-top: 12px;
}

.order-detail-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.detail-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.order-detail-lines {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.order-detail-tracking-form {
  display: grid;
  grid-template-columns: 160px 150px minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f7f8f6;
}

.order-detail-tracking-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.order-detail-tracking-form input,
.order-detail-tracking-form select {
  min-height: 40px;
}

.order-detail-line {
  display: grid;
  grid-template-columns: 120px minmax(130px, 1fr) 80px 70px 70px 80px minmax(90px, 1fr);
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.order-detail-line:last-child {
  border-bottom: 0;
}

.order-detail-line em {
  color: var(--muted);
  font-style: normal;
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.stack-grid {
  display: grid;
  gap: 12px;
}

.section-subtitle {
  margin: 12px 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  color: var(--muted);
}

.finance-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin-top: 12px;
  padding: 12px;
  background: #f8faf7;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 13px;
}

.order-items-preview {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.order-items-preview div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.order-items-preview strong {
  margin: 0;
}

.order-items-preview span {
  color: var(--muted);
  text-align: right;
}

.fee-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.fee-preview span {
  padding: 6px 9px;
  border-radius: 8px;
  background: #eef3ec;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.danger-text {
  color: var(--danger);
  font-weight: 800;
}

.good-text {
  color: var(--good);
  font-weight: 800;
}

.timeline {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.timeline-item {
  display: grid;
  gap: 3px;
  padding-left: 12px;
  border-left: 3px solid var(--line);
}

.timeline-item span {
  color: var(--muted);
  font-size: 12px;
}

.timeline-item strong {
  margin: 0;
  font-size: 13px;
}

.timeline-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.empty-state {
  min-height: 96px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    width: auto;
    height: auto;
    padding: 16px;
  }

  .sidebar:hover,
  .sidebar:focus-within {
    width: auto;
    box-shadow: none;
  }

  .nav-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .brand,
  .nav-tab,
  .sidebar-note {
    min-width: 0;
  }

  .sidebar-note {
    display: none;
  }

  .work-grid {
    grid-template-columns: 1fr 1fr;
  }

  .order-entry-panel {
    grid-column: span 2;
  }

  .order-head {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .detail-panel {
    grid-column: span 2;
  }

  .order-filter-bar {
    grid-template-columns: minmax(220px, 1fr) 108px 150px 150px;
  }

  .movement-filter-bar {
    grid-template-columns: 108px 150px 150px minmax(160px, 1fr) minmax(220px, 1.4fr);
  }
}

@media (max-width: 720px) {
  .main {
    padding: 16px;
  }

  .topbar,
  .topbar-actions,
  .toolbar,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-grid,
  .work-grid,
  .order-layout,
  .order-filter-bar,
  .movement-filter-bar,
  .order-head,
  .order-tail,
  .fee-grid,
  .order-summary-bar,
  .record-form,
  .detail-grid,
  .finance-row {
    grid-template-columns: 1fr;
  }

  .detail-panel,
  .span-2,
  .span-3 {
    grid-column: auto;
  }

  .order-entry-panel {
    grid-column: auto;
  }

  .order-items-preview div {
    display: grid;
  }

  .order-items-preview span {
    text-align: left;
  }

  .product-hero-row {
    align-items: center;
  }

  .product-image-wrap {
    width: 92px;
    height: 92px;
    flex-basis: 92px;
  }

  .bulk-series-bar {
    grid-template-columns: 1fr;
  }

  .nav-tabs {
    grid-template-columns: 1fr;
  }

  .toolbar select,
  .panel-heading select {
    max-width: none;
  }

  .order-tools-button {
    width: 100%;
  }
}

/* ERP workspace refresh: dense, document-first layout inspired by mature back-office systems. */
:root {
  --bg: #eef3f9;
  --surface: #ffffff;
  --surface-2: #f6f9fd;
  --ink: #1c2633;
  --muted: #667586;
  --line: #d7e0eb;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --warning: #b7791f;
  --danger: #b42318;
  --good: #147a45;
  --nav: #2f4778;
  --nav-deep: #263b66;
  --table-head: #eaf2ff;
  --table-selected: #fff9df;
  --shadow: 0 1px 2px rgba(24, 36, 52, 0.08);
}

body {
  background: var(--bg);
  color: var(--ink);
}

.app-shell {
  grid-template-columns: 70px minmax(0, 1fr);
}

.sidebar {
  width: 70px !important;
  padding: 8px 4px;
  gap: 7px;
  background: linear-gradient(180deg, #3f5f9b 0%, #304b7f 100%) !important;
  box-shadow: none;
  transition: none;
  overflow: visible;
}

.sidebar:hover,
.sidebar:focus-within {
  width: 70px !important;
  box-shadow: none;
}

.brand {
  min-width: 0 !important;
  width: 100%;
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 0 0 5px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: center;
}

.brand-item {
  position: relative;
  width: 100%;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border-color: rgba(255, 255, 255, 0.24);
  background: #f8fbff;
  color: var(--nav-deep);
}

.brand strong {
  font-size: 10px;
  letter-spacing: 0;
  line-height: 1.15;
}

.brand span {
  display: none;
}

.nav-tabs {
  gap: 5px;
  position: relative;
  overflow: visible;
}

.nav-item {
  position: relative;
  width: 100%;
}

.nav-tab,
.nav-menu-root {
  min-width: 0 !important;
  width: 100%;
  min-height: 48px;
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 6px 2px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.86) !important;
  text-align: center;
  font-family: inherit;
  font-size: 11px;
  line-height: 1.1;
  border: 0;
  background: transparent;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.nav-tab::before,
.nav-menu-root::before {
  content: attr(data-short);
  position: static;
  width: 24px;
  height: 20px;
  display: grid;
  place-items: center;
  transform: none;
  border: 0;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 12px;
  line-height: 20px;
}

.nav-tab.is-active,
.nav-tab:hover,
.nav-menu-root:hover {
  background: #2f7df6;
  color: #fff;
}

.nav-item:nth-child(1) > .nav-tab::before { background: #23a56f; }
.nav-item:nth-child(2) > .nav-tab::before { background: #e7a12a; }
.nav-item:nth-child(3) > .nav-tab::before { background: #8b5cf6; }
.nav-item:nth-child(4) > .nav-tab::before { background: #64748b; }
.nav-item:nth-child(5) > .nav-menu-root::before { background: #1d2939; }

.nav-flyout {
  position: absolute;
  top: 0;
  left: 70px;
  z-index: 90;
  display: none;
  width: min(560px, calc(100vw - 120px));
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 22px;
  padding: 18px;
  border: 1px solid #d7e2ef;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 20px 54px rgba(21, 34, 56, 0.22);
}

.nav-flyout::before {
  content: "";
  position: absolute;
  top: 18px;
  left: -8px;
  width: 14px;
  height: 14px;
  transform: rotate(45deg);
  border-left: 1px solid #d7e2ef;
  border-bottom: 1px solid #d7e2ef;
  background: #fff;
}

.nav-flyout::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -18px;
  width: 18px;
}

.nav-item:hover > .nav-flyout,
.nav-item:focus-within > .nav-flyout,
.brand-item:hover > .brand-flyout,
.brand-item:focus-within > .brand-flyout {
  display: grid;
}

.brand-flyout {
  top: 8px;
}

.nav-flyout-compact {
  width: 300px;
  grid-template-columns: 1fr;
}

.nav-menu-group {
  display: grid;
  gap: 5px;
  align-content: start;
}

.nav-menu-group h3 {
  margin: 0 0 6px;
  padding-bottom: 7px;
  border-bottom: 1px solid #e5edf6;
  color: #1f6feb;
  font-size: 13px;
  line-height: 1.2;
}

.nav-menu-group button {
  display: flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #253142;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.nav-menu-group button:hover,
.nav-menu-group button:focus-visible {
  background: #edf5ff;
  color: #155eef;
  outline: none;
}

.sidebar:not(:hover):not(:focus-within) .brand > div:not(.brand-mark),
.sidebar:not(:hover):not(:focus-within) .sidebar-note {
  opacity: 1 !important;
  pointer-events: auto !important;
}

.sidebar:not(:hover):not(:focus-within) .nav-tab {
  color: rgba(255, 255, 255, 0.86) !important;
}

.sidebar-note {
  display: none;
}

.sidebar-note span {
  display: none;
}

.sidebar-note strong {
  font-size: 12px;
  line-height: 1.25;
}

.main {
  padding: 0;
  background: var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 12;
  margin: 0;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin-bottom: 3px;
  color: var(--accent);
  font-size: 11px;
}

h1 {
  font-size: 22px;
  line-height: 1.15;
}

.topbar-actions {
  gap: 7px;
}

.user-chip {
  color: var(--muted);
  font-size: 12px;
}

.summary-grid {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 10px 14px;
  background: #f4f7fb;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.metric-card {
  min-height: 62px;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.metric-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-card strong {
  margin-top: 5px;
  font-size: 24px;
  line-height: 1;
}

.view {
  padding: 12px 14px 18px;
}

.work-grid,
.order-layout,
.stack-grid {
  gap: 10px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-heading {
  min-height: 44px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #f8fbff);
}

.panel-heading h2 {
  font-size: 17px;
  line-height: 1.2;
}

.panel-heading p,
.section-subtitle,
.timeline-item p {
  color: var(--muted);
}

.toolbar,
.order-filter-bar,
.record-form,
.detail-grid,
.finance-row {
  gap: 8px;
}

.record-form {
  padding: 12px;
}

label {
  color: var(--muted);
}

.payment-type-options {
  display: flex;
  align-items: end;
  gap: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.payment-type-options legend {
  width: 100%;
  flex: 0 0 100%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 6px;
}

.payment-type-options label {
  min-height: 36px;
  min-width: 86px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  border: 1px solid #cfd9e6;
  border-right: 0;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.payment-type-options label:first-of-type {
  border-radius: 6px 0 0 6px;
}

.payment-type-options label:last-of-type {
  border-right: 1px solid #cfd9e6;
  border-radius: 0 6px 6px 0;
}

.payment-type-options input {
  width: 14px;
  height: 14px;
  min-height: 0;
  accent-color: #2563eb;
}

.payment-type-options label:has(input:checked) {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1px #2563eb;
}

.payment-type-options label:has(input:checked) + label {
  border-left-color: #2563eb;
}

input,
select,
textarea {
  min-height: 34px;
  border-color: #cfd9e6;
  border-radius: 4px;
  background: #fff;
}

textarea {
  min-height: 82px;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.28);
  outline-offset: 1px;
  border-color: var(--accent);
}

.primary-button,
.submit-button {
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  box-shadow: none;
}

.primary-button:hover,
.submit-button:hover {
  background: var(--accent-2);
}

.secondary-button,
.ghost-button,
.mini-button,
.order-tools-button,
.drawer-close,
.drawer-action-button {
  border-color: #cfd9e6;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
}

.secondary-button:hover,
.ghost-button:hover,
.mini-button:hover,
.order-tools-button:hover,
.drawer-close:hover,
.drawer-action-button:hover {
  border-color: #9db7db;
  background: #eef5ff;
}

.table-wrap,
.sheet-table,
.order-sheet {
  border-color: var(--line);
}

table th,
.sheet-head,
.order-sheet-head,
.movement-document-sheet .sheet-head {
  background: var(--table-head);
  color: #4d6380;
  font-size: 12px;
}

table th,
table td,
.sheet-head span,
.sheet-row span,
.order-sheet-head span,
.order-cell {
  padding: 7px 10px;
  border-color: var(--line);
}

tbody tr,
.sheet-row,
.order-row {
  background: #fff;
}

tbody tr:hover,
.sheet-row:hover,
.order-row:hover {
  background: #f7fbff;
}

tr.is-selected,
.product-row.is-selected,
.movement-document-row.is-selected {
  background: var(--table-selected);
}

.status-badge,
.record-meta span,
.tag,
.order-card-balance,
.product-stock-badge {
  border-radius: 999px;
  background: #edf4ef;
  color: #526354;
}

.status-badge.danger,
.is-unpaid {
  background: #fff1ef;
  color: var(--danger);
}

.status-badge.warning {
  background: #fff7e4;
  color: var(--warning);
}

.status-badge.good {
  background: #eaf8f0;
  color: var(--good);
}

.drawer-backdrop {
  background: rgba(24, 36, 52, 0.24);
}

.drawer-panel {
  padding: 12px;
  background: #f4f7fb;
  box-shadow: none;
}

.drawer-panel > .drawer-close {
  top: 8px;
  width: 38px;
  height: 38px;
  margin-bottom: 8px;
}

.order-detail-drawer {
  width: min(1180px, calc(100vw - 118px));
}

.order-detail-panel,
.movement-detail-panel {
  overflow: hidden;
  border-radius: 6px;
  background: #fff;
}

.order-detail-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #f8fbff);
}

.order-detail-header h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
}

.order-detail-body {
  gap: 10px;
  padding: 12px 16px 18px;
}

.detail-grid > div,
.order-detail-body > .detail-grid > div {
  border-color: var(--line);
  border-radius: 5px;
  background: #fbfdff;
}

.order-detail-tracking-form {
  grid-template-columns: 150px 140px minmax(220px, 1fr) auto;
  border-color: #c9dcf7;
  background: #f3f8ff;
}

.order-detail-lines,
.movement-detail-lines {
  border-radius: 5px;
  background: #fff;
}

.order-detail-line,
.movement-detail-line {
  min-height: 46px;
  border-color: var(--line);
}

.document-inline-edit {
  margin: 4px 0 12px;
  padding: 12px;
  border: 1px solid #bfd4f4;
  border-left: 5px solid var(--accent);
  border-radius: 6px;
  background: #f6faff;
}

.document-inline-edit::before {
  content: "正在修改整张单据";
  display: inline-block;
  margin: 0 0 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #dbeafe;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
}

.document-edit-lines {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
}

.document-edit-line {
  align-items: end;
  border-color: var(--line);
}

.document-inline-edit .inline-edit-actions {
  justify-content: flex-end;
}

.movement-document-card,
.record-card,
.mini-record-row,
.order-card {
  border-color: var(--line);
  border-radius: 6px;
  background: #fff;
}

.movement-document-card:hover,
.record-card:hover,
.mini-record-row:hover,
.order-card:hover {
  border-color: #a9bedc;
  background: #f8fbff;
}

.movement-document-sheet .sheet-head,
.movement-document-sheet .sheet-row {
  grid-template-columns: minmax(180px, 1.35fr) 108px 120px 74px 90px 120px minmax(220px, 1fr);
}

.movement-detail-line {
  grid-template-columns: 150px minmax(180px, 1fr) 90px 90px minmax(160px, 1fr);
}

.movement-detail-line .mini-button {
  display: none;
}

.recent-movement-card {
  position: relative;
  padding-right: 44px;
}

.recent-movement-edit {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 5px;
  color: var(--accent);
}

.movement-detail-panel .order-detail-header {
  padding: 12px 16px;
}

.movement-detail-panel .order-detail-header h1 {
  margin: 0 0 4px;
  font-size: 28px;
  line-height: 1.08;
}

.movement-detail-panel .order-detail-body {
  padding: 12px 16px 16px;
}

.movement-detail-panel .document-inline-edit {
  position: relative;
  grid-template-columns: 132px 168px 180px minmax(280px, 1fr);
  gap: 8px 10px;
  align-items: end;
  margin: 2px 0 12px;
  padding: 10px 12px 54px;
  min-height: 0;
  border-color: #b9d2fb;
  border-left-width: 5px;
  background: #f7fbff;
}

.movement-detail-panel .document-inline-edit::before {
  margin: 0;
  align-self: end;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.movement-detail-panel .document-inline-edit label {
  gap: 4px;
}

.movement-detail-panel .document-inline-edit input,
.movement-detail-panel .document-inline-edit select {
  min-height: 36px;
  padding: 6px 10px;
}

.movement-detail-panel .document-actor-chip {
  min-height: 36px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px;
  align-items: center;
  padding: 6px 10px;
}

.movement-detail-panel .document-actor-chip span {
  margin: 0;
}

.movement-detail-panel .document-actor-chip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.movement-detail-panel .document-inline-edit label.span-2 {
  grid-column: 1 / -1;
}

.movement-detail-panel .document-edit-lines {
  grid-column: 1 / -1;
  padding: 8px;
  border-color: #d8e2ef;
}

.movement-detail-panel .document-edit-line {
  grid-template-columns: minmax(360px, 1fr) 90px 76px 90px 36px;
  gap: 6px;
}

.movement-detail-panel .document-edit-line input,
.movement-detail-panel .document-edit-line select {
  min-height: 34px;
}

.movement-detail-panel .document-edit-head {
  min-height: 22px;
}

.movement-detail-panel .add-line-row-button {
  min-height: 34px;
  margin-top: 6px;
}

.movement-detail-panel .document-inline-edit .inline-edit-actions {
  position: absolute;
  right: 12px;
  bottom: 10px;
  grid-column: auto;
}

.image-modal-panel,
.login-card {
  border-radius: 8px;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .sidebar:hover,
  .sidebar:focus-within {
    width: auto;
    height: auto;
  }

  .nav-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .order-detail-drawer {
    width: 96vw;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 0;
  }

  .topbar {
    align-items: flex-start;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .view {
    padding: 10px;
  }

  .order-detail-tracking-form {
    grid-template-columns: 1fr;
  }
}

.workspace-tabs {
  display: flex;
  gap: 2px;
  align-items: end;
  min-height: 30px;
  padding: 3px 10px 0;
  border-bottom: 1px solid var(--line);
  background: #edf3fb;
  overflow-x: auto;
}

.workspace-tab {
  min-width: 104px;
  max-width: 260px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 8px;
  align-items: center;
  padding: 5px 8px 6px;
  border: 1px solid #cfd9e6;
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
  background: #f8fbff;
  color: #526174;
  text-align: left;
}

.workspace-tab span {
  overflow: hidden;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-tab em {
  display: none;
}

.workspace-tab b {
  width: 16px;
  height: 16px;
  display: grid;
  grid-row: 1;
  grid-column: 2 / 3;
  place-items: center;
  border-radius: 4px;
  color: #64748b;
  font-size: 14px;
  line-height: 1;
}

.workspace-tab b:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.workspace-tab.is-active {
  position: relative;
  z-index: 1;
  background: #fff;
  color: var(--accent-2);
  box-shadow: 0 -1px 0 #fff inset;
}

.dashboard-shell {
  display: grid;
  gap: 12px;
}

.dashboard-hero {
  min-height: 96px;
  display: grid;
  grid-template-columns: 0.8fr 1.6fr;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  overflow: hidden;
  color: #f8fbff;
  background:
    linear-gradient(135deg, #172554 0%, #1d4ed8 58%, #0f766e 100%);
}

.dashboard-hero .eyebrow,
.dashboard-hero p {
  color: rgba(248, 251, 255, 0.78);
}

.dashboard-hero h2 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.1;
}

.dashboard-hero p {
  max-width: 720px;
  margin-bottom: 0;
}

.dashboard-hero-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.dashboard-hero-actions button {
  min-height: 72px;
  display: grid;
  gap: 5px;
  align-content: center;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  text-align: left;
  backdrop-filter: blur(10px);
}

.dashboard-hero-actions button:hover {
  background: rgba(255, 255, 255, 0.16);
}

.dashboard-hero-actions span,
.dashboard-hero-actions em {
  color: rgba(248, 251, 255, 0.74);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.dashboard-hero-actions strong {
  color: #fff;
  font-size: 20px;
  line-height: 1;
}

.dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 10px;
}

.dashboard-action-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dashboard-kpi {
  min-height: 96px;
  display: grid;
  gap: 6px;
  align-content: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
  box-shadow: var(--shadow);
}

.dashboard-kpi:hover {
  border-color: #9db7db;
  background: #f8fbff;
}

.dashboard-kpi span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.dashboard-kpi strong {
  color: #102033;
  font-size: 26px;
  line-height: 1;
}

.dashboard-kpi em {
  color: #64748b;
  font-size: 12px;
  font-style: normal;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-card {
  min-height: 300px;
  padding: 14px;
}

.dashboard-card-wide {
  grid-column: span 2;
}

.dashboard-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}

.dashboard-card-head h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.dashboard-card-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-card-head > span {
  padding: 4px 8px;
  border-radius: 999px;
  background: #eaf2ff;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.dashboard-bar-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(150px, 1.1fr) minmax(110px, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-top: 1px solid #edf2f7;
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.dashboard-bar-row:hover {
  background: #f8fbff;
}

.dashboard-bar-row strong,
.dashboard-bar-row span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-bar-row strong {
  font-size: 13px;
}

.dashboard-bar-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.dashboard-bar-row b {
  font-size: 12px;
  white-space: nowrap;
}

.drilldown-panel {
  min-height: calc(100vh - 170px);
}

.compact-summary {
  margin-bottom: 12px;
}

.drilldown-body {
  display: grid;
  gap: 12px;
}

.drilldown-sheet .sheet-head,
.drilldown-sheet .sheet-row {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.order-drilldown-sheet .sheet-head,
.order-drilldown-sheet .sheet-row {
  grid-template-columns: 1.4fr 1.1fr 0.9fr 0.8fr 0.9fr 0.9fr;
}

.drilldown-sheet .sheet-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.drilldown-sheet .sheet-row:hover {
  background: #f6f9fd;
}

.opening-balance-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 16px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid #f2d49a;
  border-radius: 8px;
  background: #fff8e8;
}

.opening-balance-card strong {
  font-size: 16px;
}

.opening-balance-card span {
  color: var(--muted);
  font-size: 13px;
}

.opening-balance-card b {
  grid-row: 1 / 3;
  grid-column: 2;
  color: var(--warning);
  font-size: 22px;
}

.dashboard-bar-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f7;
}

.dashboard-bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #14b8a6);
}

.dashboard-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.dashboard-flow div {
  min-height: 108px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.dashboard-flow span,
.dashboard-flow em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.dashboard-flow strong {
  font-size: 28px;
  line-height: 1;
}

.account-drawer-panel {
  width: min(980px, calc(100vw - 72px));
  max-width: none;
  box-sizing: border-box;
  padding: 10px 12px 16px;
}

.account-panel {
  overflow: visible;
}

.account-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 10px 12px;
  padding: 12px;
}

.account-form > label,
.account-form input,
.account-form select {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.account-form.is-editing {
  position: relative;
  margin: 14px;
  border: 2px solid #2563eb;
  border-left-width: 8px;
  background: linear-gradient(135deg, #eff6ff 0%, #ffffff 54%, #eef2ff 100%);
  box-shadow: 0 18px 42px rgba(37, 99, 235, 0.18);
}

.account-edit-banner {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 12px 14px;
  border: 1px solid rgba(37, 99, 235, 0.24);
  border-radius: 8px;
  background: #1d4ed8;
  color: #fff;
}

.account-edit-banner strong {
  font-size: 18px;
}

.account-edit-banner span {
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
  font-weight: 700;
}

.permission-editor {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 12px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
  box-sizing: border-box;
}

.permission-editor legend {
  padding: 0 8px;
  color: #1e3a8a;
  font-size: 13px;
  font-weight: 900;
}

.permission-editor p {
  grid-column: 1 / -1;
  margin: 0;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.permission-editor label {
  min-height: 42px;
  min-width: 0;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
}

.permission-editor input {
  width: 18px;
  height: 18px;
}

.account-list {
  display: grid;
  margin: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.account-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(110px, 1fr) minmax(220px, 1.35fr) minmax(72px, 0.6fr) minmax(150px, 0.9fr);
  gap: 10px;
  align-items: center;
  min-width: 760px;
  min-height: 58px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.account-row:first-child {
  border-top: 0;
}

.account-row-head {
  min-height: 40px;
  background: #f1f5f9;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.account-row small {
  display: block;
  margin-top: 3px;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.account-status {
  display: inline-flex;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.account-status.is-active {
  background: #dcfce7;
  color: #166534;
}

.account-status.is-disabled {
  background: #fee2e2;
  color: #991b1b;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

@media (max-width: 1180px) {
  .dashboard-hero,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-card-wide {
    grid-column: auto;
  }

  .dashboard-kpis {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }
}

@media (max-width: 720px) {
  .account-drawer-panel {
    width: calc(100vw - 20px);
    padding: 8px;
  }

  .workspace-tabs {
    padding-inline: 10px;
  }

  .dashboard-hero,
  .dashboard-kpis {
    grid-template-columns: 1fr;
  }

  .dashboard-bar-row,
  .dashboard-flow {
    grid-template-columns: 1fr;
  }

  .account-form,
  .account-row {
    grid-template-columns: 1fr;
  }

  .account-row {
    min-width: 0;
  }

  .permission-editor {
    grid-template-columns: 1fr;
  }

  .account-actions {
    justify-content: flex-start;
  }
}
