:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #6c7786;
  --line: #dde3ea;
  --primary: #146c63;
  --primary-dark: #0d4e49;
  --accent: #b9475d;
  --soft-green: #e5f3ef;
  --soft-rose: #fae8ec;
  --soft-gold: #f7efd9;
  --shadow: 0 12px 30px rgba(24, 33, 45, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  color: var(--text);
  background: var(--bg);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

body.auth-locked {
  display: block;
}

body.auth-locked .sidebar,
body.auth-locked .app-shell {
  display: none;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(20, 108, 99, 0.1), rgba(185, 71, 93, 0.08)),
    var(--bg);
}

body.auth-locked .login-screen {
  display: grid;
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.login-card img {
  width: 104px;
  height: 104px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
}

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

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

.login-card p.error {
  color: var(--accent);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px 18px;
  background: #17202a;
  color: #ffffff;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.brand-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  padding: 8px 4px 24px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  text-align: left;
  background: transparent;
}

.brand-mark {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  overflow: hidden;
  background: #f1c6cf;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
}

.brand-block h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.3;
  font-weight: 800;
}

.brand-entry:hover {
  background: rgba(255, 255, 255, 0.06);
}

.nav-tabs {
  display: grid;
  gap: 8px;
  margin-top: 22px;
  padding-bottom: 28px;
}

.nav-tab {
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  text-align: left;
  color: rgba(255, 255, 255, 0.76);
  background: transparent;
}

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

.nav-subtabs {
  display: none;
  gap: 2px;
  margin: -4px 0 2px 14px;
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.14);
}

.nav-subtabs.show {
  display: grid;
}

.nav-direct-tab {
  width: 100%;
  min-height: 28px;
  border: 0;
  border-radius: 6px;
  padding: 0 8px;
  color: rgba(255, 255, 255, 0.62);
  background: transparent;
  text-align: left;
  font-size: 12px;
}

.nav-direct-tab:hover,
.nav-direct-tab.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.app-shell {
  min-width: 0;
  padding: 26px;
}

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

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.topbar h2 {
  margin: 4px 0 0;
  font-size: 28px;
  letter-spacing: 0;
}

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

.cloud-sync-status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 10px;
  color: var(--muted);
  background: #edf2f5;
  font-size: 12px;
  white-space: nowrap;
}

.cloud-sync-status.synced {
  color: var(--primary-dark);
  background: var(--soft-green);
}

.cloud-sync-status.syncing {
  color: #725819;
  background: var(--soft-gold);
}

.cloud-sync-status.offline {
  color: #8f2639;
  background: var(--soft-rose);
}

.cloud-sync-status.conflict {
  color: #725819;
  background: var(--soft-gold);
}

.cloud-sync-status.migration {
  color: #7c4e14;
  background: #fff4d8;
}

.cloud-migration-button {
  min-height: 30px;
  border: 1px solid #237cff;
  border-radius: 999px;
  padding: 0 12px;
  color: #fff;
  background: linear-gradient(135deg, #2f8cff, #146de8);
  box-shadow: 0 8px 18px rgba(35, 124, 255, 0.2);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.cloud-migration-button:hover {
  filter: brightness(1.04);
}

.cloud-migration-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  color: var(--text);
  background: #ffffff;
  font-size: 12px;
  white-space: nowrap;
}

.admin-only.is-hidden {
  display: none;
}

.primary-button,
.ghost-button,
.icon-button,
.danger-button {
  min-height: 38px;
  border-radius: 7px;
  border: 1px solid transparent;
  padding: 0 14px;
  white-space: nowrap;
}

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

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

.danger-button {
  color: #ffffff;
  background: var(--accent);
}

.danger-button:hover {
  background: #92364a;
}

.ghost-button,
.icon-button {
  background: #ffffff;
  color: var(--text);
  border-color: var(--line);
}

.icon-button {
  width: 38px;
  padding: 0;
  font-size: 18px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

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

.metric {
  padding: 18px;
}

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

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.metric.warning strong {
  color: var(--accent);
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 18px;
}

.dashboard-flow-panel {
  margin-bottom: 18px;
}

.flow-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 18px;
}

.flow-placeholder {
  min-height: 96px;
}

.flow-item {
  min-height: 74px;
  display: grid;
  align-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
  text-align: center;
}

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

.flow-item strong {
  font-size: 22px;
}

.dashboard-sales-split {
  display: grid;
  gap: 14px;
}

.dashboard-section-head,
.dashboard-customer-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-section-head h4,
.dashboard-customer-detail-head h4 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
}

.dashboard-section-head span,
.dashboard-customer-detail-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.dashboard-type-card {
  min-width: 0;
  min-height: 112px;
  display: grid;
  align-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--text);
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.dashboard-type-card.active {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary), 0 10px 24px rgba(20, 108, 99, 0.1);
}

.dashboard-type-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.dashboard-type-card strong {
  color: var(--primary);
  font-size: 24px;
  line-height: 1.1;
}

.dashboard-type-card em {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-customer-detail {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.dashboard-customer-detail-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.dashboard-customer-table-wrap table {
  min-width: 900px;
}

.dashboard-customer-table-wrap th,
.dashboard-customer-table-wrap td {
  text-align: center;
}

.dashboard-customer-table-wrap td:first-child {
  color: var(--ink);
  font-weight: 800;
  text-align: left;
}

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

.company-hero-panel {
  margin-bottom: 18px;
}

.company-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  text-align: left;
}

.company-hero img {
  width: 92px;
  height: 92px;
  border: 1px solid var(--line);
  border-radius: 12px;
  object-fit: contain;
  background: #ffffff;
}

.company-hero h3 {
  margin: 6px 0 0;
  font-size: 28px;
}

.company-info-grid,
.company-doc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.company-info-card {
  min-height: 100%;
}

.info-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0 18px 18px;
}

.info-list div {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.info-list div:last-child {
  border-bottom: 0;
}

.info-list dt {
  color: var(--muted);
  font-weight: 600;
}

.info-list dd {
  margin: 0;
  color: var(--text);
  font-weight: 700;
  word-break: break-word;
}

.document-actions {
  display: grid;
  gap: 12px;
  padding: 0 18px 18px;
}

.doc-link {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.document-card {
  overflow: hidden;
}

.document-frame {
  width: 100%;
  height: 560px;
  display: block;
  border: 0;
  border-top: 1px solid var(--line);
  background: #f8fafb;
}

.document-image-wrap {
  height: 560px;
  display: grid;
  place-items: center;
  border-top: 1px solid var(--line);
  padding: 14px;
  background: #f8fafb;
}

.document-image-wrap img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 8px 24px rgba(23, 32, 42, 0.12);
}

.ranking-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfcfd;
}

.ranking-card h4 {
  margin: 0 0 14px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.35;
}

.ranking-list {
  display: grid;
  gap: 10px;
}

.ranking-row {
  display: grid;
  grid-template-columns: 28px 54px minmax(0, 1fr) minmax(96px, auto);
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff;
}

.ranking-index {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: #e8f2ef;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.ranking-thumb {
  width: 54px;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  object-fit: cover;
}

.ranking-main {
  min-width: 0;
}

.ranking-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.ranking-title strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ranking-title span {
  color: var(--muted);
  font-size: 11px;
}

.ranking-bar {
  height: 6px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ecef;
}

.ranking-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.ranking-row em {
  color: var(--ink);
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.ranking-empty {
  min-height: 164px;
  display: grid;
  place-items: center;
}

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

.direct-grid {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 16px;
  padding: 0;
}

.direct-grid-single {
  grid-template-columns: 1fr;
}

.direct-subnav {
  display: grid;
  align-content: start;
  gap: 8px;
}

.direct-subnav button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: #fff;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.direct-subnav button.active {
  border-color: var(--primary);
  color: #fff;
  background: var(--primary);
}

.direct-workspace {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 0;
}

.direct-workspace-head {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: center;
  gap: 10px;
}

.direct-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.direct-workspace h4 {
  margin: 5px 0 0;
  color: var(--ink);
  font-size: 26px;
  line-height: 1.15;
}

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

.direct-stat-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.direct-stat-grid span {
  color: var(--muted);
  font-size: 12px;
}

.direct-stat-grid strong {
  display: block;
  margin-top: 6px;
  color: var(--primary);
  font-size: 20px;
}

.direct-section-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.direct-period-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-column: 1 / span 3;
  gap: 10px;
}

.direct-period-tabs button {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fff;
  font-weight: 800;
  cursor: pointer;
}

.direct-period-tabs button.active {
  border-color: var(--primary);
  color: #fff;
  background: var(--primary);
}

.direct-date-panel {
  display: grid;
  grid-template-columns: auto minmax(150px, 190px) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  grid-column: 4 / span 3;
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  background: #fff;
}

.direct-date-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.direct-date-input {
  min-height: 38px;
  border-color: transparent;
  background: #f6f8fa;
}

.direct-range-badge {
  justify-self: end;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.direct-section-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.direct-section-card h5 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
}

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

.direct-section-card > h5 {
  margin-bottom: 12px;
}

.direct-detail-date-control {
  width: 220px;
  min-height: 38px;
}

.direct-table-wrap table {
  min-width: 820px;
}

.direct-table-wrap th,
.direct-table-wrap td {
  text-align: center;
}

.direct-table-wrap td:first-child {
  text-align: left;
}

.direct-receivable-head {
  margin-bottom: 12px;
}

.direct-receivable-head h5 {
  margin-bottom: 4px;
}

.direct-receivable-head span {
  color: var(--muted);
  font-size: 12px;
}

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

.direct-receivable-summary > div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8fafb;
}

.direct-receivable-summary span,
.direct-receivable-summary strong {
  display: block;
}

.direct-receivable-summary span {
  color: var(--muted);
  font-size: 12px;
}

.direct-receivable-summary strong {
  margin-top: 4px;
  color: var(--primary);
  font-size: 18px;
}

.direct-receivable-summary .danger-text {
  color: var(--danger);
}

.direct-receivable-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.direct-receivable-table {
  width: 100%;
  min-width: 0 !important;
  table-layout: fixed;
}

.direct-receivable-table th,
.direct-receivable-table td {
  vertical-align: middle;
}

.direct-receivable-table td:nth-child(1),
.direct-receivable-table td:nth-child(2) {
  text-align: left;
}

.direct-receivable-table td:nth-child(1),
.direct-receivable-table td:nth-child(3),
.direct-receivable-table td:nth-child(4) {
  white-space: nowrap;
}

.direct-receivable-table th:nth-child(1) {
  width: 15%;
}

.direct-receivable-table th:nth-child(2) {
  width: 30%;
}

.direct-receivable-table th:nth-child(3) {
  width: 12%;
}

.direct-receivable-table th:nth-child(4) {
  width: 13%;
}

.direct-receivable-table th:nth-child(5) {
  width: 12%;
}

.direct-receivable-table th:nth-child(6) {
  width: 18%;
}

.direct-receivable-row.paid {
  background: #f6fbf9;
}

.direct-receivable-items {
  color: var(--text);
  font-size: 12px;
  line-height: 1.55;
  white-space: normal;
  overflow-wrap: anywhere;
}

.direct-receivable-status {
  width: 100%;
  min-height: 36px;
  padding: 6px 8px;
  font-size: 13px;
}

.direct-receivable-note {
  width: 100%;
  min-height: 36px;
  padding: 6px 8px;
}

.direct-expense-form {
  display: grid;
  gap: 14px;
  border-radius: 8px;
  background: #fbfcfd;
}

.direct-expense-fields {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.direct-expense-bottom {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.direct-expense-date-field {
  grid-column: span 2;
}

.direct-expense-type-field {
  grid-column: span 2;
}

.direct-expense-product-field {
  grid-column: span 6;
}

.direct-expense-amount-field {
  grid-column: span 2;
}

.direct-expense-note-field {
  grid-column: span 10;
}

.direct-expense-form .primary-button {
  grid-column: span 2;
  min-height: 42px;
  align-self: end;
}

.direct-mini-list {
  display: grid;
  gap: 8px;
}

.direct-mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.direct-mini-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.direct-mini-row strong,
.direct-mini-row span {
  display: block;
}

.direct-mini-row strong {
  color: var(--ink);
  font-size: 13px;
}

.direct-mini-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.direct-mini-row em {
  color: var(--primary);
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.direct-mini-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel,
.table-panel {
  margin-bottom: 18px;
}

.panel-heading {
  padding: 18px 18px 0;
}

.panel-heading.flat {
  padding-bottom: 14px;
}

.panel-heading h3 {
  margin: 0;
  font-size: 17px;
}

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

.import-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  padding: 18px;
}

.import-upload-box {
  min-height: 112px;
  align-content: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fbfcfd;
  cursor: pointer;
}

.import-upload-box span {
  color: var(--muted);
  font-size: 13px;
}

.import-upload-box strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 18px;
  word-break: break-all;
}

.import-upload-box input {
  display: none;
}

.import-actions {
  display: grid;
  align-content: center;
  gap: 10px;
}

.import-actions p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.module-import-dialog {
  width: min(680px, calc(100vw - 32px));
}

.module-import-dialog > p {
  margin: 6px 0 14px;
  color: var(--muted);
  line-height: 1.6;
}

.module-import-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.module-import-fields span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  color: var(--primary-dark);
  background: var(--soft-green);
  font-size: 12px;
}

.module-import-upload {
  display: block;
  min-height: 96px;
  margin-bottom: 16px;
}

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

.account-form {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.account-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(180px, 260px);
  gap: 12px;
  justify-content: end;
}

label {
  display: grid;
  gap: 7px;
  color: #3a4654;
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 11px;
  color: var(--text);
  background: #ffffff;
}

textarea {
  min-height: 86px;
  padding: 10px 11px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(20, 108, 99, 0.18);
  border-color: var(--primary);
}

input[readonly] {
  color: #41505f;
  background: #f5f7f9;
}

.checkbox-list {
  min-height: 48px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: flex-start;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px;
  background: #ffffff;
}

.checkbox-option {
  width: 82px;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  color: #3a4654;
  background: #fbfcfd;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.checkbox-option input {
  width: 14px;
  min-height: 14px;
  accent-color: var(--primary);
}

.checkbox-option:has(input:checked) {
  color: var(--primary-dark);
  border-color: rgba(20, 108, 99, 0.35);
  background: var(--soft-green);
}

.checkbox-option:has(input:checked)::after {
  content: "✓";
  font-weight: 700;
}

.checkbox-option:has(input:disabled) {
  cursor: default;
}

#customerChannel.checkbox-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

#customerChannel .checkbox-option {
  width: 100%;
  min-width: 0;
  gap: 4px;
  padding: 0 6px;
  font-size: 12px;
}

#customerChannel .checkbox-option input {
  width: 13px;
  min-height: 13px;
}

.inline-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 0.8fr) auto auto;
  gap: 8px;
}

.compact-button {
  min-width: 58px;
  padding: 0 10px;
}

.brand-delete-button {
  color: #c54859;
  border-color: rgba(197, 72, 89, 0.34);
}

.brand-delete-button:hover {
  color: #ffffff;
  border-color: #c54859;
  background: #c54859;
}

.form-actions {
  align-self: end;
  justify-content: flex-end;
}

.wide-field {
  grid-column: 1 / -1;
}

.supplier-form {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  align-items: end;
}

.supplier-form .wide-field {
  grid-column: 1 / 4;
}

.supplier-form .address-field {
  grid-column: 1 / -1;
}

.supplier-actions {
  grid-column: 4;
  align-self: stretch;
  display: grid;
  align-content: end;
  gap: 10px;
  padding: 0;
  background: transparent;
}

.supplier-actions .primary-button,
.supplier-actions .ghost-button {
  width: 100%;
}

.purchase-form {
  grid-template-columns: repeat(3, minmax(170px, 1fr)) minmax(190px, 0.78fr);
  align-items: end;
}

.purchase-document-form {
  display: grid;
  gap: 22px;
  padding: 16px 18px 18px;
}

.purchase-document-header {
  display: grid;
  grid-template-columns: minmax(280px, 1.7fr) minmax(180px, 0.75fr) repeat(3, minmax(150px, 0.62fr));
  gap: 14px;
  align-items: end;
}

.purchase-document-summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 14px;
  color: var(--muted);
  background: #f8fafb;
  font-size: 13px;
}

.purchase-document-summary strong {
  color: var(--primary-dark);
  font-size: 20px;
}

.purchase-document-actions {
  display: contents;
}

.purchase-document-actions .primary-button,
.purchase-document-actions .ghost-button {
  width: 100%;
  min-height: 44px;
}

.purchase-lines-card {
  display: grid;
  gap: 16px;
}

.purchase-lines-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.purchase-lines-heading > div {
  display: grid;
  gap: 4px;
}

.purchase-lines-heading h4 {
  margin: 0;
  color: var(--text);
  font-size: 17px;
}

.purchase-lines-heading span {
  color: var(--muted);
  font-size: 13px;
}

.purchase-lines-heading > strong {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 11px;
  color: var(--primary-dark);
  background: var(--soft-green);
  font-size: 12px;
}

.purchase-line-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 138px;
  grid-template-rows: auto auto auto;
  gap: 16px 18px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fbfcfd;
}

.purchase-product-fields {
  grid-column: 1;
  grid-row: 1;
  display: grid;
  grid-template-columns: minmax(230px, 0.9fr) minmax(360px, 1.6fr);
  gap: 14px;
}

.purchase-product-fields label,
.purchase-line-detail-fields label {
  min-width: 0;
}

.purchase-line-image {
  grid-column: 2;
  grid-row: 1 / 3;
  min-height: 0;
  height: 100%;
  padding: 12px;
  background: #ffffff;
}

.purchase-line-image img {
  width: 88px;
  height: 88px;
  flex-basis: 88px;
}

.purchase-line-detail-fields {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.purchase-qty-field {
  grid-column: 1;
}

.purchase-gift-field {
  grid-column: 2;
}

.purchase-price-field {
  grid-column: 3;
}

.purchase-average-field {
  grid-column: 4;
}

.purchase-batch-field {
  grid-column: 5;
}

.purchase-production-field {
  grid-column: 1 / 3;
}

.purchase-warranty-field {
  grid-column: 3;
}

.purchase-expiry-field {
  grid-column: 4 / 6;
}

.purchase-kit-batches {
  grid-column: 1 / -1;
  grid-row: auto;
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.purchase-kit-batches-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.purchase-kit-batches-heading strong {
  color: var(--text);
  font-size: 14px;
}

.purchase-kit-batches-heading span {
  color: var(--muted);
  font-size: 12px;
}

.purchase-kit-batch-table-wrap {
  border: 1px solid var(--line);
  border-radius: 7px;
}

.purchase-kit-batch-table {
  min-width: 860px;
  table-layout: fixed;
}

.purchase-kit-batch-table th,
.purchase-kit-batch-table td {
  padding: 8px;
  text-align: center;
  vertical-align: middle;
}

.purchase-kit-batch-table th:nth-child(1) {
  width: 180px;
}

.purchase-kit-batch-table th:nth-child(2) {
  width: 240px;
}

.purchase-kit-batch-table input {
  min-height: 36px;
}

.purchase-line-footer {
  grid-column: 1 / -1;
  grid-row: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.purchase-line-footer > span {
  color: var(--muted);
  font-size: 12px;
}

.purchase-add-line-button {
  width: min(220px, 100%);
  flex: 0 0 220px;
}

.purchase-entry-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.purchase-entry-table {
  width: 100%;
  min-width: 1024px;
  table-layout: fixed;
}

.purchase-entry-table th,
.purchase-entry-table td {
  padding: 9px 7px;
  text-align: center;
  vertical-align: middle;
}

.purchase-entry-table th:nth-child(1),
.purchase-entry-table td:nth-child(1) {
  width: 56px;
}

.purchase-entry-table th:nth-child(2),
.purchase-entry-table td:nth-child(2) {
  width: 300px;
}

.purchase-entry-table th:nth-child(3),
.purchase-entry-table td:nth-child(3) {
  width: 120px;
}

.purchase-entry-table th:nth-child(4),
.purchase-entry-table td:nth-child(4) {
  width: 125px;
}

.purchase-entry-table th:nth-child(5),
.purchase-entry-table td:nth-child(5) {
  width: 130px;
}

.purchase-entry-table th:nth-child(6),
.purchase-entry-table td:nth-child(6) {
  width: 145px;
}

.purchase-entry-table th:nth-child(7),
.purchase-entry-table td:nth-child(7) {
  width: 148px;
}

.purchase-item-product {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-align: left;
}

.purchase-item-product .order-item-thumb {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
}

.purchase-item-image-placeholder {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: #f5f7f9;
  font-size: 11px;
}

.purchase-item-product > div,
.purchase-item-stack {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.purchase-item-product strong,
.purchase-item-stack strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purchase-item-product small,
.purchase-item-stack small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.purchase-item-stack strong {
  color: var(--primary-dark);
}

.purchase-line-actions {
  justify-content: center;
  gap: 12px;
  white-space: nowrap;
}

.purchase-line-locked {
  width: 100%;
  color: #9b6b22;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.purchase-line-actions .link-button:disabled {
  cursor: not-allowed;
  color: #a7b4c4;
  opacity: .7;
}

.purchase-total-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.purchase-total-strip > span {
  min-width: 0;
  padding: 0 18px;
  text-align: center;
}

.purchase-total-strip > span + span {
  border-left: 1px solid var(--line);
}

.purchase-total-strip strong {
  color: var(--primary-dark);
  font-size: 16px;
}

.order-form {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  align-items: end;
}

.order-meta-field,
.order-wide-field {
  grid-column: span 2;
}

.order-party-card {
  grid-column: span 2;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-self: stretch;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.order-party-card h4 {
  grid-column: 1 / -1;
  margin: 0 0 2px;
  color: var(--text);
  font-size: 16px;
}

.order-party-card label:nth-of-type(2),
.order-party-card label:nth-of-type(5) {
  grid-column: 1 / -1;
}

.autocomplete-field {
  position: relative;
  display: block;
}

.autocomplete-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: none;
  max-height: 228px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.14);
}

.autocomplete-menu.show {
  display: grid;
  gap: 4px;
}

.autocomplete-menu button {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.autocomplete-menu button:hover {
  background: #edf7f4;
}

.autocomplete-menu button span,
.autocomplete-empty {
  color: var(--muted);
  font-size: 12px;
}

.autocomplete-empty {
  padding: 10px;
}

.order-terms-card {
  grid-column: 1 / -1;
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.order-terms-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.order-terms-heading h4 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
}

.order-terms-heading span {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--primary-dark);
  background: var(--soft-green);
  font-size: 12px;
  font-weight: 700;
}

.fixed-term-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.fixed-term-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 42px;
  border: 1px solid #e8edf2;
  border-radius: 7px;
  padding: 10px 12px;
  background: #fbfcfd;
}

.fixed-term-item.is-wide {
  grid-column: 1 / -1;
}

.fixed-term-item span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.fixed-term-item p {
  margin: 0;
  color: #3a4654;
  font-size: 13px;
  line-height: 1.65;
}

.fixed-term-item strong {
  color: var(--text);
}

.order-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-self: end;
  align-content: end;
}

.order-actions .primary-button,
.order-actions .ghost-button {
  width: 100%;
}

.order-lines-card {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.order-entry-table-wrap {
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow-x: hidden;
}

.order-entry-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.order-entry-table th,
.order-entry-table td {
  padding: 10px 8px;
  text-align: center;
  vertical-align: middle;
}

.order-entry-table th:nth-child(1),
.order-entry-table td:nth-child(1) {
  width: 48px;
}

.order-entry-table th:nth-child(2),
.order-entry-table td:nth-child(2) {
  width: 104px;
}

.order-entry-table th:nth-child(3),
.order-entry-table td:nth-child(3) {
  width: 140px;
}

.order-entry-table th:nth-child(4),
.order-entry-table td:nth-child(4) {
  width: auto;
  white-space: nowrap;
}

.order-entry-table td:nth-child(4) {
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-entry-table th:nth-child(5),
.order-entry-table td:nth-child(5) {
  width: 70px;
}

.order-entry-table th:nth-child(6),
.order-entry-table td:nth-child(6) {
  width: 62px;
}

.order-entry-table th:nth-child(7),
.order-entry-table td:nth-child(7) {
  width: 78px;
}

.order-entry-table th:nth-child(8),
.order-entry-table td:nth-child(8) {
  width: 86px;
}

.order-entry-table th:nth-child(9),
.order-entry-table td:nth-child(9) {
  width: 64px;
}

.order-entry-table th:nth-child(10),
.order-entry-table td:nth-child(10) {
  width: 64px;
}

.order-entry-row input,
.order-entry-row select {
  min-height: 36px;
  padding: 0 6px;
  text-align: center;
}

.order-entry-row select {
  font-size: 12px;
}

#saleOrderProductNamePreview {
  padding: 0 10px;
  text-align: left;
  font-size: 12px;
}

.order-entry-row input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.order-entry-row input[type="number"]::-webkit-outer-spin-button,
.order-entry-row input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.order-inline-image {
  display: grid;
  place-items: center;
  min-height: 64px;
  color: var(--muted);
  font-size: 12px;
}

.order-inline-image img {
  display: none;
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.order-inline-image.has-image img {
  display: block;
}

.order-inline-image.has-image span {
  display: none;
}

.order-item-thumb {
  width: 54px;
  height: 54px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.order-line-editor {
  display: grid;
  grid-template-columns: minmax(280px, 2fr) repeat(4, minmax(110px, 1fr)) minmax(120px, 0.7fr);
  gap: 12px;
  align-items: end;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.order-line-editor .primary-button {
  width: 100%;
  min-height: 46px;
}

.order-total-strip {
  display: flex;
  justify-content: flex-end;
  gap: 28px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  color: #3a4654;
  background: #fbfcfd;
}

.order-total-strip strong {
  color: var(--primary-dark);
  font-size: 18px;
}

.product-form {
  grid-template-columns: repeat(3, minmax(170px, 1fr)) minmax(190px, 0.78fr);
  align-items: end;
}

.product-brand-field {
  grid-column: span 2;
}

.product-name-field {
  grid-column: span 2;
}

.kit-components-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.kit-template-panel {
  margin-top: 2px;
  padding: 14px 16px;
  border: 1px solid #dce9f8;
  border-radius: 12px;
  background: linear-gradient(135deg, #fbfdff 0%, #f4f9ff 100%);
}

.kit-template-panel .kit-components-heading {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(520px, 0.9fr);
  align-items: center;
  gap: 30px;
}

.kit-template-panel .kit-component-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding-top: 12px;
  border-top: 1px solid #e0ebf8;
}

.kit-template-panel .kit-component-list[hidden] {
  display: none;
}

.kit-template-panel .kit-components-heading > div:first-child {
  gap: 6px;
}

.kit-template-panel .kit-components-heading strong {
  letter-spacing: 0.01em;
}

.kit-template-panel .kit-components-heading span {
  max-width: 760px;
  line-height: 1.65;
}

.kit-template-panel .kit-component-add {
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 12px;
}

.kit-template-panel .kit-component-add select,
.kit-template-panel .kit-component-add .ghost-button {
  height: 44px;
}

.kit-template-panel .kit-component-empty {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 2px 2px 0;
  color: #6d819a;
}

.kit-components-panel[hidden],
.purchase-kit-batches[hidden] {
  display: none;
}

.kit-components-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.kit-components-heading > div:first-child {
  display: grid;
  gap: 4px;
}

.kit-components-heading strong {
  color: var(--text);
  font-size: 15px;
}

.kit-components-heading span {
  color: var(--muted);
  font-size: 12px;
}

.kit-component-add {
  min-width: min(520px, 100%);
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 120px;
  gap: 10px;
}

.kit-component-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.kit-component-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  background: #fbfcfd;
}

.kit-component-row > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.kit-component-row strong,
.kit-component-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kit-component-row strong {
  color: var(--text);
  font-size: 13px;
}

.kit-component-row small {
  color: var(--muted);
  font-size: 12px;
}

.kit-component-empty {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
}

.assembly-component-scope {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -4px 0 12px;
  padding: 9px 12px;
  border: 1px solid #d6e7fb;
  border-radius: 9px;
  color: #5e7896;
  background: #f6faff;
  font-size: 12px;
}

.assembly-component-scope[hidden] {
  display: none;
}

.assembly-component-scope .link-button {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #c7ddfb;
  border-radius: 7px;
  color: #1768d7;
  background: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

.purchase-side-panel {
  grid-column: 4;
  grid-row: 1 / span 4;
  align-self: stretch;
  display: grid;
  grid-template-rows: minmax(116px, 1fr) auto;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.product-side-panel {
  grid-template-rows: auto minmax(116px, 1fr) auto;
}

.side-panel-title {
  color: #3a4654;
  font-size: 13px;
}

.purchase-actions {
  display: grid;
  gap: 10px;
}

.purchase-actions .primary-button,
.purchase-actions .ghost-button {
  width: 100%;
}

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

.toolbar input {
  max-width: 360px;
}

.brand-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-chip {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #3a4654;
  background: #ffffff;
  white-space: nowrap;
}

.filter-chip:hover,
.filter-chip.active {
  color: #ffffff;
  border-color: var(--primary);
  background: var(--primary);
}

.image-upload-preview {
  position: relative;
  align-self: end;
  min-height: 70px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px dashed #cbd4df;
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfd;
  font-size: 13px;
}

.image-upload-preview img {
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  display: none;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.image-upload-preview.has-image img {
  display: block;
}

.product-side-panel .image-upload-preview {
  align-self: stretch;
  flex-direction: column;
  justify-content: center;
  min-height: 146px;
  text-align: center;
}

.product-side-panel .image-upload-preview img {
  width: 76px;
  height: 76px;
  flex-basis: 76px;
}

.product-side-panel .image-upload-preview.has-image #productImageHint {
  display: none;
}

.upload-trigger {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  color: var(--primary-dark);
  background: #ffffff;
  font-size: 13px;
  cursor: pointer;
}

.upload-trigger input {
  display: none;
}

.remove-image-button {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  background: var(--accent);
  font-size: 16px;
  line-height: 1;
  padding: 0;
}

.image-upload-preview.has-image .remove-image-button {
  display: flex;
}

.purchase-product-preview {
  min-height: 116px;
  align-self: stretch;
  justify-content: center;
  flex-direction: column;
  text-align: center;
}

.purchase-product-preview img {
  width: 76px;
  height: 76px;
  flex-basis: 76px;
}

.compact-date-filter {
  width: auto;
  min-width: 220px;
  display: flex;
  align-items: center;
  grid-template-columns: none;
  gap: 8px;
  white-space: nowrap;
}

.compact-date-filter input {
  width: 160px;
  min-width: 160px;
}

.sale-order-list-table {
  min-width: 0;
  table-layout: fixed;
}

.sale-order-list-table th,
.sale-order-list-table td {
  padding: 10px 8px;
  text-align: center;
  vertical-align: middle;
}

.sale-order-list-table th:nth-child(1),
.sale-order-list-table td:nth-child(1) {
  width: 170px;
}

.sale-order-list-table th:nth-child(2),
.sale-order-list-table td:nth-child(2) {
  width: 150px;
}

.sale-order-list-table th:nth-child(3),
.sale-order-list-table td:nth-child(3) {
  width: 110px;
}

.sale-order-list-table th:nth-child(4),
.sale-order-list-table td:nth-child(4),
.sale-order-list-table th:nth-child(5),
.sale-order-list-table td:nth-child(5) {
  width: 76px;
}

.sale-order-list-table th:nth-child(6),
.sale-order-list-table td:nth-child(6) {
  width: 130px;
}

.sale-order-list-table th:nth-child(7),
.sale-order-list-table td:nth-child(7) {
  width: 96px;
}

.sale-order-list-table th:nth-child(8),
.sale-order-list-table td:nth-child(8) {
  width: 360px;
}

.sale-order-actions {
  display: inline-grid;
  grid-template-columns: repeat(4, max-content);
  justify-content: center;
  align-items: center;
  gap: 0 60px;
  white-space: nowrap;
}

.sale-order-actions .link-button {
  min-height: 28px;
  line-height: 1;
}

.table-wrap {
  overflow-x: auto;
}

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

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

th {
  color: var(--muted);
  background: #f9fbfc;
  font-weight: 700;
  text-align: center;
}

tbody tr:hover {
  background: #fbfcfd;
}

tbody tr.highlight-row {
  background: #fff3c6;
  box-shadow: inset 4px 0 0 #d39b16;
}

.product-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 230px;
}

.product-thumb {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 8px;
  object-fit: cover;
  background:
    radial-gradient(circle at 30% 20%, #ffffff 0 12%, transparent 13%),
    linear-gradient(135deg, #e7f2ef, #f5dce2 52%, #f5edcf);
  border: 1px solid var(--line);
}

.product-name {
  display: block;
  font-weight: 700;
}

.product-meta {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--primary-dark);
  background: var(--soft-green);
  font-size: 12px;
}

.badge.danger {
  color: #8f2639;
  background: var(--soft-rose);
}

.badge.gold {
  color: #725819;
  background: var(--soft-gold);
}

.badge.green {
  color: var(--primary-dark);
  background: var(--soft-green);
}

.row-actions {
  display: flex;
  gap: 8px;
}

.compact-actions {
  gap: 6px;
  white-space: nowrap;
}

.supplier-short {
  display: inline-block;
  min-width: 3em;
  max-width: 3em;
  line-height: 1.45;
  word-break: keep-all;
  text-align: center;
}

.purchase-order-cell {
  display: grid;
  justify-items: center;
  gap: 3px;
  white-space: nowrap;
}

.purchase-order-cell strong {
  font-size: 12px;
}

.purchase-order-cell small {
  color: var(--muted);
  font-size: 10px;
}

#purchaseTable td,
#purchasesView th {
  padding: 9px 8px;
}

/* 入库记录的所有数值、批次与日期列统一居中；仅商品信息保留左对齐。 */
#purchaseTable td {
  text-align: center;
}

#purchaseTable td:nth-child(4) {
  text-align: left;
}

#purchaseTable .compact-actions {
  justify-content: center;
}

.stacked-th {
  display: inline-block;
  min-width: 2.2em;
  line-height: 1.35;
  text-align: center;
  white-space: nowrap;
}

.purchase-record-table-wrap table {
  width: 1900px;
  min-width: 1900px;
}

.purchase-record-table-wrap .assembly-lot-cell {
  min-width: 152px;
}

.assembly-lot-summary {
  display: inline-block;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assembly-component-record-row td {
  padding-top: 8px !important;
  padding-bottom: 8px !important;
  color: #5f7188;
  background: #fbfdff !important;
}

.assembly-component-record-row td:first-child { border-left: 3px solid #bedfff; }
.assembly-component-record-row td:nth-child(4) { text-align: left !important; }
.purchase-record-table-wrap #purchaseTable .assembly-component-record-row td:last-child { background: #fbfdff !important; }

.assembly-component-row-mark {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 6px;
  color: #3b83db;
  background: #edf6ff;
  font-size: 11px;
  font-weight: 800;
}

.assembly-component-order,
.assembly-component-source,
.assembly-component-muted { color: #7b8ba0; font-size: 12px; }

.assembly-component-qty {
  display: grid;
  justify-items: center;
  gap: 2px;
  line-height: 1.15;
}

.assembly-component-qty strong { color: #3f6f9f; }
.assembly-component-qty small { color: #8a9ab0; font-size: 10px; white-space: nowrap; }

.component-lot-empty {
  color: var(--muted);
}

.assembly-parent-lot-note {
  color: #5b86b4;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.barcode-lookup-input {
  width: 100%;
  min-width: 0;
  background: #fff;
}

.barcode-lookup-input::placeholder {
  color: #8293ab;
  opacity: 1;
}

.inbound-available-cell {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 58px;
  line-height: 1.2;
  text-align: center;
}

.inbound-available-cell strong {
  font-size: 15px;
}

.inbound-available-cell small {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.inbound-available-cell.has-stock strong {
  color: #188f5a;
}

.inbound-available-cell.is-empty strong {
  color: #8a98ac;
}

.inbound-available-cell.is-unregistered strong {
  color: #be7b2e;
}

.purchase-record-table-wrap {
  position: relative;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.purchase-record-table-wrap::-webkit-scrollbar {
  height: 12px;
}

.purchase-record-table-wrap::-webkit-scrollbar-track {
  background: #eaf0f8;
}

.purchase-record-table-wrap::-webkit-scrollbar-thumb {
  border: 3px solid #eaf0f8;
  border-radius: 999px;
  background: #79b9ff;
}

.purchase-record-table-wrap th:last-child,
.purchase-record-table-wrap #purchaseTable td:last-child {
  position: sticky;
  right: 0;
  width: 78px;
  min-width: 78px;
  max-width: 78px;
  padding-right: 5px;
  padding-left: 5px;
  box-shadow: -12px 0 18px rgba(27, 73, 130, 0.11);
}

.purchase-record-table-wrap th:last-child {
  z-index: 3;
  background: #f4f7fc;
}

.purchase-record-table-wrap #purchaseTable td:last-child {
  z-index: 2;
  background: #ffffff;
}

.purchase-record-table-wrap #purchaseTable tr:nth-child(even) td:last-child {
  background: #f7f9fd;
}

#purchaseTable .compact-actions {
  flex-direction: column;
  align-items: center;
  gap: 4px;
  white-space: normal;
}

#purchaseTable .compact-actions .link-button {
  min-height: 24px;
  padding: 2px 4px;
  line-height: 1.2;
}

#salesView table {
  min-width: 1680px;
}

.sale-order-outbound-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-color: #b9d8d2;
  background: #fbfefd;
}

.sale-order-outbound-panel[hidden] {
  display: none;
}

.sale-order-outbound-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.sale-order-outbound-eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
}

.sale-order-outbound-heading h3 {
  margin: 0;
  color: var(--text);
  font-size: 19px;
}

.sale-order-outbound-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.sale-order-outbound-cancel {
  flex: 0 0 auto;
}

.sale-order-outbound-meta {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(220px, 1.2fr) minmax(180px, 0.65fr);
  gap: 12px;
  align-items: stretch;
  grid-auto-rows: 110px;
}

.sale-order-outbound-meta > div,
.sale-order-outbound-meta > label {
  box-sizing: border-box;
  min-height: 0;
  height: 110px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 15px 20px;
  background: #ffffff;
}

.sale-order-outbound-meta > div {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 7px;
}

.sale-order-outbound-meta span,
.sale-order-outbound-meta label {
  color: var(--muted);
  font-size: 12px;
}

.sale-order-outbound-meta strong {
  align-self: end;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-order-outbound-meta > label {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 7px;
}

.sale-order-outbound-meta input {
  align-self: end;
  min-height: 34px;
  border: 0;
  padding: 0;
  color: var(--text);
  background: transparent;
  font-size: 14px;
}

.sale-order-outbound-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.sale-order-outbound-table {
  width: 100%;
  min-width: 1080px !important;
  table-layout: fixed;
}

.sale-order-outbound-table th,
.sale-order-outbound-table td {
  padding: 10px 8px;
  text-align: center;
  vertical-align: middle;
}

.sale-order-outbound-table th:nth-child(1),
.sale-order-outbound-table td:nth-child(1) {
  width: 54px;
}

.sale-order-outbound-table th:nth-child(2),
.sale-order-outbound-table td:nth-child(2) {
  width: 250px;
  text-align: left;
}

.sale-order-outbound-table th:nth-child(3),
.sale-order-outbound-table td:nth-child(3) {
  width: 145px;
}

.sale-order-outbound-table th:nth-child(4),
.sale-order-outbound-table td:nth-child(4),
.sale-order-outbound-table th:nth-child(5),
.sale-order-outbound-table td:nth-child(5),
.sale-order-outbound-table th:nth-child(6),
.sale-order-outbound-table td:nth-child(6) {
  width: 86px;
}

.sale-order-outbound-table th:nth-child(7),
.sale-order-outbound-table td:nth-child(7) {
  width: 108px;
}

.sale-order-outbound-table th:nth-child(8),
.sale-order-outbound-table td:nth-child(8) {
  width: 190px;
}

.sale-order-outbound-table th:nth-child(9),
.sale-order-outbound-table td:nth-child(9) {
  width: 180px;
}

.sale-order-outbound-product-cell {
  min-width: 0;
}

.sale-order-outbound-product-cell strong,
.sale-order-outbound-product-cell span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sale-order-outbound-product-cell strong {
  color: var(--text);
  font-size: 13px;
}

.sale-order-outbound-product-cell span,
.sale-order-outbound-batch-summary {
  color: var(--muted);
  font-size: 12px;
}

.sale-order-outbound-batch-summary {
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.sale-order-outbound-qty,
.sale-order-outbound-batch {
  width: 100%;
  min-height: 34px;
  padding: 0 8px;
  font-size: 12px;
}

.sale-order-outbound-row-error {
  background: #fff7f8;
}

.sale-order-outbound-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.sale-order-outbound-footer > span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.sale-order-outbound-footer .primary-button {
  width: min(230px, 100%);
  flex: 0 0 230px;
}

#reportsView table {
  min-width: 1180px;
}

.cost-detail-cell {
  min-width: 210px;
  max-width: 260px;
  color: var(--muted);
  line-height: 1.55;
  white-space: normal;
}

.cost-summary {
  display: grid;
  gap: 3px;
  min-width: 140px;
  color: var(--muted);
  line-height: 1.35;
}

.link-button {
  border: 0;
  padding: 0;
  color: var(--primary);
  background: transparent;
}

.link-button:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.45;
}

.selection-column {
  width: 44px;
  padding-right: 6px !important;
  padding-left: 12px !important;
  text-align: center !important;
}

.row-select-checkbox {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: #1c78f2;
  cursor: pointer;
}

.batch-selection-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  padding: 5px 7px 5px 12px;
  border: 1px solid rgba(37, 121, 246, 0.2);
  border-radius: 10px;
  color: #2864ad;
  background: linear-gradient(120deg, #f1f7ff, #fbfdff);
  box-shadow: 0 7px 15px rgba(41, 104, 186, 0.07);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.batch-selection-actions[hidden] {
  display: none;
}

.batch-selection-actions .link-button {
  color: #58708d;
  font-size: 12px;
}

.batch-delete-button {
  min-height: 32px;
  padding: 0 13px;
  border-radius: 8px;
  font-size: 12px;
  box-shadow: none;
}

tbody tr.batch-selected-row td {
  background: rgba(226, 241, 255, 0.74);
}

.danger-link {
  color: var(--accent);
}

.compact-list {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.compact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.compact-item strong {
  display: block;
  font-size: 14px;
}

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

#inventoryView table {
  min-width: 980px;
}

.batch-summary {
  min-width: 180px;
  text-align: center;
}

.batch-summary strong {
  display: block;
  margin-bottom: 5px;
}

.batch-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
}

.batch-summary-cell {
  text-align: center;
}

.batch-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  color: #3a4654;
  background: #f2f5f7;
  font-size: 12px;
  white-space: nowrap;
}

.inventory-brand {
  display: inline-grid;
  gap: 2px;
  min-width: 4.5em;
  text-align: center;
  line-height: 1.35;
}

.inventory-brand strong {
  font-size: 13px;
}

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

.inventory-status {
  justify-content: center;
  min-width: 42px;
  min-height: 38px;
  line-height: 1.25;
  text-align: center;
}

.stacked-action {
  min-width: 3.2em;
  line-height: 1.35;
  text-align: center;
}

.muted-text {
  color: var(--muted);
}

.switch {
  display: flex;
  grid-template-columns: auto;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.switch input {
  width: 16px;
  min-height: 16px;
}

.empty {
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  min-width: 240px;
  max-width: 360px;
  padding: 13px 15px;
  border-radius: 8px;
  color: #ffffff;
  background: #17202a;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(23, 32, 42, 0.42);
}

.confirm-modal.show {
  display: flex;
}

.confirm-dialog {
  width: min(420px, 100%);
  padding: 22px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(23, 32, 42, 0.24);
}

.batch-detail-dialog {
  width: min(860px, 100%);
}

.sale-order-preview-dialog {
  width: min(1180px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  display: grid;
  gap: 14px;
}

.preview-modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.preview-modal-actions .ghost-button {
  min-height: 38px;
  padding: 0 18px;
}

.sale-order-preview-shell {
  width: 100%;
  aspect-ratio: 297 / 210;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.sale-order-preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

.modal-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.modal-table-wrap {
  max-height: 56vh;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.modal-table-wrap table {
  min-width: 680px;
}

.modal-table-wrap th,
.modal-table-wrap td {
  text-align: center;
}

.modal-table-wrap .stacked-th {
  min-width: 3.2em;
}

.confirm-dialog h3 {
  margin: 0;
  font-size: 18px;
}

.confirm-dialog p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

@media (max-width: 1020px) {
  body {
    grid-template-columns: 212px minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    height: 100vh;
    padding: 20px 14px;
  }

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

  .nav-tab {
    text-align: left;
  }

  .metric-grid,
  .split-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .company-info-grid,
  .company-doc-grid {
    grid-template-columns: 1fr;
  }

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

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

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

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

  .direct-workspace-head {
    grid-template-columns: 1fr;
  }

  .direct-period-tabs,
  .direct-date-panel {
    grid-column: 1;
    justify-self: stretch;
    width: 100%;
  }

  .direct-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .direct-section-grid {
    grid-template-columns: 1fr;
  }

  .direct-expense-fields {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .direct-expense-date-field,
  .direct-expense-type-field,
  .direct-expense-amount-field {
    grid-column: span 2;
  }

  .direct-expense-product-field {
    grid-column: 1 / -1;
  }

  .direct-expense-bottom {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .direct-expense-note-field {
    grid-column: span 4;
  }

  .direct-expense-form .primary-button {
    grid-column: span 2;
  }

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

  .purchase-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sale-order-outbound-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sale-order-outbound-meta > label {
    grid-column: 1 / -1;
  }

  .purchase-document-header {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .purchase-document-summary,
  .purchase-document-actions {
    grid-column: 1 / -1;
  }

  .purchase-document-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .purchase-line-editor {
    grid-template-columns: minmax(0, 1fr) 124px;
  }

  .purchase-product-fields {
    grid-template-columns: minmax(190px, 0.9fr) minmax(260px, 1.35fr);
  }

  .purchase-line-detail-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .purchase-qty-field,
  .purchase-gift-field,
  .purchase-price-field,
  .purchase-average-field,
  .purchase-batch-field,
  .purchase-production-field,
  .purchase-warranty-field,
  .purchase-expiry-field {
    grid-column: auto;
  }

  .product-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kit-component-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .order-meta-field,
  .order-wide-field,
  .order-party-card,
  .order-lines-card,
  .order-actions {
    grid-column: 1 / -1;
  }

  .order-line-editor {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-line-editor label:first-child,
  .order-line-editor .primary-button {
    grid-column: 1 / -1;
  }

  .product-name-field {
    grid-column: 1 / -1;
  }

  .supplier-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .supplier-form .wide-field {
    grid-column: 1;
  }

  .supplier-form .address-field {
    grid-column: 1 / -1;
  }

  .supplier-actions {
    grid-column: 2;
    grid-row: auto;
    grid-template-columns: 1fr;
  }

  .purchase-side-panel {
    grid-column: 1 / -1;
    grid-row: auto;
    grid-template-columns: minmax(0, 1fr) minmax(170px, 0.4fr);
    grid-template-rows: none;
    align-items: stretch;
  }

  .product-side-panel .side-panel-title,
  .product-side-panel .image-upload-preview {
    grid-column: 1;
  }

  .product-side-panel .purchase-actions {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: end;
  }
}

@media (max-width: 680px) {
  body {
    grid-template-columns: 86px minmax(0, 1fr);
  }

  .sidebar {
    padding: 14px 10px;
  }

  .brand-block {
    justify-content: center;
    padding-bottom: 14px;
    gap: 0;
  }

  .brand-block > div:not(.brand-mark) {
    display: none;
  }

  .brand-mark {
    width: 54px;
    height: 54px;
  }

  .app-shell {
    padding: 14px;
  }

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

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

  .nav-tab {
    min-height: 44px;
    padding: 0 6px;
    text-align: center;
    font-size: 13px;
  }

  .nav-subtabs {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
  }

  .nav-direct-tab {
    min-height: 30px;
    padding: 0 4px;
    text-align: center;
    font-size: 10px;
    overflow-wrap: anywhere;
  }

  .metric-grid,
  .split-layout,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .company-hero {
    flex-direction: column;
    text-align: center;
  }

  .company-hero h3 {
    font-size: 22px;
  }

  .info-list div {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .document-frame,
  .document-image-wrap {
    height: 420px;
  }

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

  .purchase-form {
    grid-template-columns: 1fr;
  }

  .sale-order-outbound-heading,
  .sale-order-outbound-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .sale-order-outbound-meta {
    grid-template-columns: 1fr;
  }

  .sale-order-outbound-meta > label {
    grid-column: auto;
  }

  .sale-order-outbound-cancel,
  .sale-order-outbound-footer .primary-button {
    width: 100%;
    flex-basis: auto;
  }

  .purchase-document-header,
  .purchase-line-editor {
    grid-template-columns: 1fr;
  }

  .purchase-document-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .purchase-product-fields,
  .purchase-line-detail-fields {
    grid-column: 1;
    grid-row: auto;
    grid-template-columns: 1fr;
  }

  .purchase-barcode-field,
  .purchase-name-field,
  .purchase-qty-field,
  .purchase-gift-field,
  .purchase-price-field,
  .purchase-average-field,
  .purchase-batch-field,
  .purchase-production-field,
  .purchase-warranty-field,
  .purchase-expiry-field {
    grid-column: 1;
    grid-row: auto;
  }

  .purchase-line-image {
    grid-column: 1;
    grid-row: auto;
    min-height: 132px;
  }

  .purchase-line-footer {
    grid-column: 1;
    align-items: stretch;
    flex-direction: column;
  }

  .purchase-add-line-button {
    width: 100%;
    flex-basis: auto;
  }

  .purchase-lines-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .purchase-total-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 0;
  }

  .purchase-total-strip > span:nth-child(3) {
    border-left: 0;
  }

  .product-form {
    grid-template-columns: 1fr;
  }

  .product-brand-field,
  .product-name-field {
    grid-column: auto;
  }

  .kit-components-heading,
  .purchase-kit-batches-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .kit-component-add,
  .kit-component-list {
    min-width: 0;
    grid-template-columns: 1fr;
  }

  .order-form,
  .order-line-editor {
    grid-template-columns: 1fr;
  }

  .order-meta-field,
  .order-wide-field,
  .order-party-card,
  .order-lines-card,
  .order-actions,
  .order-line-editor label:first-child,
  .order-line-editor .primary-button {
    grid-column: 1;
  }

  .order-party-card {
    grid-template-columns: 1fr;
  }

  .order-actions {
    grid-template-columns: 1fr;
  }

  .fixed-term-list {
    grid-template-columns: 1fr;
  }

  .order-total-strip {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

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

  .direct-date-panel {
    grid-template-columns: 1fr;
  }

  .direct-period-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .direct-card-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .direct-detail-date-control {
    width: 100%;
  }

  .direct-date-input {
    width: 100%;
  }

  .direct-range-badge {
    justify-self: start;
    max-width: 100%;
  }

  .direct-stat-grid,
  .direct-section-grid,
  .direct-expense-fields,
  .direct-expense-bottom {
    grid-template-columns: 1fr;
  }

  .direct-receivable-summary {
    grid-template-columns: 1fr;
  }

  .import-panel {
    grid-template-columns: 1fr;
  }

  .direct-expense-date-field,
  .direct-expense-type-field,
  .direct-expense-product-field,
  .direct-expense-amount-field,
  .direct-expense-note-field,
  .direct-expense-form .primary-button {
    grid-column: 1;
  }

  .supplier-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .supplier-actions {
    grid-column: 2;
    grid-template-columns: 1fr;
  }

  .purchase-side-panel {
    grid-column: auto;
    grid-template-columns: minmax(0, 1fr) minmax(132px, 0.42fr);
  }

  .product-side-panel {
    grid-template-columns: 1fr;
  }

  .product-side-panel .side-panel-title,
  .product-side-panel .image-upload-preview,
  .product-side-panel .purchase-actions {
    grid-column: auto;
    grid-row: auto;
  }

  .top-actions,
  .toolbar,
  .form-actions,
  .purchase-actions {
    width: 100%;
    justify-content: stretch;
  }

  .primary-button,
  .ghost-button,
  .danger-button {
    flex: 1;
  }
}

@media (max-width: 460px) {
  .dashboard-type-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-section-head,
  .dashboard-customer-detail-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .ranking-row {
    grid-template-columns: 24px 46px minmax(0, 1fr);
  }

  .ranking-thumb {
    width: 46px;
    height: 46px;
  }

  .ranking-row em {
    grid-column: 3;
    text-align: left;
  }

  .supplier-form {
    grid-template-columns: 1fr;
  }

  .supplier-form .wide-field,
  .supplier-actions {
    grid-column: 1;
  }
}

/* AI operations preview: restrained blue light, original brand assets retained. */
:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #101a2b;
  --muted: #65728a;
  --line: #e4eaf3;
  --primary: #176cf5;
  --primary-dark: #0d4fc4;
  --accent: #176cf5;
  --soft-green: #eaf2ff;
  --soft-rose: #fff0f4;
  --soft-gold: #fff5df;
  --shadow: 0 14px 34px rgba(40, 62, 96, 0.08);
}

body {
  grid-template-columns: 264px minmax(0, 1fr);
  background:
    radial-gradient(circle at 70% -20%, rgba(40, 131, 255, 0.1), transparent 34rem),
    linear-gradient(135deg, #f8faff 0%, var(--bg) 46%, #f6f9fe 100%);
}

.sidebar {
  position: sticky;
  isolation: isolate;
  padding: 28px 16px 24px;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 28% 0%, rgba(30, 125, 255, 0.24), transparent 22%),
    radial-gradient(circle at 98% 50%, rgba(15, 103, 223, 0.2), transparent 26%),
    linear-gradient(155deg, #071527 0%, #081a2e 46%, #06101e 100%);
  box-shadow: 12px 0 36px rgba(6, 16, 30, 0.12);
}

.sidebar::before,
.sidebar::after {
  position: absolute;
  z-index: -1;
  content: "";
  pointer-events: none;
}

.sidebar::before {
  inset: 0;
  opacity: 0.55;
  background-image:
    linear-gradient(90deg, rgba(80, 164, 255, 0.11) 1px, transparent 1px),
    linear-gradient(rgba(80, 164, 255, 0.08) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, #000, transparent 62%);
}

.sidebar::after {
  right: -90px;
  bottom: 34px;
  width: 220px;
  height: 220px;
  border: 1px solid rgba(64, 153, 255, 0.4);
  border-radius: 50%;
  box-shadow: 0 0 0 26px rgba(42, 135, 255, 0.04), 0 0 34px rgba(28, 133, 255, 0.35);
}

.brand-block {
  position: relative;
  justify-content: center;
  gap: 13px;
  margin: 0 4px;
  width: calc(100% - 8px);
  height: 116px;
  padding: 0;
  border-bottom: 1px solid rgba(162, 201, 255, 0.16);
}

.brand-block::after {
  position: absolute;
  right: 1px;
  bottom: -1px;
  width: 38px;
  height: 1px;
  content: "";
  background: #5bb0ff;
  box-shadow: 0 0 10px #4ba9ff;
}

.brand-mark {
  width: 58px;
  height: 58px;
  padding: 3px;
  border: 1px solid rgba(138, 197, 255, 0.62);
  border-radius: 15px;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(63, 149, 255, 0.09), 0 8px 18px rgba(0, 0, 0, 0.28);
}

.brand-mark img {
  border-radius: 10px;
  object-fit: contain;
}

.brand-block h1 {
  font-size: 22px;
  font-weight: 760;
  letter-spacing: -0.6px;
}

.nav-tabs {
  gap: 5px;
  margin-top: 22px;
}

.nav-tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 48px;
  padding: 0 13px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 10px;
  color: rgba(232, 242, 255, 0.8);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.1px;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.nav-tab::before {
  display: none;
}

.nav-icon {
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
  color: currentColor;
  background-color: currentColor;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
}

.icon-home { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M21 10.6 12.7 3a1 1 0 0 0-1.4 0L3 10.6V21a1 1 0 0 0 1 1h5v-6h6v6h5a1 1 0 0 0 1-1zM13 14h-2v6H9v-6a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v6h-2z'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M21 10.6 12.7 3a1 1 0 0 0-1.4 0L3 10.6V21a1 1 0 0 0 1 1h5v-6h6v6h5a1 1 0 0 0 1-1zM13 14h-2v6H9v-6a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v6h-2z'/%3E%3C/svg%3E"); }
.icon-product { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='m12 2 9 5v10l-9 5-9-5V7zm0 2.3L6.1 7.6 12 11l5.9-3.4zM5 9.3v6.5l6 3.3v-6.4zm8 9.8 6-3.3V9.3l-6 3.4z'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='m12 2 9 5v10l-9 5-9-5V7zm0 2.3L6.1 7.6 12 11l5.9-3.4zM5 9.3v6.5l6 3.3v-6.4zm8 9.8 6-3.3V9.3l-6 3.4z'/%3E%3C/svg%3E"); }
.icon-supplier { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 5h11v10h2.2l2.3-4H21l2 4v4h-2.2a3 3 0 0 1-5.6 0H9.8a3 3 0 0 1-5.6 0H2V7a2 2 0 0 1 1-2m2 12a1 1 0 1 0 0 2 1 1 0 0 0 0-2m13 0a1 1 0 1 0 0 2 1 1 0 0 0 0-2m.5-4 1-2h-1.3l-1.2 2z'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 5h11v10h2.2l2.3-4H21l2 4v4h-2.2a3 3 0 0 1-5.6 0H9.8a3 3 0 0 1-5.6 0H2V7a2 2 0 0 1 1-2m2 12a1 1 0 1 0 0 2 1 1 0 0 0 0-2m13 0a1 1 0 1 0 0 2 1 1 0 0 0 0-2m.5-4 1-2h-1.3l-1.2 2z'/%3E%3C/svg%3E"); }
.icon-purchase { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4 4h16v9h-2V6H6v7H4zm5 5h6v4h3l-6 6-6-6h3zm-5 9h2v2h12v-2h2v3a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1z'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4 4h16v9h-2V6H6v7H4zm5 5h6v4h3l-6 6-6-6h3zm-5 9h2v2h12v-2h2v3a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1z'/%3E%3C/svg%3E"); }
.icon-customer { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 3a5 5 0 1 1 0 10 5 5 0 0 1 0-10m0 2a3 3 0 1 0 0 6 3 3 0 0 0 0-6m0 10c4.4 0 8 2.2 8 5v1H4v-1c0-2.8 3.6-5 8-5m0 2c-2.9 0-5.2 1-5.8 2h11.6c-.6-1-2.9-2-5.8-2'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 3a5 5 0 1 1 0 10 5 5 0 0 1 0-10m0 2a3 3 0 1 0 0 6 3 3 0 0 0 0-6m0 10c4.4 0 8 2.2 8 5v1H4v-1c0-2.8 3.6-5 8-5m0 2c-2.9 0-5.2 1-5.8 2h11.6c-.6-1-2.9-2-5.8-2'/%3E%3C/svg%3E"); }
.icon-order { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M6 2h9l4 4v16H5V2zm8 2v4h4zm-6 7v2h8v-2zm0 4v2h8v-2z'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M6 2h9l4 4v16H5V2zm8 2v4h4zm-6 7v2h8v-2zm0 4v2h8v-2z'/%3E%3C/svg%3E"); }
.icon-sales { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 5h11v10h2.2l2.3-4H21l2 4v4h-2.2a3 3 0 0 1-5.6 0H9.8a3 3 0 0 1-5.6 0H2V7a2 2 0 0 1 1-2m2 12a1 1 0 1 0 0 2 1 1 0 0 0 0-2m13 0a1 1 0 1 0 0 2 1 1 0 0 0 0-2m.5-4 1-2h-1.3l-1.2 2zM7 9l3 3 5-5 1.4 1.4L10 14.8 5.6 10.4z'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 5h11v10h2.2l2.3-4H21l2 4v4h-2.2a3 3 0 0 1-5.6 0H9.8a3 3 0 0 1-5.6 0H2V7a2 2 0 0 1 1-2m2 12a1 1 0 1 0 0 2 1 1 0 0 0 0-2m13 0a1 1 0 1 0 0 2 1 1 0 0 0 0-2m.5-4 1-2h-1.3l-1.2 2zM7 9l3 3 5-5 1.4 1.4L10 14.8 5.6 10.4z'/%3E%3C/svg%3E"); }
.icon-direct { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4 21V10h3v11zm6 0V3h3v18zm6 0v-7h3v7z'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4 21V10h3v11zm6 0V3h3v18zm6 0v-7h3v7z'/%3E%3C/svg%3E"); }
.icon-inventory { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 21V9l9-6 9 6v12h-7v-6h-4v6zm4-8h2v-2H7zm0 4h2v-2H7zm8-4h2v-2h-2zm0 4h2v-2h-2z'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 21V9l9-6 9 6v12h-7v-6h-4v6zm4-8h2v-2H7zm0 4h2v-2H7zm8-4h2v-2h-2zm0 4h2v-2h-2z'/%3E%3C/svg%3E"); }
.icon-report { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 3a9 9 0 1 1-9 9H1l3-3 3 3H5a7 7 0 1 0 2-5l-1.4-1.4A9 9 0 0 1 12 3m-1 4h2v5l4 2-1 1.7-5-2.8z'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 3a9 9 0 1 1-9 9H1l3-3 3 3H5a7 7 0 1 0 2-5l-1.4-1.4A9 9 0 0 1 12 3m-1 4h2v5l4 2-1 1.7-5-2.8z'/%3E%3C/svg%3E"); }
.icon-import { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M5 3h14a2 2 0 0 1 2 2v7h-2V5H5v14h6v2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2m10 10v-3l5 5-5 5v-3h-5v-4z'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M5 3h14a2 2 0 0 1 2 2v7h-2V5H5v14h6v2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2m10 10v-3l5 5-5 5v-3h-5v-4z'/%3E%3C/svg%3E"); }
.icon-account { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M19.4 13a7.6 7.6 0 0 0 .1-1 7.6 7.6 0 0 0-.1-1l2.1-1.6-2-3.4-2.5 1a8.2 8.2 0 0 0-1.7-1L15 3.4h-4L10.7 6a8.2 8.2 0 0 0-1.7 1l-2.5-1-2 3.4L6.6 11a7.6 7.6 0 0 0-.1 1 7.6 7.6 0 0 0 .1 1l-2.1 1.6 2 3.4 2.5-1a8.2 8.2 0 0 0 1.7 1l.3 2.6h4l.3-2.6a8.2 8.2 0 0 0 1.7-1l2.5 1 2-3.4zM13 16h-2v-2h2zm0-4h-2V8h2z'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M19.4 13a7.6 7.6 0 0 0 .1-1 7.6 7.6 0 0 0-.1-1l2.1-1.6-2-3.4-2.5 1a8.2 8.2 0 0 0-1.7-1L15 3.4h-4L10.7 6a8.2 8.2 0 0 0-1.7 1l-2.5-1-2 3.4L6.6 11a7.6 7.6 0 0 0-.1 1 7.6 7.6 0 0 0 .1 1l-2.1 1.6 2 3.4 2.5-1a8.2 8.2 0 0 0 1.7 1l.3 2.6h4l.3-2.6a8.2 8.2 0 0 0 1.7-1l2.5 1 2-3.4zM13 16h-2v-2h2zm0-4h-2V8h2z'/%3E%3C/svg%3E"); }

.nav-tab:hover {
  border-color: rgba(113, 181, 255, 0.18);
  color: #ffffff;
  background: rgba(81, 150, 238, 0.1);
}

.nav-tab.active {
  border-color: rgba(102, 194, 255, 0.96);
  color: #f4fbff;
  background: linear-gradient(90deg, rgba(18, 116, 239, 0.62), rgba(34, 139, 255, 0.2));
  box-shadow: inset 0 0 0 1px rgba(153, 219, 255, 0.3), inset 0 0 26px rgba(59, 163, 255, 0.25), 0 0 13px rgba(42, 150, 255, 0.48), 0 0 28px rgba(18, 108, 255, 0.28);
  text-shadow: 0 0 8px rgba(176, 225, 255, 1), 0 0 19px rgba(51, 151, 255, 0.9);
}

.nav-tab.active .nav-icon {
  color: #d9f3ff;
  filter: drop-shadow(0 0 5px rgba(143, 220, 255, 0.98)) drop-shadow(0 0 12px rgba(58, 150, 255, 0.86));
}

.nav-tab.active::after {
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 0;
  width: 4px;
  border-radius: 0 4px 4px 0;
  content: "";
  background: #c6efff;
  box-shadow: 0 0 8px #b3eaff, 0 0 20px #3bafff;
}

.nav-subtabs {
  gap: 3px;
  margin: -1px 0 5px 19px;
  padding: 6px 0 5px 13px;
  border-left-color: rgba(121, 184, 251, 0.22);
}

.nav-direct-tab {
  min-height: 29px;
  padding: 0 9px;
  border-radius: 6px;
  color: rgba(216, 235, 255, 0.62);
}

.nav-direct-tab.active {
  color: #bce4ff;
  background: rgba(35, 129, 242, 0.22);
  text-shadow: 0 0 8px rgba(90, 184, 255, 0.7);
}

.nav-purchase-tab {
  width: 100%;
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  padding: 0 9px;
  color: rgba(216, 235, 255, 0.7);
  background: transparent;
  text-align: left;
  font-size: 12px;
}

.nav-purchase-tab:hover,
.nav-purchase-tab.active {
  color: #ffffff;
  background: linear-gradient(90deg, rgba(37, 143, 255, 0.35), rgba(37, 143, 255, 0.08));
  box-shadow: inset 2px 0 0 #9feaff, 0 0 10px rgba(55, 167, 255, 0.18);
  text-shadow: 0 0 9px rgba(139, 220, 255, 0.9);
}

.purchase-subtabs {
  margin-top: -6px;
}

#purchaseManagementPanel[hidden],
#inboundManagementPanel[hidden],
#singleInboundPanel[hidden],
#assemblyInboundPanel[hidden] {
  display: none;
}

.purchase-order-history-panel,
.inbound-workbench-panel {
  margin-top: 18px;
}

.purchase-order-history-panel .compact-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.purchase-order-batch-actions {
  margin-left: 0;
}

.compact-heading {
  align-items: center;
}

.compact-heading h3,
.inbound-heading h3 {
  margin: 0;
}

.compact-heading p,
.inbound-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.inbound-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.inbound-mode-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: #edf4fd;
}

.inbound-mode-tab {
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  padding: 0 14px;
  color: #58708f;
  background: transparent;
}

.inbound-mode-tab.active {
  color: #ffffff;
  background: #1276ef;
  box-shadow: 0 6px 16px rgba(18, 118, 239, 0.25);
}

.inbound-summary-row {
  display: flex;
  align-items: end;
  gap: 16px;
  margin: 18px 0;
}

.inbound-summary-row label,
.assembly-form-grid label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
}

.inbound-summary-row label input {
  min-width: 170px;
}

.inbound-hint {
  flex: 1;
  padding-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.inbound-source-table-wrap,
.purchase-order-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.inbound-source-table,
.purchase-order-table {
  min-width: 1480px;
}

.inbound-qty-input {
  width: 108px;
}

.pending-qty { color: #126fea; }
.received-qty { color: #138653; }

.assembly-form-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.35fr) minmax(160px, 0.55fr) minmax(260px, 1fr) max-content;
  align-items: end;
  gap: 14px;
  margin: 18px 0;
}

.assembly-expiry-note {
  padding: 11px 13px;
  border-radius: 8px;
  color: #536d8a;
  background: #f3f7fc;
  font-size: 12px;
  line-height: 1.5;
}

.assembly-components {
  display: grid;
  gap: 12px;
}

.assembly-component-card {
  border: 1px solid #dbe7f6;
  border-radius: 10px;
  padding: 14px;
  background: #fbfdff;
}

.assembly-component-card header,
.assembly-component-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.assembly-component-card header strong,
.assembly-component-card header span {
  display: block;
}

.assembly-component-card header span,
.assembly-component-card header em {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.assembly-per-kit {
  display: grid;
  grid-template-columns: max-content 72px;
  align-items: center;
  gap: 7px;
  color: #687c95;
  font-size: 12px;
  font-style: normal;
}

.assembly-per-kit input { height: 34px; padding: 0 8px; text-align: center; }

.assembly-allocation-list {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.assembly-allocation-row {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 120px max-content;
  gap: 10px;
}

.assembly-component-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.assembly-component-actions .link-button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}

.assembly-component-actions .assembly-add-batch {
  color: #1768d7;
  border-color: #c7ddfb;
  background: #f4f9ff;
}

.assembly-component-actions .assembly-add-batch:hover {
  border-color: #77b6ff;
  background: #eaf4ff;
}

.assembly-component-actions .assembly-remove-component {
  color: #c43636;
  border-color: #f0bcbc;
  background: #fff8f8;
}

.assembly-component-actions .assembly-remove-component:hover {
  border-color: #dc6666;
  background: #fff0f0;
}

.allocation-ok { color: #118155; }
.allocation-warn { color: #b86e00; }

.empty-state {
  padding: 28px;
  border: 1px dashed #cbd9ea;
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
}

.app-shell {
  padding: 31px 34px 44px;
}

.topbar {
  min-height: 62px;
  margin-bottom: 28px;
}

.topbar h2 {
  margin: 0;
  font-size: 27px;
  font-weight: 780;
  letter-spacing: -0.8px;
}

.topbar .eyebrow {
  display: inline-block;
  margin: 0 0 5px 2px;
  color: #8090a7;
  font-weight: 700;
  letter-spacing: 0.45px;
}

.top-actions {
  gap: 9px;
}

.cloud-sync-status,
.user-pill {
  min-height: 40px;
  border: 1px solid rgba(28, 102, 216, 0.06);
  padding: 0 14px;
  color: #52627a;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 5px 16px rgba(32, 64, 108, 0.04);
  font-size: 13px;
  font-weight: 650;
}

.cloud-sync-status::before {
  margin-right: 7px;
  color: #237cff;
  content: "☁";
  font-size: 17px;
}

.cloud-sync-status.synced {
  color: #1474e8;
  background: #eef6ff;
}

.primary-button,
.ghost-button,
.icon-button,
.danger-button {
  min-height: 40px;
  border-radius: 10px;
  font-weight: 650;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}

.primary-button {
  background: linear-gradient(135deg, #112842, #081726);
  box-shadow: 0 8px 18px rgba(9, 31, 56, 0.17);
}

.primary-button:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #16375c, #0c1e33);
  box-shadow: 0 12px 24px rgba(9, 31, 56, 0.24);
}

.ghost-button,
.icon-button {
  border-color: #e9eef5;
  background: rgba(255, 255, 255, 0.85);
}

.ghost-button:hover,
.icon-button:hover {
  border-color: rgba(54, 133, 247, 0.4);
  color: #176cf5;
  background: #ffffff;
  box-shadow: 0 7px 16px rgba(35, 95, 182, 0.1);
}

.metric-grid {
  gap: 18px;
}

.metric,
.panel,
.table-panel {
  border: 1px solid rgba(224, 231, 241, 0.88);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.metric {
  position: relative;
  min-height: 154px;
  padding: 25px 24px 22px;
  overflow: hidden;
}

.metric::before {
  position: absolute;
  top: 24px;
  bottom: auto;
  left: 24px;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(84, 150, 251, 0.1);
  border-radius: 13px;
  color: #1673ee;
  content: "";
  background: linear-gradient(155deg, #e7f1ff, #f9fbff 74%);
  box-shadow: 0 10px 18px rgba(38, 119, 234, 0.11);
}

.metric-icon {
  position: absolute;
  z-index: 1;
  top: 48px;
  left: 34px;
  width: 28px;
  height: 28px;
  color: #1673ee;
  background-color: currentColor;
  transform: translateY(-50%);
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
}

.metric-icon-sales { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4 5h15a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2m0 3v2h15V8zm11 5a2 2 0 1 0 0 4 2 2 0 0 0 0-4'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4 5h15a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2m0 3v2h15V8zm11 5a2 2 0 1 0 0 4 2 2 0 0 0 0-4'/%3E%3C/svg%3E"); }
.metric-icon-purchases { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M7 4h2l1 3h10l-2 7H10l-1 2h10v2H7a2 2 0 0 1-1.7-3L7.4 9 6.2 6H4V4zm4 16a2 2 0 1 0 0 4 2 2 0 0 0 0-4m6 0a2 2 0 1 0 0 4 2 2 0 0 0 0-4'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M7 4h2l1 3h10l-2 7H10l-1 2h10v2H7a2 2 0 0 1-1.7-3L7.4 9 6.2 6H4V4zm4 16a2 2 0 1 0 0 4 2 2 0 0 0 0-4m6 0a2 2 0 1 0 0 4 2 2 0 0 0 0-4'/%3E%3C/svg%3E"); }
.metric-icon-inventory { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='m12 2 9 5v10l-9 5-9-5V7zm0 2.3L6.1 7.6 12 11l5.9-3.4zM5 9.3v6.5l6 3.3v-6.4zm8 9.8 6-3.3V9.3l-6 3.4z'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='m12 2 9 5v10l-9 5-9-5V7zm0 2.3L6.1 7.6 12 11l5.9-3.4zM5 9.3v6.5l6 3.3v-6.4zm8 9.8 6-3.3V9.3l-6 3.4z'/%3E%3C/svg%3E"); }
.metric-icon-count { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 5h8v7H3zm10 0h8v7h-8zM3 14h8v7H3zm10 0h8v7h-8zm-8-7v3h4V7zm10 0v3h4V7zm-10 9v3h4v-3zm10 0v3h4v-3z'/%3E%3C/svg%3E"); -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M3 5h8v7H3zm10 0h8v7h-8zM3 14h8v7H3zm10 0h8v7h-8zm-8-7v3h4V7zm10 0v3h4V7zm-10 9v3h4v-3zm10 0v3h4v-3z'/%3E%3C/svg%3E"); }

.metric::after {
  position: absolute;
  right: -16px;
  bottom: -34px;
  width: 116px;
  height: 74px;
  border: 2px solid rgba(50, 139, 251, 0.11);
  border-radius: 50%;
  content: "";
  transform: rotate(-14deg);
}

.metric span {
  display: flex;
  min-height: 48px;
  align-items: center;
  margin-left: 64px;
  color: #718099;
  font-size: 13px;
  font-weight: 650;
}

.metric strong {
  display: block;
  margin-top: 10px;
  margin-left: 64px;
  color: #101a2b;
  font-size: clamp(24px, 2vw, 30px);
  font-weight: 780;
  letter-spacing: -1.1px;
}

.metric.warning strong {
  color: #176cf5;
}

.panel,
.table-panel {
  padding: 24px;
}

.dashboard-flow-panel {
  margin-top: 24px;
}

.panel-heading {
  align-items: baseline;
}

.panel-heading h3 {
  color: #142036;
  font-size: 18px;
  font-weight: 760;
  letter-spacing: -0.35px;
}

.panel-heading p,
.panel-heading .muted {
  color: #8090a7;
}

.flow-grid,
.dashboard-type-grid {
  gap: 14px;
}

.flow-item,
.dashboard-type-card {
  border: 1px solid #e7edf5;
  border-radius: 12px;
  background: linear-gradient(145deg, #ffffff, #fbfcff);
  box-shadow: 0 6px 14px rgba(41, 74, 119, 0.045);
}

.flow-item:hover,
.dashboard-type-card:hover {
  border-color: rgba(37, 121, 246, 0.42);
  box-shadow: 0 10px 22px rgba(40, 112, 226, 0.1);
}

.dashboard-type-card.active {
  border-color: #5798ff;
  background: linear-gradient(145deg, #ffffff, #f2f7ff);
  box-shadow: inset 0 0 0 1px rgba(46, 126, 246, 0.12), 0 10px 20px rgba(53, 133, 248, 0.1);
}

.compact-list > * {
  border-color: #e9eef5;
}

.table-wrap,
.dashboard-customer-table-wrap {
  border: 1px solid #edf1f6;
  border-radius: 11px;
  overflow: hidden;
}

th {
  color: #4e5f78;
  background: #f4f7fc;
  font-weight: 720;
}

tr:nth-child(even) td {
  background: rgba(247, 249, 253, 0.72);
}

input,
select,
textarea {
  border-color: #dfe7f1;
  border-radius: 9px;
  background: #fbfcff;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #4f93ff;
  outline: 3px solid rgba(52, 137, 255, 0.12);
}

.login-screen {
  background:
    radial-gradient(circle at 18% 14%, rgba(40, 134, 253, 0.22), transparent 24rem),
    radial-gradient(circle at 82% 82%, rgba(26, 103, 207, 0.16), transparent 25rem),
    linear-gradient(145deg, #061426, #0c2441 58%, #09182d);
}

.login-card {
  border-color: rgba(123, 187, 255, 0.28);
  border-radius: 18px;
  background: rgba(248, 252, 255, 0.95);
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.3);
}

.login-card img {
  border-color: rgba(85, 160, 255, 0.48);
  border-radius: 14px;
  box-shadow: 0 0 0 5px rgba(53, 138, 255, 0.09);
}

/* 采购模块：沿用直营数据的侧栏子模块层级，避免出现浅色按钮。 */
.sidebar .purchase-subtabs {
  display: none;
  gap: 3px;
  margin: -1px 0 5px 19px;
  padding: 6px 0 5px 13px;
  border-left: 1px solid rgba(121, 184, 251, 0.22);
}

.sidebar .purchase-subtabs.show { display: grid; }

.sidebar .nav-purchase-tab {
  display: block;
  width: 100%;
  min-height: 29px;
  border: 0 !important;
  border-radius: 6px;
  padding: 0 9px;
  appearance: none;
  color: rgba(216, 235, 255, 0.62) !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 12px;
  font-weight: 600;
  line-height: 29px;
  text-align: left;
}

.sidebar .nav-purchase-tab:hover,
.sidebar .nav-purchase-tab.active {
  color: #bce4ff !important;
  background: rgba(35, 129, 242, 0.22) !important;
  box-shadow: inset 2px 0 0 #8cdcff, 0 0 10px rgba(45, 151, 255, 0.22) !important;
  text-shadow: 0 0 8px rgba(90, 184, 255, 0.72);
}

/* 直营渠道子模块与采购子模块使用完全一致的选中光标与荧光效果。 */
.sidebar .nav-direct-tab {
  display: block;
  width: 100%;
  min-height: 29px;
  border: 0 !important;
  border-radius: 6px;
  padding: 0 9px;
  appearance: none;
  color: rgba(216, 235, 255, 0.62) !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 12px;
  font-weight: 600;
  line-height: 29px;
  text-align: left;
}

.sidebar .nav-direct-tab:hover,
.sidebar .nav-direct-tab.active {
  color: #bce4ff !important;
  background: rgba(35, 129, 242, 0.22) !important;
  box-shadow: inset 2px 0 0 #8cdcff, 0 0 10px rgba(45, 151, 255, 0.22) !important;
  text-shadow: 0 0 8px rgba(90, 184, 255, 0.72);
}

/* 采购订单记录字段较多：覆盖通用表格的 overflow:hidden，始终可左右滑动。 */
.table-wrap.purchase-order-table-wrap {
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.table-wrap.purchase-order-table-wrap::-webkit-scrollbar { height: 12px; }
.table-wrap.purchase-order-table-wrap::-webkit-scrollbar-track { background: #eaf0f8; }
.table-wrap.purchase-order-table-wrap::-webkit-scrollbar-thumb {
  border: 3px solid #eaf0f8;
  border-radius: 999px;
  background: #79b9ff;
}

.inbound-record-editor {
  display: grid;
  grid-template-columns: minmax(210px, 1.2fr) 180px 170px minmax(240px, 1.6fr) max-content max-content;
  align-items: end;
  gap: 12px;
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid #bcd8fb;
  border-radius: 11px;
  background: linear-gradient(100deg, #f4f9ff, #ffffff);
}

.inbound-record-editor[hidden] { display: none; }

.inbound-record-editor-title { align-self: center; }
.inbound-record-editor-title span,
.inbound-record-editor-title strong { display: block; }
.inbound-record-editor-title span { color: #2279df; font-size: 12px; font-weight: 800; }
.inbound-record-editor-title strong { margin-top: 4px; color: #243d5d; font-size: 13px; }

.inbound-record-editor label { display: grid; gap: 6px; color: #5c708b; font-size: 12px; font-weight: 700; }
.inbound-record-editor input { height: 38px; }
.inbound-record-editor-note { align-self: center; color: #75859a; font-size: 12px; line-height: 1.5; }
.inbound-record-editor .ghost-button,
.inbound-record-editor .primary-button { min-height: 38px; }

.assembly-inbound-row td { background: #f5faff !important; }
.assembly-inbound-row:hover td { background: #edf6ff !important; }
.assembly-row-mark {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: #1777e9;
  background: #deeeff;
  cursor: pointer;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  transition: background-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.assembly-row-mark:hover { background: #cde6ff; box-shadow: 0 4px 12px rgba(44, 131, 231, .18); }
.assembly-row-mark:focus-visible { outline: 2px solid #60adff; outline-offset: 2px; }
.assembly-inbound-row.is-components-expanded .assembly-row-mark { background: #1677e8; color: #fff; }
.assembly-source-label { color: #1978e8; font-size: 12px; font-weight: 800; }
.assembly-row-detail { display: block; margin-top: 4px; color: #70829a; font-size: 10px; white-space: nowrap; }

@media (max-width: 1300px) {
  .inbound-record-editor { grid-template-columns: 1fr 160px 160px; }
  .inbound-record-editor-note { grid-column: 1 / -1; }
}

/* 入库管理工作台 */
.inbound-workbench-panel {
  padding: 0;
  overflow: hidden;
}

.inbound-workbench-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 24px 28px 20px;
  border-bottom: 1px solid #e7edf5;
  background: linear-gradient(102deg, #fbfdff 0%, #f1f7ff 100%);
}

.inbound-eyebrow {
  display: block;
  margin-bottom: 6px;
  color: #347ee6;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.1px;
}

.inbound-workbench-head h3 {
  margin: 0;
  color: #13263f;
  font-size: 22px;
}

.inbound-workbench-head p {
  max-width: 680px;
  margin: 6px 0 0;
  color: #70819a;
  font-size: 13px;
}

.inbound-mode-tabs {
  flex: 0 0 auto;
  gap: 3px;
  padding: 4px;
  border: 1px solid #dfe9f7;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 7px 16px rgba(28, 82, 144, 0.05);
}

.inbound-mode-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 13px;
  color: #526987;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
}

.inbound-mode-tab span {
  color: #9aafc7;
  font-size: 10px;
  font-weight: 800;
}

.inbound-mode-tab.active {
  color: #ffffff;
  background: linear-gradient(135deg, #197ff3, #2368d8);
  box-shadow: 0 6px 14px rgba(27, 112, 225, 0.24);
}

.inbound-mode-tab.active span { color: rgba(255,255,255,.7); }

#singleInboundPanel,
#assemblyInboundPanel { padding: 22px 28px 28px; }

.inbound-action-bar {
  display: grid;
  grid-template-columns: max-content minmax(180px, 1fr) max-content 180px max-content;
  align-items: center;
  gap: 16px;
  min-height: 74px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid #e2eaf4;
  border-radius: 12px;
  background: #fbfdff;
}

.inbound-step-mark {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 164px;
  color: #183554;
  font-size: 13px;
  font-weight: 800;
}

.inbound-step-mark strong {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px;
  color: #1979ec;
  background: #eaf3ff;
  font-size: 12px;
}

.inbound-hint { padding: 0; color: #71829a; }

.inbound-date-field {
  display: grid;
  grid-template-columns: max-content 1fr;
  align-items: center;
  gap: 8px;
  color: #5b6d84;
  font-size: 12px;
  font-weight: 700;
}

.inbound-date-field input { min-width: 0; height: 38px; }

.inbound-action-bar .primary-button { min-width: 178px; }
.inbound-select-all-button { min-height: 38px; white-space: nowrap; }

.inbound-source-table-wrap { border-radius: 12px; }

.assembly-intro-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  border: 1px solid #dae8fa;
  border-radius: 12px;
  background: linear-gradient(100deg, #f1f7ff, #fbfdff);
}

.assembly-intro-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  color: #1978ed;
  background: #ffffff;
  box-shadow: 0 6px 14px rgba(41, 115, 219, 0.12);
  font-size: 25px;
}

.assembly-intro-strip strong { color: #183554; font-size: 14px; }
.assembly-intro-strip p { margin: 3px 0 0; color: #71829a; font-size: 12px; }

.assembly-edit-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #9fc8ff;
  border-radius: 11px;
  background: linear-gradient(100deg, #eaf4ff, #f8fbff);
}

.assembly-edit-banner strong,
.assembly-edit-banner span { display: block; }
.assembly-edit-banner strong { color: #145fc5; font-size: 13px; }
.assembly-edit-banner span { margin-top: 3px; color: #5d7795; font-size: 12px; }
.assembly-edit-banner .ghost-button { min-height: 36px; white-space: nowrap; }

.assembly-form-grid {
  grid-template-columns: minmax(300px, 1.2fr) 180px minmax(420px, 1.15fr) 132px;
  align-items: end;
  gap: 14px;
  margin: 16px 0 18px;
  padding: 16px;
  border: 1px solid #e4ebf5;
  border-radius: 12px;
  background: #ffffff;
}

.assembly-form-grid label { gap: 8px; color: #51657f; font-size: 12px; }
.assembly-form-grid label > span { color: #314861; font-weight: 800; }
.assembly-form-grid select, .assembly-form-grid input { height: 42px; }

.assembly-expiry-note {
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid #e3ebf5;
  border-radius: 9px;
  color: #71829a;
  background: #f8fbff;
  white-space: nowrap;
}

.assembly-expiry-note strong { display: block; margin-bottom: 2px; color: #395a7f; font-size: 11px; }
.assembly-form-grid .primary-button { min-width: 132px; height: 42px; }

.assembly-component-picker {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(280px, 1.1fr) max-content;
  align-items: center;
  gap: 14px;
  margin: 0 0 12px;
  padding: 14px 16px;
  border: 1px dashed #c9dbf1;
  border-radius: 11px;
  background: #fbfdff;
}

.assembly-component-picker strong,
.assembly-component-picker span { display: block; }
.assembly-component-picker strong { color: #294662; font-size: 13px; }
.assembly-component-picker span { margin-top: 3px; color: #7a8da6; font-size: 12px; }
.assembly-component-picker select { height: 40px; }
.assembly-component-picker .ghost-button { min-height: 40px; }

.assembly-components { gap: 10px; }
.assembly-component-card { border-color: #e1e9f3; border-radius: 12px; padding: 16px; }
.assembly-component-card:hover { border-color: #bcd8fb; box-shadow: 0 8px 20px rgba(44, 105, 184, 0.06); }

@media (max-width: 1300px) {
  .assembly-form-grid { grid-template-columns: minmax(230px, 1fr) 150px; }
  .assembly-expiry-note { grid-column: 1 / -1; }
  .assembly-form-grid .primary-button { grid-column: 1 / -1; justify-self: end; }
  .assembly-component-picker { grid-template-columns: 1fr minmax(230px, 1fr) max-content; }
  .kit-template-panel .kit-components-heading { grid-template-columns: 1fr; gap: 14px; }
  .kit-template-panel .kit-components-heading span { max-width: none; }
  .kit-template-panel .kit-component-add { max-width: 760px; }
}

@media (max-width: 1100px) {
  body { grid-template-columns: 84px minmax(0, 1fr); }
  .sidebar { padding: 22px 10px; }
  .brand-block { height: 72px; justify-content: center; }
  .brand-block h1, .nav-tab { font-size: 0; }
  .nav-tab { justify-content: center; padding: 0; }
  .nav-icon { width: 22px; height: 22px; flex-basis: 22px; }
  .nav-subtabs { display: none !important; }
  .app-shell { padding: 25px; }
}

@media (max-width: 760px) {
  body { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 12px; }
  .sidebar::before, .sidebar::after { display: none; }
  .brand-block { display: none; }
  .nav-tabs { display: flex; margin: 0; overflow-x: auto; padding: 0; }
  .nav-tab { min-width: 48px; min-height: 44px; }
  .app-shell { padding: 18px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .top-actions { width: 100%; overflow-x: auto; padding-bottom: 2px; }
  .metric { min-height: 132px; padding-left: 73px; }
  .assembly-component-card footer { align-items: flex-start; flex-direction: column; }
  .assembly-component-actions { width: 100%; justify-content: flex-end; }
}

/* r11：采购表导入草稿与宽表格浏览。采购、入库表在鼠标拖动、触控及滚动条场景都可横向查看。 */
.purchase-draft-notice {
  width: fit-content;
  max-width: 100%;
  margin: 9px 0 0;
  padding: 7px 10px;
  border: 1px solid #c9defa;
  border-radius: 8px;
  color: #165ba9;
  background: #f3f8ff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.purchase-order-actions {
  min-width: 88px;
  justify-content: center;
  gap: 11px;
  white-space: nowrap;
}

.purchase-order-actions .danger-link {
  color: #d24d5a;
}

.table-wrap.inbound-source-table-wrap,
.table-wrap.purchase-order-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable both-edges;
  touch-action: pan-x pan-y;
  -webkit-overflow-scrolling: touch;
}

.table-wrap.inbound-source-table-wrap::-webkit-scrollbar,
.table-wrap.purchase-order-table-wrap::-webkit-scrollbar {
  height: 13px;
}

.table-wrap.inbound-source-table-wrap::-webkit-scrollbar-track,
.table-wrap.purchase-order-table-wrap::-webkit-scrollbar-track {
  border-radius: 999px;
  background: #eaf0f8;
}

.table-wrap.inbound-source-table-wrap::-webkit-scrollbar-thumb,
.table-wrap.purchase-order-table-wrap::-webkit-scrollbar-thumb {
  border: 3px solid #eaf0f8;
  border-radius: 999px;
  background: #64a9f8;
}

.horizontal-drag-scroll {
  cursor: grab;
}

.horizontal-drag-scroll.is-dragging {
  cursor: grabbing;
  user-select: none;
}

.inbound-source-table {
  min-width: 1770px;
}

.purchase-order-table {
  min-width: 1760px;
}

.purchase-order-table th:last-child,
.purchase-order-table td:last-child {
  width: 112px;
  min-width: 112px;
}

/* 采购订单编辑回填：明细表使用固定列结构，避免图片、名称和条码在宽屏上被挤成错位布局。 */
.purchase-entry-table-wrap {
  width: 100%;
  overflow-x: auto !important;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.purchase-entry-table {
  width: max(100%, 1360px);
  min-width: 1360px;
  table-layout: fixed;
}

.purchase-entry-index-col { width: 72px; }
.purchase-entry-product-col { width: 380px; }
.purchase-entry-quantity-col { width: 180px; }
.purchase-entry-price-col { width: 160px; }
.purchase-entry-batch-col { width: 180px; }
.purchase-entry-date-col { width: 200px; }
.purchase-entry-action-col { width: 188px; }

.purchase-entry-table th,
.purchase-entry-table td {
  box-sizing: border-box;
}

.purchase-entry-table th:nth-child(2),
.purchase-entry-table td:nth-child(2) {
  text-align: left;
}

.purchase-entry-table td:nth-child(1) {
  color: var(--text);
  font-weight: 700;
}

.purchase-item-product {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  width: 100%;
}

.purchase-item-product > div {
  width: 100%;
  overflow: hidden;
}

.purchase-item-product strong,
.purchase-item-product small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purchase-unregistered-mark {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  color: #9a5a00;
  background: #fff3d4;
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  vertical-align: 1px;
}

.product-cell-unregistered .product-thumb-unregistered {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #9a5a00;
  background: #fff3d4;
  border-color: #f4c97a;
  font-size: 11px;
  font-weight: 700;
}

/* r22：销售开单、销售出库列表的横向查看。
   通用 .table-wrap 在较晚的样式中被设置为 overflow:hidden，导致右侧操作列被裁切。
   两个销售列表恢复采购模块已验证的横向滚动行为，并为操作列留出稳定可见的空间。 */
.table-wrap.sale-record-table-wrap,
.table-wrap.sale-order-list-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable both-edges;
  touch-action: pan-x pan-y;
  -webkit-overflow-scrolling: touch;
}

.table-wrap.sale-record-table-wrap > table {
  width: max(100%, 1680px);
  min-width: 1680px;
}

.sale-order-list-table {
  width: max(100%, 1260px) !important;
  min-width: 1260px !important;
  table-layout: fixed;
}

.sale-order-list-table th:nth-child(1),
.sale-order-list-table td:nth-child(1) { width: 66px; min-width: 66px; }
.sale-order-list-table th:nth-child(2),
.sale-order-list-table td:nth-child(2) { width: 170px; min-width: 170px; }
.sale-order-list-table th:nth-child(3),
.sale-order-list-table td:nth-child(3) { width: 190px; min-width: 190px; }
.sale-order-list-table th:nth-child(4),
.sale-order-list-table td:nth-child(4) { width: 110px; min-width: 110px; }
.sale-order-list-table th:nth-child(5),
.sale-order-list-table td:nth-child(5),
.sale-order-list-table th:nth-child(6),
.sale-order-list-table td:nth-child(6) { width: 90px; min-width: 90px; }
.sale-order-list-table th:nth-child(7),
.sale-order-list-table td:nth-child(7) { width: 116px; min-width: 116px; }
.sale-order-list-table th:nth-child(8),
.sale-order-list-table td:nth-child(8) { width: 110px; min-width: 110px; }
.sale-order-list-table th:nth-child(9),
.sale-order-list-table td:nth-child(9) { width: 220px; min-width: 220px; }

.sale-order-list-table .sale-order-actions {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 12px;
  max-width: 202px;
  white-space: nowrap;
}

.table-wrap.sale-record-table-wrap th:last-child,
.table-wrap.sale-order-list-wrap th:last-child {
  position: sticky;
  right: 0;
  z-index: 4;
  background: #f4f7fc;
  box-shadow: -10px 0 14px rgba(33, 67, 111, 0.08);
}

.table-wrap.sale-record-table-wrap tbody td:last-child,
.table-wrap.sale-order-list-wrap tbody td:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  background: #fff;
  box-shadow: -10px 0 14px rgba(33, 67, 111, 0.08);
}

.table-wrap.sale-record-table-wrap::-webkit-scrollbar,
.table-wrap.sale-order-list-wrap::-webkit-scrollbar {
  height: 13px;
}

.table-wrap.sale-record-table-wrap::-webkit-scrollbar-track,
.table-wrap.sale-order-list-wrap::-webkit-scrollbar-track {
  border-radius: 999px;
  background: #eaf0f8;
}

.table-wrap.sale-record-table-wrap::-webkit-scrollbar-thumb,
.table-wrap.sale-order-list-wrap::-webkit-scrollbar-thumb {
  border: 3px solid #eaf0f8;
  border-radius: 999px;
  background: #64a9f8;
}
