:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #63717c;
  --line: #d8e0e5;
  --panel: #ffffff;
  --soft: #f3f7f5;
  --accent: #1f7a5a;
  --accent-2: #bc5b2d;
  --danger: #c92020;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: #eef3f1;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 11px 16px;
  min-height: 42px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  touch-action: manipulation;
}

button:hover {
  filter: brightness(0.96);
}

button.ghost {
  color: var(--ink);
  background: #e7ece9;
}

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

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 24px auto;
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 18px;
}

.brand-panel,
.panel,
.app-view {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.brand-panel {
  min-height: 520px;
  padding: 34px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(150deg, #f8fbfa, #dce8e3);
}

.brand-panel h1 {
  margin: 10px 0 12px;
  font-size: clamp(32px, 5vw, 54px);
  line-height: 1.08;
}

.eyebrow {
  margin: 0;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

.subtitle,
.hint {
  color: var(--muted);
}

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

.language-switch {
  display: inline-flex;
  width: fit-content;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.language-switch button {
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  font-weight: 800;
}

.language-switch button.active {
  color: #fff;
  background: var(--accent);
}

.status-strip span,
.card,
.role-card,
.row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.status-strip span {
  padding: 12px;
  text-align: center;
  font-weight: 700;
}

.login-panel {
  padding: 32px;
  align-self: center;
}

.form {
  display: grid;
  gap: 16px;
}

.form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}

.message {
  min-height: 22px;
  color: var(--danger);
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.app-view {
  grid-column: 1 / -1;
  min-height: 680px;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  padding: 24px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 22px;
  justify-content: space-between;
}

.sidebar nav {
  display: grid;
  gap: 8px;
}

.nav-button {
  width: 100%;
  text-align: left;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
}

.nav-button.active {
  background: var(--soft);
  border-color: var(--line);
}

.content {
  padding: 26px;
}

.content-header,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.card {
  padding: 16px;
}

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

.inline-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 10px;
  margin-bottom: 16px;
}

.product-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.order-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

#ordersPage {
  max-width: 1180px;
}

#ordersPage .order-form {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff, #f6fbf8);
  box-shadow: 0 10px 26px rgba(31, 55, 78, 0.06);
}

.sales-order-create-head {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, #ff7a1a, #ff9f43);
}

.sales-order-create-head strong {
  font-size: 18px;
}

.sales-order-create-head span {
  font-size: 13px;
  opacity: 0.92;
}

#ordersPage .toolbar {
  align-items: flex-start;
}

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

.sales-daily-summary div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.sales-daily-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.sales-daily-summary strong {
  display: block;
  margin-top: 5px;
  color: #18704f;
  font-size: 22px;
}

.sales-order-tabs {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 8px 0 12px;
  margin: 8px 0 10px;
  border-bottom: 1px solid var(--line);
}

.sales-order-tabs button {
  flex: 0 0 auto;
  padding: 6px 0;
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  font-weight: 700;
}

.sales-order-tabs button.active {
  color: #f05a28;
  border-bottom: 2px solid #f05a28;
}

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

.sales-order-card {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(220px, 1.2fr) minmax(240px, 1.4fr) auto;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(31, 55, 78, 0.06);
}

.sales-order-head,
.sales-order-customer,
.sales-order-footer {
  display: grid;
  gap: 10px;
  align-content: center;
}

.sales-order-head span {
  font-weight: 800;
}

.sales-order-head strong {
  color: #f05a28;
}

.sales-order-amount {
  color: #18704f;
  font-size: 14px;
}

.sales-order-customer,
.sales-order-address,
.sales-order-footer {
  color: var(--muted);
  font-size: 13px;
}

.sales-order-address {
  align-self: center;
}

.sales-order-images {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 0;
  align-items: center;
}

.sales-order-thumb {
  flex: 0 0 70px;
  width: 70px;
  height: 70px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  padding: 3px;
  background: #fff;
}

.sales-order-thumb-empty {
  display: grid;
  place-items: center;
  padding: 6px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .sales-order-card {
    grid-template-columns: 1fr;
  }

  .sales-order-head,
  .sales-order-customer,
  .sales-order-footer {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
}

.picking-form {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.delivery-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.delivery-form h3 {
  grid-column: 1 / -1;
}

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

.scan-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.scan-alert {
  border: 2px solid var(--danger);
  border-radius: 8px;
  padding: 16px;
  background: #fff1f1;
  color: var(--danger);
  font-size: 20px;
  font-weight: 800;
}

.scan-ok {
  color: var(--accent);
  font-weight: 800;
}

.scan-row-complete {
  border-color: #9ad7bd;
  color: #146b4b;
  background: #e7f7ef;
  font-weight: 800;
}

.scan-error-mark {
  color: var(--danger);
  font-weight: 900;
}

.order-line {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px auto;
  gap: 10px;
}

.order-line select,
.product-form select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}

.sales-product-search {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.sales-product-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.sales-product-pager {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.sales-product-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  display: grid;
  grid-template-rows: auto 1fr;
}

.sales-product-image {
  aspect-ratio: 1 / 1;
  min-height: 180px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
}

.sales-product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
  background: #fff;
}

.sales-product-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 10px;
  text-align: center;
  background: linear-gradient(135deg, #f7faf8, #dde9e3);
}

.placeholder-code {
  max-width: 100%;
  color: var(--ink);
  font-size: 22px;
  overflow-wrap: anywhere;
}

.placeholder-text {
  color: var(--danger);
  font-size: 13px;
  font-weight: 800;
}

.sales-product-body {
  display: grid;
  gap: 5px;
  padding: 9px;
}

.sales-product-body strong {
  font-size: 14px;
}

.sales-product-body strong,
.sales-product-code,
.sales-product-meta {
  min-width: 0;
  overflow-wrap: anywhere;
}

.sales-product-code {
  color: var(--accent-2);
  font-weight: 800;
}

.sales-product-price {
  color: #f05a28;
  font-weight: 900;
}

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

.sales-product-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 8px;
  margin-top: 4px;
}

.sales-product-actions input {
  min-width: 0;
}

.sales-add-button {
  width: 48px;
  min-height: 44px;
  padding: 0;
  font-size: 24px;
  font-weight: 900;
}

.order-subtitle {
  grid-column: 1 / -1;
  margin: 4px 0 0;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.compact {
  grid-column: 1 / -1;
}

.search,
.pager {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pager {
  justify-content: flex-end;
  margin-top: 14px;
}

.table,
.role-list {
  display: grid;
  gap: 10px;
}

.row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 1fr;
  gap: 10px;
  padding: 13px;
  align-items: center;
}

.row.product-row {
  grid-template-columns: 42px 0.8fr 84px 1.4fr 1fr 0.7fr 0.7fr 0.7fr auto;
}

.row.warehouse-price-row {
  grid-template-columns: 0.9fr 1.5fr 0.8fr 1fr 1fr auto;
}

.warehouse-price-row input {
  min-width: 110px;
}

.product-thumb {
  width: 58px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  padding: 3px;
  background: #fff;
}

.product-thumb-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  padding: 5px;
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
  overflow-wrap: anywhere;
}

.product-thumb-empty small {
  color: var(--danger);
  font-size: 10px;
}

.row-check {
  width: 16px;
  height: 16px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  color: #18704f;
  background: #e5f5ef;
  font-size: 12px;
  font-weight: 800;
}

.admin-sales-dashboard {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

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

.dashboard-summary div {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.dashboard-summary strong {
  color: var(--ink);
  font-size: 22px;
}

.row.admin-sales-row {
  grid-template-columns: 1.2fr 0.7fr 0.7fr 0.8fr 1fr;
}

.table-actions {
  display: flex;
  gap: 6px;
}

.small-button {
  padding: 7px 10px;
  font-size: 12px;
}

.row.order-row {
  grid-template-columns: 1.2fr 1fr 1fr 1.6fr 0.8fr 1.4fr;
}

.row.order-item-row {
  grid-template-columns: 1.1fr 1.4fr 0.6fr 0.7fr 0.8fr auto;
}

.row.admin-order-row {
  grid-template-columns: 1.2fr 0.9fr 1fr 1.4fr 0.8fr 1.3fr 1fr 1.2fr;
}

.admin-order-group {
  display: grid;
  gap: 10px;
  padding: 14px 0 18px;
  border-top: 1px solid var(--line);
}

.admin-order-group:first-child {
  border-top: 0;
  padding-top: 0;
}

.admin-order-group-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.admin-order-group-head h4 {
  margin: 0;
  font-size: 18px;
}

.admin-order-group-head span,
.muted-text,
.modified-cell small {
  color: var(--muted);
}

.admin-order-group-head strong,
.modified-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.admin-order-group-head strong {
  color: #18704f;
  background: #e5f5ef;
}

.modified-cell {
  display: grid;
  gap: 3px;
}

.modified-pill {
  width: fit-content;
  color: #b53218;
  background: #ffe8df;
}

.row.warehouse-row {
  grid-template-columns: 1.2fr 1fr 1fr 1.6fr 0.8fr auto;
}

.row.picking-row {
  grid-template-columns: 1fr 1fr 0.8fr 1fr;
}

.row.scan-row {
  grid-template-columns: 1fr 1fr 0.8fr 0.8fr 0.8fr;
}

.row.scan-record-row {
  grid-template-columns: 1.2fr 0.8fr 1fr auto;
}

.row.delivery-row {
  grid-template-columns: 1.2fr 1fr 1fr 1.5fr 0.8fr 0.8fr auto;
}

.row.delivery-row:not(.header) {
  border-left: 4px solid var(--accent);
}

.row.delivery-row:not(.header) > span:last-child {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.row.delivery-row:not(.header) > span:last-child button {
  min-width: 104px;
}

.row.final-order-row {
  grid-template-columns: 1.1fr 1fr 1fr 1.4fr 1.4fr 0.8fr 1fr;
}

.row.export-task-row {
  grid-template-columns: 1fr 1.5fr 0.9fr 0.9fr 1.2fr auto;
}

.row.log-row {
  grid-template-columns: 1fr 1fr 1.2fr 1fr 1.4fr;
}

.export-toolbar {
  margin-top: 24px;
}

.row.header {
  color: var(--muted);
  font-weight: 700;
  background: #f7faf8;
}

.role-card {
  padding: 16px;
}

.checks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.checks label {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--ink);
}

.checks input {
  width: auto;
}

.narrow {
  max-width: 430px;
}

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

  .brand-panel {
    min-height: 320px;
  }

  .app-view {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .inline-form,
  .product-form,
  .order-form,
  .order-line,
  .sales-product-search,
  .row {
    grid-template-columns: 1fr;
  }

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

  .sales-product-image {
    min-height: 150px;
  }

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

  .row.order-row,
  .row.order-item-row,
  .row.warehouse-price-row,
  .row.warehouse-row,
  .row.picking-row,
  .row.scan-row,
  .row.scan-record-row,
  .row.delivery-row,
  .row.final-order-row,
  .row.export-task-row,
  .row.log-row,
  .scan-form {
    grid-template-columns: 1fr;
  }

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

  button,
  .small-button {
    width: 100%;
    min-height: 48px;
    padding: 13px 14px;
    font-size: 16px;
  }

  .row.header {
    display: none;
  }

  .row.delivery-row,
  .row.final-order-row,
  .row.export-task-row,
  .row.admin-order-row {
    gap: 8px;
    padding: 14px;
  }

  .row.delivery-row > span,
  .row.final-order-row > span,
  .row.export-task-row > span,
  .row.admin-order-row > span {
    display: grid;
    gap: 3px;
    overflow-wrap: anywhere;
  }

  .row.delivery-row > span:nth-child(1)::before,
  .row.final-order-row > span:nth-child(1)::before,
  .row.export-task-row > span:nth-child(1)::before,
  .row.admin-order-row > span:nth-child(1)::before {
    content: "订单号";
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }

  .row.delivery-row > span:nth-child(2)::before,
  .row.final-order-row > span:nth-child(2)::before,
  .row.admin-order-row > span:nth-child(2)::before {
    content: "客户";
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }

  .row.delivery-row > span:nth-child(3)::before,
  .row.final-order-row > span:nth-child(3)::before,
  .row.admin-order-row > span:nth-child(3)::before {
    content: "电话";
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }

  .row.delivery-row > span:nth-child(4)::before,
  .row.final-order-row > span:nth-child(4)::before,
  .row.admin-order-row > span:nth-child(4)::before {
    content: "地址";
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }

  .row.delivery-row > span:last-child,
  .row.export-task-row > span:last-child {
    display: grid;
    grid-template-columns: 1fr;
  }
}

/* ERP UI v2 - visual-only upgrade, business logic unchanged. */
:root {
  --primary: #2563eb;
  --primary-700: #1d4ed8;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --cyan: #06b6d4;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --text: #0f172a;
  --text-soft: #475569;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 18px 48px rgba(15, 23, 42, 0.12);
  --radius: 8px;
  --ink: var(--text);
  --muted: var(--text-soft);
  --line: var(--border);
  --panel: var(--surface);
  --soft: #eff6ff;
  --accent: var(--primary);
  --accent-2: #64748b;
  --danger: var(--error);
}
html { scroll-behavior: smooth; }
body {
  font-family: Inter, "Source Han Sans SC", "Noto Sans CJK SC", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  background: radial-gradient(circle at 18% -12%, rgba(37, 99, 235, 0.12), transparent 34%), linear-gradient(180deg, #ffffff 0%, var(--bg) 42%, #eef4ff 100%);
}
button, input, select { transition: border-color .18s ease, box-shadow .18s ease, transform .12s ease, background .18s ease; }
button { border-radius: var(--radius); background: var(--primary); box-shadow: var(--shadow-sm); font-weight: 800; }
button:hover { filter: none; background: var(--primary-700); transform: translateY(-1px); box-shadow: var(--shadow-md); }
button:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
button.ghost { color: var(--text); background: #f1f5f9; }
button.ghost:hover { background: #e2e8f0; }
button.danger-button, .danger-button { background: var(--error); }
button.danger-button:hover, .danger-button:hover { background: #dc2626; }
.scan-form button, #startScanPickingButton, button[data-scan-order-id] { background: var(--cyan); }
#confirmPickingButton, button[type="submit"] { background: var(--success); }
#createExportButton, button[data-packing-export-order-id], a[download], .export-toolbar button { color: #0f172a; background: #e5e7eb; }
input, select { border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
input:focus, select:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14); }
.shell { width: 100%; min-height: 100vh; margin: 0; padding: 18px; grid-template-columns: minmax(320px, .9fr) minmax(360px, 1.1fr); }
.brand-panel, .panel, .app-view { border-color: rgba(226, 232, 240, .9); border-radius: var(--radius); box-shadow: var(--shadow-md); }
.brand-panel { background: linear-gradient(135deg, rgba(37, 99, 235, .12), rgba(16, 185, 129, .08)), #fff; }
.app-view { grid-column: 1 / -1; height: calc(100vh - 36px); min-height: 720px; overflow: hidden; grid-template-columns: 248px minmax(0, 1fr); background: rgba(255, 255, 255, .94); }
.sidebar { position: sticky; top: 0; height: calc(100vh - 36px); padding: 18px; background: #0f172a; color: #e5e7eb; border-right: 0; }
.sidebar .eyebrow, .sidebar .hint { color: #94a3b8; }
.sidebar h2 { color: #fff; }
.sidebar nav { gap: 6px; }
.nav-button { position: relative; display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 10px 12px; color: #cbd5e1; border-radius: var(--radius); }
.nav-button::before { content: attr(data-icon); width: 22px; height: 22px; display: inline-grid; place-items: center; border-radius: 6px; background: rgba(148, 163, 184, .14); color: #bfdbfe; font-size: 13px; }
.nav-button:hover { color: #fff; background: rgba(37, 99, 235, .18); transform: translateX(2px); }
.nav-button.active { color: #fff; border-color: rgba(96, 165, 250, .3); background: linear-gradient(135deg, rgba(37, 99, 235, .95), rgba(59, 130, 246, .7)); box-shadow: 0 10px 24px rgba(37, 99, 235, .26); }
#logoutButton { color: #e5e7eb; background: rgba(148, 163, 184, .14); }
.content { height: 100%; overflow: auto; padding: 18px 22px 28px; }
.content-header { position: sticky; top: 0; z-index: 20; margin: -18px -22px 18px; padding: 15px 22px; background: rgba(248, 250, 252, .86); border-bottom: 1px solid var(--border); backdrop-filter: blur(12px); }
.toolbar { align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: rgba(255, 255, 255, .88); box-shadow: var(--shadow-sm); }
.toolbar h3 { margin: 6px 0; }
.search { flex-wrap: wrap; justify-content: flex-end; }
.search input, .search select { min-width: 180px; height: 40px; }
.card, .role-card, .row, .sales-order-card, .sales-product-card, .dashboard-summary div, .sales-daily-summary div, #ordersPage .order-form { border: 1px solid var(--border); border-radius: var(--radius); background: rgba(255, 255, 255, .96); box-shadow: var(--shadow-sm); }
.card, .dashboard-summary div, .sales-daily-summary div { position: relative; overflow: hidden; }
.card::after, .dashboard-summary div::after, .sales-daily-summary div::after { content: ""; position: absolute; inset: auto 0 0 0; height: 3px; background: linear-gradient(90deg, var(--primary), var(--success)); }
.dashboard-summary, .sales-daily-summary { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.dashboard-summary strong, .sales-daily-summary strong, .erp-number { color: var(--primary); font-variant-numeric: tabular-nums; }
.table { overflow: auto; border-radius: var(--radius); }
.row { min-width: max-content; margin: 0; }
.row:not(.header):hover { background: #f8fbff; border-color: #bfdbfe; box-shadow: 0 8px 24px rgba(37, 99, 235, .08); }
.row.header { position: sticky; top: 0; z-index: 5; color: #334155; background: #f1f5f9; box-shadow: inset 0 -1px 0 var(--border); }
.status-badge { width: fit-content; min-height: 24px; padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 900; color: #1e293b; background: #e2e8f0; white-space: nowrap; }
.status-pending, .status-review { color: #92400e; background: #fef3c7; }
.status-picking, .status-delivery { color: #075985; background: #cffafe; }
.status-picked, .status-complete { color: #065f46; background: #d1fae5; }
.status-error, .status-danger { color: #991b1b; background: #fee2e2; }
.copy-button { display: inline-grid; place-items: center; width: 26px; min-width: 26px; height: 26px; min-height: 26px; margin-left: 6px; padding: 0; color: var(--primary); background: #eff6ff; border: 1px solid #bfdbfe; box-shadow: none; vertical-align: middle; }
.copy-button::before { content: "⧉"; font-size: 13px; }
.copy-button:hover { color: #fff; background: var(--primary); transform: translateY(-1px); }
.sales-product-card, .sales-order-card { transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.sales-product-card:hover, .sales-order-card:hover { transform: translateY(-3px); border-color: #93c5fd; box-shadow: var(--shadow-lg); }
.sales-product-image { background: linear-gradient(180deg, #fff, #f8fafc); }
.sales-add-button { background: var(--success); }
.sales-order-head strong, .sales-order-amount { width: fit-content; padding: 4px 9px; border-radius: 999px; color: #065f46; background: #d1fae5; }
.scan-alert { animation: erpPulse .8s ease-in-out infinite alternate; }
.scan-row-complete { border-color: rgba(16, 185, 129, .45); background: #ecfdf5; }
.page { animation: erpPageIn .2s ease-out; }
.message:not(:empty) { position: fixed; right: 22px; bottom: 22px; z-index: 1000; min-width: 220px; max-width: 420px; padding: 12px 14px; border-radius: var(--radius); color: #fff !important; background: #0f172a; box-shadow: var(--shadow-lg); }
@keyframes erpPageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes erpPulse { from { box-shadow: 0 0 0 rgba(239, 68, 68, 0); } to { box-shadow: 0 0 0 5px rgba(239, 68, 68, .12); } }
@media (max-width: 860px) {
  .shell { padding: 10px; }
  .app-view { height: auto; min-height: 100vh; }
  .sidebar { position: relative; height: auto; }
  .sidebar nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content { height: auto; overflow: visible; padding: 14px; }
  .content-header { margin: -14px -14px 14px; padding: 12px 14px; }
  .toolbar, .search, .pager { display: grid; grid-template-columns: 1fr; align-items: stretch; }
  .search input, .search select, .search button { width: 100%; }
}

.order-total-row {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #eff6ff, #ffffff);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.order-total-row span {
  color: var(--text-soft);
  font-weight: 800;
}
.order-total-row strong,
.order-item-amount {
  color: var(--primary);
  font-size: 18px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 860px) {
  .row.order-item-row {
    grid-template-columns: 1fr;
  }
  .order-total-row {
    justify-content: space-between;
  }
}
