:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #20242a;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #0f8f72;
  --brand-dark: #0b6f5a;
  --accent: #2563eb;
  --warn: #b45309;
  --danger: #dc2626;
  --good: #15803d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.sidebar {
  background: #14213d;
  color: #f9fafb;
  padding: 18px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  font-weight: 700;
  font-size: 18px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--brand);
}

.shop-switch {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 18px;
}

.shop-switch small {
  display: block;
  color: #cbd5e1;
}

.shop-switch strong + small {
  margin-top: 4px;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: #dbeafe;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

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

.nav a.active {
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: inset 3px 0 0 #f97316;
  transform: translateX(2px);
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 60px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
}

.topbar-with-ad {
  height: 84px;
  align-items: center;
}

.topbar-ad {
  flex: 1 1 auto;
  max-width: 1000px;
  min-width: 260px;
  height: 68px;
  display: block;
  overflow: hidden;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #f8fafc;
}

.topbar-ad img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.topbar-text-ad {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  background: linear-gradient(90deg, #ecfdf5, #eff6ff);
  color: #0f172a;
}

.topbar-text-ad strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
}

.topbar-ad-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #0f8f72;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

input[type="number"][name*="price"],
input[type="number"][name*="amount"],
input[type="number"][name*="cost"],
input[type="number"][name*="payment"],
input[type="number"][name*="refund"],
input[type="number"][name*="discount"],
input[type="number"][name*="received"],
input[type="number"][name*="receivable"],
input[type="number"][name*="paid"],
input[type="number"][name*="payable"],
input[type="number"][name*="debt"],
input[type="number"][name*="balance"],
input[type="number"][id*="Price"],
input[type="number"][id*="Amount"],
input[type="number"][id*="Cost"],
input[type="number"][id*="Payment"],
input[type="number"][id*="Refund"],
input[type="number"][id*="Discount"],
input[type="number"][id*="Received"],
input[type="number"][id*="Receivable"],
input[type="number"][id*="Paid"],
input[type="number"][id*="Payable"],
input[type="number"][id*="Debt"],
input[type="number"][id*="Balance"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

input[type="number"][name*="price"]::-webkit-outer-spin-button,
input[type="number"][name*="price"]::-webkit-inner-spin-button,
input[type="number"][name*="amount"]::-webkit-outer-spin-button,
input[type="number"][name*="amount"]::-webkit-inner-spin-button,
input[type="number"][name*="cost"]::-webkit-outer-spin-button,
input[type="number"][name*="cost"]::-webkit-inner-spin-button,
input[type="number"][name*="payment"]::-webkit-outer-spin-button,
input[type="number"][name*="payment"]::-webkit-inner-spin-button,
input[type="number"][name*="refund"]::-webkit-outer-spin-button,
input[type="number"][name*="refund"]::-webkit-inner-spin-button,
input[type="number"][name*="discount"]::-webkit-outer-spin-button,
input[type="number"][name*="discount"]::-webkit-inner-spin-button,
input[type="number"][name*="received"]::-webkit-outer-spin-button,
input[type="number"][name*="received"]::-webkit-inner-spin-button,
input[type="number"][name*="receivable"]::-webkit-outer-spin-button,
input[type="number"][name*="receivable"]::-webkit-inner-spin-button,
input[type="number"][name*="paid"]::-webkit-outer-spin-button,
input[type="number"][name*="paid"]::-webkit-inner-spin-button,
input[type="number"][name*="payable"]::-webkit-outer-spin-button,
input[type="number"][name*="payable"]::-webkit-inner-spin-button,
input[type="number"][name*="debt"]::-webkit-outer-spin-button,
input[type="number"][name*="debt"]::-webkit-inner-spin-button,
input[type="number"][name*="balance"]::-webkit-outer-spin-button,
input[type="number"][name*="balance"]::-webkit-inner-spin-button,
input[type="number"][id*="Price"]::-webkit-outer-spin-button,
input[type="number"][id*="Price"]::-webkit-inner-spin-button,
input[type="number"][id*="Amount"]::-webkit-outer-spin-button,
input[type="number"][id*="Amount"]::-webkit-inner-spin-button,
input[type="number"][id*="Cost"]::-webkit-outer-spin-button,
input[type="number"][id*="Cost"]::-webkit-inner-spin-button,
input[type="number"][id*="Payment"]::-webkit-outer-spin-button,
input[type="number"][id*="Payment"]::-webkit-inner-spin-button,
input[type="number"][id*="Refund"]::-webkit-outer-spin-button,
input[type="number"][id*="Refund"]::-webkit-inner-spin-button,
input[type="number"][id*="Discount"]::-webkit-outer-spin-button,
input[type="number"][id*="Discount"]::-webkit-inner-spin-button,
input[type="number"][id*="Received"]::-webkit-outer-spin-button,
input[type="number"][id*="Received"]::-webkit-inner-spin-button,
input[type="number"][id*="Receivable"]::-webkit-outer-spin-button,
input[type="number"][id*="Receivable"]::-webkit-inner-spin-button,
input[type="number"][id*="Paid"]::-webkit-outer-spin-button,
input[type="number"][id*="Paid"]::-webkit-inner-spin-button,
input[type="number"][id*="Payable"]::-webkit-outer-spin-button,
input[type="number"][id*="Payable"]::-webkit-inner-spin-button,
input[type="number"][id*="Debt"]::-webkit-outer-spin-button,
input[type="number"][id*="Debt"]::-webkit-inner-spin-button,
input[type="number"][id*="Balance"]::-webkit-outer-spin-button,
input[type="number"][id*="Balance"]::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.topbar-user {
  display: grid;
  gap: 2px;
  justify-items: end;
  line-height: 1.2;
  color: var(--muted);
}

.topbar-user strong {
  color: var(--text);
  font-size: 14px;
}

.topbar-user small {
  font-size: 12px;
}

.content {
  padding: 22px;
  width: 100%;
  max-width: 1320px;
}

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

.page-title h1 {
  font-size: 24px;
  margin: 0;
}

.page-title p {
  margin: 4px 0 0;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 14px;
}

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

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

.dashboard-hero h1 {
  margin: 4px 0 6px;
  font-size: 28px;
}

.dashboard-hero p {
  margin: 0;
  color: var(--muted);
}

.dashboard-eyebrow {
  color: var(--primary);
  font-weight: 800;
  font-size: 13px;
}

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

.kpi-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.smart-kpi {
  min-height: 112px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.04);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.smart-kpi:hover {
  transform: translateY(-2px);
  border-color: #bfdbfe;
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.1);
}

.kpi-icon {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
  flex: 0 0 auto;
}

.sales-icon {
  background: #0f8f72;
}

.profit-icon {
  background: #2563eb;
}

.purchase-icon {
  background: #b45309;
}

.stock-icon {
  background: #7c3aed;
}

.receivable-icon {
  background: #0891b2;
}

.payable-icon {
  background: #dc2626;
}

.order-icon {
  background: #475569;
}

.inbound-icon {
  background: #ea580c;
}

.kpi-delta {
  display: inline-flex;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.kpi-delta.up {
  color: #0f8f72;
}

.kpi-delta.down,
.kpi-delta.warn {
  color: #dc2626;
}

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

.quick-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
}

.quick-action span {
  font-weight: 700;
}

.quick-action strong {
  color: var(--muted);
  font-size: 13px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.8fr);
  gap: 16px;
}

.dashboard-main-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.8fr);
  margin-top: 16px;
}

.dashboard-lower-grid {
  margin-top: 16px;
}

.dashboard-insight-card {
  position: relative;
  overflow: hidden;
  background: #fff;
  border: 1px solid #dbeafe;
  border-left: 4px solid #0f8f72;
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.04);
}

.dashboard-insight-card::before {
  content: "";
  position: absolute;
  right: 18px;
  top: 16px;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.1), rgba(14, 165, 233, 0));
  pointer-events: none;
}

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

.insight-head h2 {
  margin: 4px 0 0;
  color: #111827;
}

.insight-badge {
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  color: #2563eb;
  background: #eff6ff;
}

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

.insight-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  color: #334155;
}

.insight-item span {
  width: 8px;
  height: 8px;
  margin-top: 7px;
  border-radius: 50%;
  background: #0f8f72;
  flex: 0 0 auto;
}

.bar-chart {
  height: 240px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
  align-items: end;
}

.chart-card {
  min-height: 340px;
}

.chart-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.chart-toggle a {
  min-width: 42px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
  padding: 0 9px;
}

.chart-toggle a.active {
  color: #fff;
  background: #2563eb;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.18);
}

.smart-bar-chart {
  height: 260px;
}

.bar-item {
  min-width: 0;
  display: grid;
  grid-template-rows: 28px 1fr 24px;
  gap: 6px;
  height: 100%;
  text-align: center;
}

.bar-value {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.bar-track {
  display: flex;
  align-items: end;
  background: #eef2f7;
  border-radius: 8px;
  overflow: hidden;
}

.dual-track {
  position: relative;
  justify-content: center;
}

.bar-fill {
  width: 100%;
  background: linear-gradient(180deg, #22c55e, #0f8f72);
  border-radius: 8px 8px 0 0;
}

.dual-track .bar-fill {
  width: 44%;
}

.profit-fill {
  background: linear-gradient(180deg, #60a5fa, #2563eb);
}

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

.chart-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.chart-summary span {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: #475569;
  font-size: 12px;
}

.pie-layout {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 230px;
}

.css-pie {
  width: 160px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.css-pie::after {
  content: "";
  position: absolute;
  inset: 38px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px var(--line);
}

.pie-legend {
  display: grid;
  gap: 9px;
}

.pie-legend div {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.pie-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.pie-legend span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #475569;
}

.rank-list,
.warning-list,
.debt-list {
  display: grid;
  gap: 10px;
}

.rank-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.rank-row > span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #eff6ff;
  color: #2563eb;
  font-weight: 800;
}

.rank-row div {
  min-width: 0;
}

.rank-row strong {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.rank-row em {
  display: block;
  height: 6px;
  margin-top: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #22c55e, #2563eb);
}

.rank-row b {
  color: #0f8f72;
}

.warning-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
}

.warning-row span {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  text-align: center;
}

.warning-row span.danger {
  background: #fef2f2;
  color: #dc2626;
}

.warning-row span.warn {
  background: #fff7ed;
  color: #ea580c;
}

.warning-row strong {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.warning-row em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.debt-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

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

.debt-list span {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.debt-list strong {
  color: #2563eb;
}

.dashboard-quick-grid {
  margin-top: 16px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.summary-grid div {
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
}

.summary-grid span {
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}

.summary-grid strong {
  font-size: 22px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.workspace-tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: -22px -22px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.workspace-tab {
  min-width: 138px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--line);
  color: #4b5563;
  font-weight: 700;
  white-space: nowrap;
  position: relative;
}

.workspace-tab:hover {
  color: #f05a2a;
  background: #fff7f2;
}

.workspace-tab.active {
  color: #f05a2a;
  background: #fff;
}

.workspace-tab.active::after {
  content: "";
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 0;
  height: 3px;
  border-radius: 999px 999px 0 0;
  background: #f05a2a;
}

.modal-page {
  min-height: calc(100vh - 104px);
  display: grid;
  place-items: start center;
  padding: 14px 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  place-items: start center;
  padding: 42px 16px;
  background: rgba(17, 24, 39, 0.48);
  z-index: 50;
  overflow-y: auto;
}

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

.modal-dialog {
  width: min(760px, 100%);
  max-height: calc(100vh - 84px);
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(17, 24, 39, 0.28);
  overflow: hidden;
}

.product-dialog,
.order-dialog {
  width: min(920px, 100%);
}

.small-dialog {
  width: min(520px, 100%);
}

.modal-header {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid #d1d5db;
}

.modal-header h2 {
  font-size: 18px;
  margin: 0;
}

.modal-close {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: #9ca3af;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.modal-body {
  max-height: calc(100vh - 144px);
  overflow-y: auto;
  padding: 0 18px 18px;
}

.modal-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  margin: 0 -18px 24px;
  border-bottom: 1px solid #d1d5db;
}

.product-form-tabs {
  grid-template-columns: repeat(3, 1fr);
}

.modal-tab {
  height: 50px;
  border: 0;
  background: #d1d5db;
  color: #52525b;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.modal-tab.active {
  background: #fff;
  color: #f05a2a;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.compact-form {
  width: min(820px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.compact-form .field {
  grid-template-columns: 118px minmax(0, 1fr);
  align-items: center;
}

.compact-form .form-row {
  display: grid;
  gap: 14px;
  justify-content: start;
}

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

.compact-form .form-row.three-cols {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.compact-form .name-code-row {
  grid-template-columns: minmax(340px, 403px) 260px;
}

.compact-form .form-row .field {
  grid-template-columns: 92px minmax(0, 1fr);
}

.compact-form .name-code-row .field {
  grid-template-columns: 92px minmax(0, 1fr);
}

.compact-form .product-code-field input {
  min-width: 150px;
}

.compact-form .form-row .field.with-link {
  grid-template-columns: 92px auto auto auto;
  align-items: center;
  justify-content: start;
}

.compact-form .form-row .field.with-link .link-button {
  justify-self: start;
  min-height: 0;
  padding: 0;
  line-height: 1.2;
}

.compact-form .form-row .field.with-link select {
  width: 9em;
}

.compact-form .form-row .field.unit-field select {
  width: 6em;
  min-width: 6em;
}

.compact-form .form-row.three-cols .field {
  grid-template-columns: 96px minmax(0, 1fr);
}

.compact-form .field.full {
  align-items: start;
}

.compact-form label {
  text-align: right;
  color: #4b5563;
}

.field.required label::before {
  content: "* ";
  color: #ef4444;
}

.field.with-link {
  grid-template-columns: 118px minmax(0, 1fr) auto auto;
}

.unit-field {
  grid-template-columns: 118px minmax(0, 1fr) auto auto;
}

.link-button {
  border: 0;
  background: transparent;
  color: #0ea5e9;
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
}

.image-upload-panel {
  min-height: 360px;
  display: grid;
  gap: 18px;
  align-content: start;
  padding: 10px 0;
}

.file-upload-panel {
  min-height: 360px;
  display: grid;
  gap: 18px;
  align-content: start;
  padding: 10px 0;
}

.file-dropzone {
  width: 190px;
  height: 170px;
}

.attachment-list {
  width: min(700px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 10px;
}

.attachment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}

.attachment-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.attachment-row span {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.attachment-row strong {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.upload-dropzone {
  width: 210px;
  height: 210px;
  justify-self: center;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  border: 2px dashed #cbd5e1;
  color: #9ca3af;
  cursor: pointer;
  background: #fff;
}

.upload-dropzone input {
  display: none;
}

.upload-plus {
  font-size: 54px;
  line-height: 1;
  font-weight: 200;
}

.upload-preview-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.upload-preview-card {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #f9fafb;
}

.upload-preview-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #fff;
}

.upload-preview-card span {
  position: absolute;
  left: 6px;
  top: 6px;
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(17, 24, 39, 0.72);
  color: #fff;
  font-size: 12px;
}

.image-manage-grid {
  align-items: start;
}

.image-cover-choice {
  position: absolute;
  left: 50%;
  bottom: 7px;
  width: 20%;
  min-width: 54px;
  max-width: 72px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 2px 6px;
  background: rgba(15, 23, 42, 0.56);
  color: #fff;
  font-size: 11px;
  cursor: pointer;
}

.image-cover-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.existing-image-card.is-cover-selected .image-cover-choice {
  background: rgba(15, 143, 114, 0.86);
}

.image-cover-choice em {
  font-style: normal;
  line-height: 1;
  white-space: nowrap;
}

.image-delete-button {
  position: absolute;
  right: 5px;
  top: 5px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(220, 38, 38, 0.92);
  color: #fff;
  font-size: 18px;
  line-height: 18px;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 10px rgba(127, 29, 29, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.9);
  transition: opacity 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.upload-preview-card:hover .image-delete-button,
.upload-preview-card:focus-within .image-delete-button,
.existing-image-card.is-marked-delete .image-delete-button {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

@media (hover: none) {
  .image-delete-button {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
  }
}

.existing-image-card.is-marked-delete {
  opacity: 0.45;
}

.existing-image-card.is-marked-delete::after {
  content: "待删除";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.62);
  color: var(--danger);
  font-weight: 700;
  pointer-events: none;
  z-index: 2;
}

.existing-image-card.is-marked-delete .image-delete-button {
  background: rgba(107, 114, 128, 0.9);
  z-index: 3;
}

.existing-image-card.is-marked-delete .image-delete-button::before {
  content: "↺";
  font-size: 13px;
}

.existing-image-card.is-marked-delete .image-delete-button {
  font-size: 0;
}

.image-rules {
  width: min(620px, 100%);
  margin: 10px auto 0;
  color: #6b7280;
}

.image-rules strong {
  display: block;
  margin-bottom: 10px;
  color: #4b5563;
}

.image-rules p {
  margin: 8px 0;
}

.copyright-confirm {
  width: min(620px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #4b5563;
}

.copyright-confirm[hidden] {
  display: none;
}

.copyright-confirm input {
  width: auto;
}

.upload-errors {
  grid-column: 1 / -1;
  color: var(--danger);
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px;
}

.radio-field input[type="checkbox"] {
  width: auto;
}

.compact-form .serial-number-field {
  display: none;
}

.compact-form .serial-number-field.is-visible {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
}

.serial-number-input {
  grid-column: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.serial-number-input textarea {
  min-height: 56px;
}

.radio-options {
  display: flex;
  align-items: center;
  gap: 24px;
}

.radio-options label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.radio-options input {
  width: auto;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding-top: 16px;
}

.modal-actions .btn-primary {
  min-width: 160px;
}

.stat-label {
  color: var(--muted);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.panel-title h2 {
  margin: 0;
  font-size: 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 13px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

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

.btn:disabled,
.btn.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-danger {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.compact-actions {
  gap: 6px;
}

.compact-actions form {
  margin: 0;
}

.compact-actions .btn {
  min-height: 30px;
  padding: 5px 9px;
}

.inline-form {
  margin: 0;
}

.btn-quiet-strong {
  min-height: 42px;
  padding: 10px 18px;
  border-color: #f59e0b;
  background: #fff7ed;
  color: #c2410c;
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(245, 158, 11, 0.16);
}

.toolbar-card {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
}

.message-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.message {
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px 12px;
}

.message.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: var(--danger);
}

.message.success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: var(--good);
}

.product-toolbar select {
  width: min(280px, 100%);
}

.product-toolbar input[type="text"] {
  width: min(300px, 100%);
}

.split-action {
  border-radius: 6px;
}

.toolbar-card input[type="text"] {
  width: min(420px, 100%);
}

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

.product-table th,
.product-table td {
  height: 52px;
}

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

.order-product-table th,
.order-product-table td {
  overflow: hidden;
  white-space: nowrap;
  vertical-align: middle;
}

.order-product-name-col {
  width: 32%;
}

.order-product-code-col {
  width: 28%;
}

.order-product-price-col {
  width: 13%;
}

.order-product-stock-col {
  width: 12%;
}

.order-product-action-col {
  width: 140px;
  min-width: 140px;
}

.order-product-table .order-product-action-col,
.order-product-table th:last-child,
.order-product-table td:last-child {
  padding-right: 22px;
}

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

.product-cell-text {
  min-width: 0;
  overflow: hidden;
}

.order-product-table .product-cell strong,
.order-product-table .product-cell .muted,
.order-product-line {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-product-table .return-button {
  width: 86px;
  min-width: 86px;
}

.product-cell img,
.thumb-placeholder {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #f9fafb;
}

.product-cell img {
  object-fit: contain;
}

.thumb-placeholder {
  display: grid;
  place-items: center;
  color: #cbd5e1;
  font-size: 12px;
}

.serial-mark {
  display: inline-flex;
  margin-left: 4px;
  color: #f05a2a;
  font-size: 12px;
  font-weight: 700;
}

.return-button {
  min-width: 86px;
  background: #ff5a32;
  border-color: #ff5a32;
}

.list-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
}

.list-footer-paged {
  justify-content: space-between;
  flex-wrap: wrap;
}

.pagination-summary,
.pagination-controls,
.pagination-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pagination-form {
  margin: 0;
}

.pagination-form select {
  width: auto;
  min-width: 76px;
}

.compact-partner-form {
  gap: 12px;
}

.compact-partner-form .form-row.two-cols {
  display: grid;
  grid-template-columns: 168px 260px;
  gap: 14px;
}

.input-contact {
  width: 8em;
  min-width: 8em;
}

.input-phone {
  width: 15ch;
  min-width: 15ch;
}

.input-amount {
  width: 10ch;
  min-width: 10ch;
}

.input-with-unit {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.opening-amount-field {
  align-items: start;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.clickable-product-row {
  cursor: pointer;
  transition: background 0.16s ease;
}

.clickable-product-row:hover td {
  background: #f8fafc;
}

.clickable-document-row {
  cursor: pointer;
  transition: background 0.16s ease;
}

.clickable-document-row:hover td {
  background: #f8fafc;
}

.clickable-ledger-row {
  cursor: pointer;
  transition: background 0.16s ease;
}

.clickable-ledger-row:hover td {
  background: #f8fafc;
}

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

.detail-meta-grid div,
.document-detail-meta div {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.detail-meta-grid span,
.document-detail-meta span {
  color: var(--muted);
  font-size: 12px;
}

.detail-meta-grid strong,
.document-detail-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-total-row {
  display: flex;
  justify-content: flex-end;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.detail-remark-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafb;
}

.detail-remark-row span {
  color: var(--muted);
}

.detail-remark-row strong {
  font-weight: 500;
  white-space: pre-wrap;
  word-break: break-word;
}

.documents-table {
  table-layout: fixed;
  min-width: 1120px;
}

.documents-table th,
.documents-table td {
  vertical-align: top;
  overflow: hidden;
}

.documents-table .document-detail-col {
  width: 23%;
  white-space: normal;
}

.documents-table .document-partner-col {
  width: 9em;
  white-space: normal;
}

.documents-table .document-remark-col {
  width: 18%;
  white-space: normal;
}

.documents-table .document-money-col {
  width: 14%;
  white-space: nowrap;
}

.documents-table .document-money-col strong,
.documents-table .document-money-col .muted {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.45;
}

.documents-table .document-time-col {
  width: 15%;
}

.documents-table .document-actions-col {
  width: 240px;
  white-space: nowrap;
}

.documents-table .document-actions-col .compact-actions {
  flex-wrap: nowrap;
}

.documents-table .document-detail-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.45;
}

.documents-table .document-detail-subline {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.45;
}

.documents-table .document-cell-clamp,
.documents-table .document-partner-name {
  display: -webkit-box;
  line-height: 1.45;
  max-height: 2.9em;
  overflow: hidden;
  white-space: normal;
  word-break: break-all;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.documents-table .document-partner-name {
  width: 8em;
  max-width: 8em;
}

.order-dialog .modal-actions {
  justify-content: center;
}

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

.finance-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.finance-search {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 1 540px;
  flex-wrap: nowrap;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  max-width: 100%;
}

.finance-search input[type="text"] {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
}

.finance-search .btn {
  flex: 0 0 auto;
  min-width: 76px;
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  font-weight: 600;
}

.finance-search .btn:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.finance-total {
  color: #374151;
  white-space: nowrap;
}

.finance-total strong {
  color: #0ea5e9;
  font-size: 18px;
}

.finance-actions {
  align-items: center;
}

.finance-balance-table {
  table-layout: fixed;
}

.finance-balance-table th:nth-child(1),
.finance-balance-table td:nth-child(1) {
  width: 28%;
}

.finance-balance-table th:nth-child(2),
.finance-balance-table td:nth-child(2) {
  width: 14%;
}

.finance-balance-table th:nth-child(3),
.finance-balance-table td:nth-child(3) {
  width: 20%;
}

.finance-balance-table th:nth-child(4),
.finance-balance-table td:nth-child(4) {
  width: 18%;
}

.finance-balance-table th:nth-child(5),
.finance-balance-table td:nth-child(5) {
  width: 20%;
}

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

.finance-bill-head {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(140px, 1fr) minmax(140px, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px 0 14px;
  border-bottom: 1px solid var(--line);
  color: #4b5563;
}

.finance-bill-head strong {
  color: #111827;
}

.finance-export-link {
  color: #0284c7;
  font-weight: 600;
  text-decoration: none;
}

.finance-export-link::before {
  content: "↪ ";
}

.finance-detail-wrap {
  margin-top: 0;
}

.finance-detail-table {
  table-layout: fixed;
}

.finance-detail-table th:nth-child(1),
.finance-detail-table td:nth-child(1) {
  width: 46%;
}

.finance-detail-table th:nth-child(2),
.finance-detail-table td:nth-child(2) {
  width: 25%;
}

.finance-detail-table th:nth-child(3),
.finance-detail-table td:nth-child(3) {
  width: 16%;
}

.finance-detail-table th:nth-child(4),
.finance-detail-table td:nth-child(4) {
  width: 13%;
}

.finance-detail-table td {
  vertical-align: middle;
}

.finance-bill-badge {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-right: 8px;
  border-radius: 6px;
  background: #38bdf8;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  vertical-align: middle;
}

.finance-settlement-history {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.finance-settlement-history summary {
  cursor: pointer;
  padding: 12px 14px;
  color: #374151;
  font-weight: 600;
}

.finance-settlement-history .table-wrap {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
}

.link-button {
  border: 0;
  background: transparent;
  color: #0284c7;
  cursor: pointer;
  padding: 5px 8px;
  font: inherit;
}

.link-button:hover {
  color: #0369a1;
}

.btn-outline-orange {
  border-color: #ff5a32;
  color: #ff5a32;
  background: #fff;
  min-width: 70px;
}

.btn-outline-orange:hover {
  background: #fff7ed;
}

.settle-dialog {
  max-width: 560px;
}

.settle-form {
  display: grid;
  gap: 14px;
}

.settle-form .field {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.settle-form label {
  color: #4b5563;
  text-align: right;
}

.settle-form .input-with-unit {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 24px;
}

.settle-form textarea {
  min-height: 120px;
}

.settle-form .modal-actions {
  grid-template-columns: none;
  justify-content: center;
}

.purchase-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 14px;
  align-items: start;
}

.purchase-product-list {
  min-width: 0;
}

.purchase-cart-panel {
  position: sticky;
  top: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

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

.purchase-cart-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px 78px;
  gap: 9px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f9fafb;
}

.purchase-cart-row label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.purchase-cart-row input {
  width: 100%;
  min-width: 0;
}

.purchase-cart-row .btn-row {
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.cart-product {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.cart-product strong,
.cart-product span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cart-amount {
  grid-column: 1 / -1;
  color: var(--brand);
}

.cart-serial-field {
  grid-column: 1 / -1;
}

.cart-serial-field textarea {
  width: 100%;
  resize: vertical;
}

.return-toolbar {
  position: relative;
}

.return-next-button {
  margin-left: auto;
  min-width: 126px;
}

.return-source-strip {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 14px;
  margin-bottom: 14px;
}

.return-source-strip span {
  color: var(--muted);
}

.return-source-strip strong {
  color: var(--text);
}

.return-cart-list .empty-state {
  padding: 20px 12px;
}

.return-cart-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafb;
  padding: 10px;
}

.return-cart-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.whole-return-dialog {
  width: min(980px, 100%);
}

.whole-return-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 36px;
  padding: 14px 0 16px;
  border-bottom: 1px solid var(--line);
}

.whole-return-meta div {
  display: grid;
  gap: 8px;
}

.whole-return-meta span {
  color: #4b5563;
  font-size: 15px;
}

.whole-return-table {
  margin-top: 12px;
  max-height: 260px;
  overflow: auto;
  border: 0;
}

.whole-return-table th,
.whole-return-table td {
  border-bottom: 1px solid #edf0f3;
}

.whole-return-footer {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 18px 0 4px;
}

.whole-return-footer label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #4b5563;
}

.whole-return-footer input,
.whole-return-footer select {
  width: auto;
  min-width: 118px;
}

.whole-return-footer strong {
  color: #ff5a32;
}

.whole-return-money {
  color: var(--muted);
}

.checkout-form {
  padding-top: 18px;
}

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

.checkout-grid .full {
  grid-column: 1 / -1;
}

.order-checkout-compact .checkout-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 16px;
  align-items: end;
}

.order-checkout-compact .field {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.order-checkout-compact .field label {
  color: #4b5563;
  text-align: right;
  white-space: nowrap;
}

.order-checkout-compact .with-inline-action {
  grid-template-columns: 76px minmax(15em, 1fr) auto;
}

.order-checkout-compact .supplier-field {
  grid-template-columns: 76px minmax(15em, 18em) auto;
}

.supplier-field .link-button {
  white-space: nowrap;
  padding-left: 4px;
  padding-right: 0;
}

.order-checkout-compact .full {
  grid-template-columns: 76px minmax(0, 1fr);
}

.order-checkout-compact input,
.order-checkout-compact select {
  min-height: 36px;
}

.order-checkout-compact .supplier-combobox {
  min-width: 0;
}

.order-checkout-compact textarea {
  min-height: 56px;
}

.field.with-inline-action {
  grid-template-columns: 96px minmax(0, 1fr) auto;
}

.supplier-combobox {
  position: relative;
  width: 100%;
}

.supplier-combobox-input {
  width: 100%;
  min-height: 36px;
  padding-right: 32px;
}

.supplier-combobox-input:hover,
.supplier-combobox.is-open .supplier-combobox-input,
.supplier-combobox-input:focus {
  border-color: #93c5fd;
}

.supplier-combobox-arrow {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  user-select: none;
}

.supplier-combobox-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
}

.supplier-combobox-option {
  width: 100%;
  display: block;
  border: 0;
  border-bottom: 1px solid #e5e7eb;
  padding: 9px 12px;
  background: #fff;
  color: #374151;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.supplier-combobox-option:hover,
.supplier-combobox-option.is-active {
  background: #ff5a32;
  color: #fff;
}

.supplier-combobox-option.is-hidden {
  display: none;
}

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

.btn-mini {
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 7px;
  white-space: nowrap;
}

.checkout-summary {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  background: #f9fafb;
}

.checkout-summary strong {
  color: #f05a2a;
  font-size: 22px;
}

.return-money-summary {
  justify-content: flex-end;
}

.return-money-summary div {
  display: grid;
  gap: 2px;
  text-align: right;
}

.return-money-summary div:first-child strong {
  color: var(--muted);
  font-size: 16px;
}

.mixed-payment-dialog {
  max-width: 660px;
}

.mixed-payment-total {
  background: #f8fafc;
  padding: 16px 46px;
  margin-bottom: 16px;
  font-size: 18px;
}

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

.mixed-payment-list label {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

th {
  color: var(--muted);
  font-size: 13px;
  background: #f9fafb;
}

tr:last-child td {
  border-bottom: 0;
}

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

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

.data-row {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(120px, 0.7fr) minmax(140px, 0.8fr) auto;
  gap: 14px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.print-body {
  background: #fff;
}

.print-page {
  width: min(900px, calc(100vw - 32px));
  margin: 24px auto;
  color: #111827;
}

.print-header,
.print-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.print-header h1 {
  margin: 0 0 16px;
  font-size: 28px;
}

.print-meta,
.print-total {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 18px;
}

.print-meta div,
.print-total div,
.print-remark {
  border: 1px solid #d1d5db;
  padding: 10px;
}

.print-meta span,
.print-total span,
.print-remark span {
  display: block;
  color: #6b7280;
  font-size: 12px;
  margin-bottom: 4px;
}

.print-table th,
.print-table td {
  border: 1px solid #d1d5db;
}

.print-total {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.print-remark p {
  margin: 0;
}

.print-footer {
  margin-top: 36px;
}

@media print {
  .no-print {
    display: none !important;
  }

  .print-page {
    width: 100%;
    margin: 0;
  }

  .print-meta,
  .print-total {
    break-inside: avoid;
  }
}

.receivable-row span.muted {
  display: block;
  margin-bottom: 4px;
}

.product-stock-row {
  grid-template-columns: minmax(260px, 1.4fr) minmax(110px, 0.4fr) minmax(110px, 0.4fr) auto;
}

.stock-danger {
  color: #dc2626;
  font-weight: 700;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 13px;
  white-space: nowrap;
}

.pill.warn {
  background: #fffbeb;
  color: var(--warn);
}

.pill.danger {
  background: #fef2f2;
  color: var(--danger);
}

.pill.good {
  background: #f0fdf4;
  color: var(--good);
}

.stock-number {
  font-size: 20px;
  font-weight: 700;
}

.checkline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.checkline input {
  width: auto;
}

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

.inline-input-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.inline-input-action .btn {
  white-space: nowrap;
}

.field {
  display: grid;
  gap: 6px;
}

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

label {
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.product-create-form textarea[name="summary"] {
  min-height: 130px;
}

.product-create-form textarea[name="description"] {
  min-height: 64px;
}

.member-dialog {
  width: min(760px, calc(100vw - 36px));
}

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

.member-form-row {
  display: grid;
  gap: 14px;
}

.member-form-row.two-cols {
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.8fr);
  align-items: start;
}

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

.member-choice-field {
  gap: 8px;
}

.choice-pills ul {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.choice-pills li {
  margin: 0;
}

.choice-pills label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}

.choice-pills input {
  width: auto;
  margin: 0;
  accent-color: var(--brand);
}

.choice-pills.compact label {
  min-width: 86px;
  justify-content: center;
}

.member-table-card {
  overflow-x: auto;
}

.member-table th,
.member-table td {
  white-space: nowrap;
}

.compact-page-title {
  margin-bottom: 14px;
}

.system-table-card {
  overflow-x: auto;
}

.system-table th,
.system-table td {
  white-space: nowrap;
}

.super-search {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
}

.super-search input[type="text"],
.super-search input[name="q"] {
  width: min(520px, 100%);
}

.log-detail {
  margin-top: 6px;
}

.log-detail summary {
  color: #0284c7;
  cursor: pointer;
}

.log-detail pre {
  max-width: 760px;
  max-height: 220px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 10px;
  border-radius: 8px;
  background: #111827;
  color: #f9fafb;
  white-space: pre-wrap;
}

.promotion-admin-thumb {
  width: 220px;
  height: 44px;
  display: block;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.promotion-text-preview {
  width: 21em;
  max-width: 21em;
  min-height: 42px;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding: 6px 10px;
  border-radius: 8px;
  background: #ecfdf5;
  color: #047857;
  font-size: 13px;
  line-height: 1.55;
  white-space: nowrap;
}

.promotion-text-preview span {
  display: block;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}

.promotion-current-image {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
}

.promotion-current-image img {
  width: 100%;
  max-height: 96px;
  display: block;
  object-fit: cover;
}

.system-dialog {
  width: min(640px, calc(100vw - 36px));
}

.system-form {
  display: grid;
  gap: 14px;
}

.system-form-row {
  display: grid;
  gap: 14px;
}

.system-form-row.two-cols {
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.72fr);
  align-items: start;
}

.print-setting-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(360px, 1fr);
  gap: 18px;
  align-items: start;
}

.print-setting-card h2,
.print-preview-card h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

.print-preview-card {
  display: grid;
  gap: 16px;
  justify-items: start;
}

.print-preview-paper {
  width: min(360px, 100%);
  min-height: 210px;
  border: 1px solid #d1d5db;
  background: #fff;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: #374151;
}

.print-preview-paper strong {
  font-size: 20px;
}

.print-preview-paper span {
  color: var(--brand);
  font-weight: 700;
}

.print-preview-paper small {
  color: var(--muted);
}

.account-profile-layout {
  max-width: 680px;
}

.account-profile-card h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

.join-request-card {
  margin-bottom: 16px;
}

.section-heading {
  font-size: 18px;
  margin: 20px 0 12px;
}

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

.line-items {
  display: grid;
  gap: 12px;
}

.line-item {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) minmax(100px, 0.45fr) minmax(110px, 0.45fr) minmax(160px, 0.8fr);
  gap: 12px;
  padding: 12px;
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.form-error {
  color: var(--danger);
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 12px;
}

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

.auth-layout {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #eef2f7;
}

.auth-card {
  width: min(460px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
}

.start-card {
  width: min(520px, 100%);
}

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

.auth-card h1 {
  margin: 0 0 6px;
}

.auth-card p {
  color: var(--muted);
  margin: 0 0 20px;
}

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

.product-main-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #eef2f7;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.placeholder-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  background: #eef2f7;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--muted);
}

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

.info-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

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

.info-row span:first-child {
  color: var(--muted);
}

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

.product-carousel {
  position: relative;
  width: 100%;
}

.carousel-track {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: #eef2f7;
}

.carousel-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #eef2f7;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.carousel-slide.is-active {
  opacity: 1;
  pointer-events: auto;
}

.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  font-size: 26px;
  line-height: 1;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.carousel-arrow-prev {
  left: 12px;
}

.carousel-arrow-next {
  right: 12px;
}

.carousel-counter {
  position: absolute;
  right: 12px;
  bottom: 12px;
  border-radius: 999px;
  padding: 4px 10px;
  background: rgba(15, 23, 42, 0.7);
  color: #fff;
  font-size: 12px;
}

.copy-content {
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
  line-height: 1.7;
  color: #334155;
}

.stock-view-dialog {
  width: min(760px, 100%);
}

.stock-view-body {
  display: grid;
  gap: 22px;
  padding: 28px 32px 20px;
}

.stock-view-gallery {
  display: grid;
  justify-items: center;
  gap: 12px;
}

.stock-view-gallery .product-carousel {
  width: 240px;
}

.stock-view-gallery .carousel-track,
.stock-view-main-image,
.stock-view-gallery .placeholder-image {
  width: 240px;
  aspect-ratio: 1 / 1;
  max-width: 100%;
}

.stock-view-gallery .carousel-slide {
  padding: 12px;
}

.stock-view-name {
  font-size: 18px;
  color: #475569;
}

.stock-view-meta {
  display: grid;
  gap: 0;
}

.stock-view-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px dashed #dbeafe;
}

.stock-view-row span {
  color: #64748b;
}

.stock-view-row strong {
  text-align: right;
  color: #2563eb;
}

.value-link {
  display: inline-block;
  justify-self: end;
  color: #2563eb;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.value-link:hover {
  color: #1d4ed8;
}

.value-link:focus,
.value-link:active {
  outline: none;
}

.stock-view-row:nth-child(n + 3) strong,
.stock-view-row.stock-view-remark strong {
  color: var(--text);
}

.stock-view-remark strong {
  text-align: left;
  line-height: 1.7;
}

.stock-view-actions {
  justify-content: flex-end;
  padding: 0 32px 28px;
}

.stock-sub-dialog {
  width: min(720px, 100%);
}

.stock-movement-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  color: var(--muted);
}

.stock-check-dialog {
  width: min(540px, 100%);
}

.stock-check-body {
  display: grid;
  gap: 18px;
  padding: 28px 32px 26px;
}

.stock-check-preview {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.stock-check-preview img,
.stock-check-thumb {
  width: 140px;
  aspect-ratio: 1 / 1;
  object-fit: contain;
}

.stock-check-field {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  color: #475569;
}

.stock-check-input-row label {
  color: #475569;
}

.stock-check-input-row input {
  border-color: #fb923c;
}

.stock-check-actions {
  justify-content: center;
  padding-top: 4px;
}

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

.meta-pair {
  display: grid;
  gap: 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.meta-pair span,
.meta-block > span {
  color: var(--muted);
  font-size: 13px;
}

.meta-pair strong {
  text-align: left;
  line-height: 1.6;
  color: var(--text);
}

.meta-block {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.meta-content {
  min-height: 72px;
}

.product-copy-bar {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.product-copy-button {
  min-width: 152px;
  min-height: 44px;
  font-weight: 700;
  box-shadow: 0 12px 24px rgba(13, 148, 136, 0.2);
}

.product-share-extra {
  margin-top: 16px;
}

.share-panel {
  display: grid;
  gap: 14px;
}

.share-action-row {
  justify-content: flex-end;
}

.share-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

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

.share-meta {
  display: grid;
  gap: 10px;
}

.share-meta a {
  overflow-wrap: anywhere;
}

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

.share-inline-item {
  display: grid;
  gap: 6px;
}

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

.parameter-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.copy-box {
  white-space: pre-wrap;
  background: #111827;
  color: #f9fafb;
  border-radius: 8px;
  padding: 14px;
  overflow-x: auto;
}

.public-page {
  min-height: 100vh;
  background: #f3f4f6;
}

.public-wrap {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.mobile-bottom-nav {
  display: none;
}

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

  .sidebar {
    display: none;
  }

  .topbar {
    padding: 0 14px;
  }

  .topbar-with-ad {
    height: 60px;
  }

  .topbar-ad {
    min-width: 0;
    display: none;
  }

  .content {
    padding: 16px;
    padding-bottom: 82px;
  }

  .workspace-tabs {
    margin: -16px -16px 16px;
  }

  .workspace-tab {
    min-width: 116px;
    height: 52px;
  }

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

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

  .dashboard-hero,
  .insight-head {
    flex-direction: column;
  }

  .insight-list,
  .pie-layout {
    grid-template-columns: 1fr;
  }

  .css-pie {
    width: 150px;
    margin: 0 auto;
  }

  .warning-row {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .warning-row em {
    grid-column: 2;
  }

  .chart-toggle {
    width: 100%;
    overflow-x: auto;
  }

  .chart-toggle a {
    flex: 1 0 auto;
  }

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

  .line-item {
    grid-template-columns: 1fr;
  }

  .modal-page {
    place-items: start stretch;
    padding: 0;
  }

  .modal-dialog {
    max-height: none;
  }

  .modal-body {
    max-height: none;
  }

  .compact-form .field,
  .field.with-link,
  .compact-form .name-code-row,
  .compact-form .name-code-row .field,
  .compact-form .form-row,
  .compact-form .form-row.two-cols,
  .compact-form .form-row.three-cols,
  .compact-form .form-row .field,
  .compact-form .form-row .field.with-link,
  .compact-form .form-row.three-cols .field {
    grid-template-columns: 1fr;
  }

  .compact-form .form-row .field.with-link .link-button {
    grid-column: auto;
  }

  .compact-form .form-row .field.with-link select,
  .compact-form .form-row .unit-field select {
    width: 100%;
    min-width: 0;
  }

  .compact-form label {
    text-align: left;
  }

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

  .hide-mobile {
    display: none;
  }

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

  .attachment-row,
  .share-row,
  .product-meta-grid {
    grid-template-columns: 1fr;
  }

  .stock-view-row,
  .stock-check-field {
    grid-template-columns: 1fr;
  }

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

  .attachment-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .product-copy-bar {
    justify-content: stretch;
  }

  .product-copy-button {
    width: 100%;
  }

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

  .finance-filter-row,
  .finance-search {
    align-items: stretch;
  }

  .finance-filter-row {
    flex-direction: column;
  }

  .finance-search {
    flex: 1 1 auto;
    width: 100%;
  }

  .finance-search input {
    min-width: 0;
  }

  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: #fff;
    border-top: 1px solid var(--line);
    z-index: 20;
  }

  .mobile-bottom-nav a {
    min-height: 58px;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 12px;
  }
}

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

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

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