:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-muted: #eef3f1;
  --ink: #17211f;
  --muted: #697773;
  --line: #dbe4e1;
  --primary: #1d6b5f;
  --primary-dark: #134d45;
  --accent: #bf6b25;
  --info: #2c5c91;
  --danger: #b63d45;
  --shadow: 0 18px 45px rgba(25, 45, 41, 0.12);
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Segoe UI",
    Arial,
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px 18px;
  background: #18332f;
  color: #f7fbfa;
}

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

.brand-mark {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: #d98d3f;
  border-radius: 8px;
  color: #17211f;
  font-weight: 800;
}

.brand h1,
.brand p,
.topbar h2,
.panel-heading h3,
.eyebrow {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.2;
}

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

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

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: rgba(247, 251, 250, 0.78);
  text-align: left;
}

.nav-item.active {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.nav-item.active-soft {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(247, 251, 250, 0.9);
}

.nav-caret {
  margin-left: auto;
  color: rgba(247, 251, 250, 0.72);
}

.submenu {
  display: grid;
  gap: 5px;
  padding-left: 32px;
}

.submenu-item {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: rgba(247, 251, 250, 0.72);
  text-align: left;
}

.submenu-item:hover,
.submenu-item.active {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.icon {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
}

.sidebar-note {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-note span {
  color: rgba(247, 251, 250, 0.72);
  font-size: 13px;
  line-height: 1.5;
}

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

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

.eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.topbar h2 {
  margin-top: 5px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.14;
}

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

.ghost-button,
.primary-button,
.icon-button,
.segmented button,
.row-actions button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

.ghost-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
}

.ghost-button:hover,
.icon-button:hover,
.row-actions button:hover {
  border-color: #a9b9b5;
  background: #f9fbfa;
}

.ghost-button.danger {
  color: var(--danger);
}

.primary-button {
  width: 100%;
  margin-top: 4px;
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
}

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

.primary-button.inline {
  width: auto;
  min-width: 150px;
  margin-top: 0;
  padding: 0 16px;
}

.inventory-add-variant-button {
  min-width: 92px;
  border-color: #1d6fe8;
  background: #1d6fe8;
  color: #ffffff;
}

.inventory-add-variant-button:hover {
  border-color: #1557ba;
  background: #1557ba;
}

.ghost-button.small,
.primary-button.small {
  width: auto;
  min-width: 58px;
  min-height: 30px;
  margin-top: 0;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 12px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.dashboard-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1.1fr) minmax(260px, 1fr) minmax(260px, 1fr);
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.desktop-card {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 220px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.desktop-card h3 {
  margin: 4px 0 0;
  font-size: 20px;
}

.dashboard-reminders {
  grid-column: 1 / -1;
  min-width: 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.dashboard-reminders h3 { margin: 0 0 14px; font-size: 20px; }
.dashboard-reminders .reminder-list { max-height: 440px; overflow-y: auto; }
.dashboard-reminders .reminder-main { overflow-wrap: anywhere; }
.dashboard-reminders .row-actions { flex-shrink: 0; }
.dashboard-reminders .row-actions button { min-width: 56px; width: auto; white-space: nowrap; }
#reminderPostponeNote { overflow-wrap: anywhere; }
#reminderPostponeDue { width: 100%; min-width: 0; }

.account-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  display: grid;
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 800;
}

.account-profile div:last-child {
  display: grid;
  gap: 5px;
}

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

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

.account-stats span {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
}

.account-stats strong {
  color: var(--ink);
  font-size: 20px;
}

.desktop-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.desktop-list li {
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #30413d;
  line-height: 1.55;
}

.metric-block {
  display: grid;
  gap: 7px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

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

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

.collector-panel,
.analysis-panel,
.reminder-panel,
.inventory-panel,
.form-panel,
.list-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.collector-panel,
.analysis-panel,
.reminder-panel,
.inventory-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  padding: 18px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

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

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

.panel-heading h3 {
  margin-top: 4px;
  font-size: 20px;
}

.icon-button {
  display: grid;
  width: 38px;
  place-items: center;
}

label {
  display: grid;
  gap: 7px;
  color: #30413d;
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--ink);
  outline: none;
}

input,
select {
  padding: 0 11px;
}

textarea {
  resize: vertical;
  padding: 10px 11px;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29, 107, 95, 0.13);
}

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

.list-panel {
  min-width: 0;
  padding: 16px;
}

.toolbar {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.collector-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 12px;
}

.search-box,
.url-box {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.search-box span,
.url-box span {
  display: grid;
  width: 38px;
  place-items: center;
  color: var(--muted);
}

.search-box input,
.url-box input {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.toolbar select {
  width: 150px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef3f1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.loading {
  background: #eaf0fa;
  color: var(--info);
}

.status-pill.success {
  background: #e6f5ec;
  color: #25613c;
}

.status-pill.error {
  background: #fae9ec;
  color: var(--danger);
}

.company-result {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}

.result-main {
  display: grid;
  gap: 6px;
}

.result-main strong {
  font-size: 18px;
}

.result-main span {
  color: #30413d;
  line-height: 1.6;
}

.result-main a {
  color: var(--primary);
  font-size: 13px;
  overflow-wrap: anywhere;
}

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

.result-grid div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.result-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.result-grid p {
  margin: 0;
  color: var(--ink);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.analysis-result {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}

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

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

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

.analytics-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}

.analytics-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.analytics-card strong {
  display: block;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

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

.analytics-three-column {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.analytics-filter-form {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}

.analytics-filter-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

[data-view="product-analysis"] { grid-template-columns: minmax(0,1fr); min-width: 0; }
[data-view="order-analysis"] { grid-template-columns: minmax(0,1fr); min-width: 0; }
[data-view="order-analysis"] .table-scroll { min-width: 0; overflow-x: auto; }
[data-view="order-analysis"] .panel-heading { flex-wrap: wrap; }
[data-view="order-analysis"] .analytics-two-column table { min-width: 0; width: 100%; table-layout: fixed; }
[data-view="order-analysis"] .analytics-two-column td, [data-view="order-analysis"] .analytics-two-column th { overflow-wrap: anywhere; }
#orderAnalyticsCountTrend svg, #orderAnalyticsAmountTrend svg { display: block; width: 100%; height: 250px; }
#orderAnalyticsStatusChart .analytics-chart-track i { background: #3975ab; }
#orderAnalyticsSalespersonChart .analytics-chart-track i { background: #b96728; }
[data-view="product-analysis"] .table-scroll { min-width: 0; overflow-x: auto; }
[data-view="product-analysis"] .panel-heading { flex-wrap: wrap; }
[data-view="customer-analysis"] { grid-template-columns: minmax(0,1fr); min-width: 0; }
[data-view="customer-category-analysis"] { grid-template-columns: minmax(0,1fr); min-width: 0; }
[data-view="customer-category-analysis"] .table-scroll, #customerReportDetail .table-scroll { min-width: 0; overflow-x: auto; }
[data-view="customer-category-analysis"] .panel-heading, #customerReportDetail .panel-heading { flex-wrap: wrap; }
#customerCategoryStatus, #customerCategoryMetrics strong { overflow-wrap: anywhere; }
.customer-category-chart { display: block; width: 200px; max-width: 100%; aspect-ratio: 1; flex: 0 0 200px; }
.customer-category-arc { cursor: pointer; }
.customer-category-arc:hover, .customer-category-arc:focus { filter: brightness(1.15); }
.customer-category-total { font-size: 26px; font-weight: 700; pointer-events: none; }
.customer-category-caption { font-size: 12px; fill: #52665f; pointer-events: none; }
.customer-category-legend { list-style: none; margin: 0; padding: 0; flex: 1 1 260px; min-width: 0; }
.customer-category-legend li { display: grid; grid-template-columns: 10px minmax(30px,1fr) 42px 60px 58px; gap: 6px; align-items: center; padding: 7px 0; font-size: 12px; }
.customer-category-legend i { width: 10px; height: 10px; }
.customer-category-legend strong { text-align: right; }
.customer-category-legend .category-label { cursor: pointer; }
#customerCategoryActivity .analytics-chart-row { grid-template-columns: minmax(60px,1fr) minmax(30px,2fr) 120px; }
[data-view="customer-analysis"] .table-scroll { min-width: 0; overflow-x: auto; }
[data-view="customer-analysis"] .panel-heading { flex-wrap: wrap; }
#customerReportStatus { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.customer-recorder-summary { max-height: 500px; overflow-y: auto; }
[data-view="customer-analysis"] > [hidden] { display: none !important; }
#customerCategoryChart .analytics-chart-track i { background: #3975ab; }
#customerNoTradeChart .analytics-chart-track i { background: #b96728; }
#customerDetailTrend svg { display: block; width: 100%; height: 250px; }
.customer-region-layout { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 20px; min-height: 250px; }
.customer-region-pie { width: 200px; max-width: 100%; aspect-ratio: 1; border-radius: 50%; flex: 0 0 200px; position: relative; }
.customer-region-center { position: absolute; inset: 25%; border-radius: 50%; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.customer-region-center strong { font-size: 24px; }
.customer-region-center span { font-size: 12px; color: var(--muted); }
.customer-region-legend { list-style: none; margin: 0; padding: 0; flex: 1 1 230px; min-width: 0; max-height: 270px; overflow-y: auto; }
.customer-region-legend li { display: grid; grid-template-columns: 10px minmax(0,1fr) 48px 65px; gap: 8px; align-items: center; padding: 7px 0; font-size: 12px; }
.customer-region-legend li span { overflow-wrap: anywhere; }
.customer-region-legend i { width: 10px; height: 10px; }
.customer-region-legend strong { text-align: right; }
#customerReportDetail { width: min(1100px,94vw); max-height: 90vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 20px; }
#customerReportDetail::backdrop { background: #0007; }
#customerDetailSummary { display: grid; grid-template-columns: repeat(auto-fit,minmax(160px,1fr)); gap: 16px; }
#customerDetailSummary div { display: grid; gap: 6px; overflow-wrap: anywhere; }
#customerDetailSummary span { color: var(--muted); font-size: 13px; }
.customer-report-pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; }
#customerReportMetrics strong { overflow-wrap: anywhere; }
.product-analytics-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 18px; }
.product-analytics-filters label { display: grid; gap: 6px; flex: 1 1 150px; min-width: 0; }
.product-analytics-filters input, .product-analytics-filters select { width: 100%; min-width: 0; }
.product-analytics-charts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 24px; margin: 20px 0; }
.product-analytics-charts section { min-width: 0; padding: 12px 0; border-top: 1px solid var(--line); }
.product-analytics-charts h4 { font-size: 15px; margin: 0 0 16px; }
.product-province-section { min-width: 0; margin: 12px 0 24px; border-top: 1px solid var(--line); padding-top: 16px; }
.product-province-section > h4 { margin: 0 0 16px; font-size: 15px; }
.product-province-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,300px),1fr)); gap: 16px; max-height: 620px; overflow-y: auto; padding: 1px; }
.product-province-item { border: 1px solid var(--line); border-radius: 8px; padding: 16px; min-width: 0; }
.product-province-item header { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; justify-content: space-between; }
.product-province-item h5 { font-size: 15px; margin: 0; }
.product-province-item header span { font-size: 12px; color: var(--muted); }
.product-province-item ol { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 16px; }
.product-province-line { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 13px; }
.product-province-line strong { overflow-wrap: anywhere; }
.product-province-name { margin-top: 4px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.product-province-bar { height: 7px; background: #e7efec; margin: 8px 0; }
.product-province-bar i { display: block; height: 100%; background: #397ca6; }
.product-province-amount { text-align: right; font-size: 12px; overflow-wrap: anywhere; }
.product-analytics-charts .analytics-chart-bars { max-height: 320px; overflow-y: auto; }
.product-analytics-charts .analytics-chart-row { grid-template-columns: minmax(60px,1fr) minmax(50px,2fr) 65px; }
.product-analytics-charts .analytics-chart-row span { overflow-wrap: anywhere; }
#productAnalyticsTrend svg { display: block; width: 100%; height: 250px; }
#productAnalyticsSummary { grid-template-columns: repeat(3,minmax(0,1fr)); }
#productAnalyticsColors .analytics-chart-track i { background: #b96728; }
#productAnalyticsSizes .analytics-chart-track i { background: #3975ab; }
.product-analytics-pagination { display: flex; align-items: center; justify-content: end; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
@media(max-width: 760px) { .product-analytics-charts, #productAnalyticsSummary { grid-template-columns: 1fr; } }

.analytics-chart-panel {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}

.analytics-chart-panel h4 {
  margin: 0 0 12px;
  font-size: 15px;
}

.analytics-chart-bars {
  display: grid;
  gap: 10px;
}

.analytics-chart-row {
  display: grid;
  grid-template-columns: minmax(92px, 0.8fr) minmax(120px, 2fr) minmax(86px, 1fr);
  gap: 10px;
  align-items: center;
  font-size: 12px;
}

.analytics-chart-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5efec;
}

.analytics-chart-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.muted-chart .analytics-chart-track i {
  background: #9ca3af;
}

.analytics-pie-list {
  display: grid;
  gap: 8px;
}

.analytics-pie-row {
  display: grid;
  grid-template-columns: minmax(80px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  font-size: 12px;
}

.analytics-pie-row em {
  color: var(--muted);
  font-style: normal;
}

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

.analytics-list div {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

.score-block {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 126px;
  border: 1px solid rgba(29, 107, 95, 0.2);
  border-radius: 8px;
  background: #ffffff;
}

.score-block strong {
  color: var(--primary-dark);
  font-size: 44px;
  line-height: 1;
}

.score-block span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.analysis-summary {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.analysis-summary h4 {
  margin: 0;
  font-size: 18px;
}

.analysis-summary p {
  margin: 0;
  color: #30413d;
  line-height: 1.7;
}

.dimension-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dimension-list span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
}

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

.analysis-columns div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.analysis-columns ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: #30413d;
  line-height: 1.55;
}

.reminder-form {
  display: grid;
  grid-template-columns: minmax(180px, 1.1fr) 190px 130px minmax(220px, 1.4fr) auto;
  gap: 12px;
}

.reminder-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.reminder-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.reminder-metrics span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-size: 13px;
}

.reminder-metrics strong {
  color: var(--ink);
}

.reminder-toolbar select {
  width: 130px;
}

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

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

.reminder-item.overdue {
  border-left-color: var(--danger);
  background: #fffafb;
}

.reminder-item.done {
  border-left-color: #a9b9b5;
  background: #f8faf9;
  opacity: 0.78;
}

.reminder-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.reminder-main strong {
  font-size: 15px;
}

.reminder-main span {
  color: #30413d;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.reminder-main small {
  color: var(--muted);
}

.inventory-filter {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f9f8;
}

.inventory-filter label {
  gap: 6px;
  font-size: 13px;
}

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

.inventory-scan-form {
  grid-template-columns: minmax(140px, 1fr) minmax(180px, 2fr) auto;
  margin-bottom: 12px;
}

.inventory-scan-status {
  grid-column: 1 / -1;
  min-height: 20px;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.scan-draft-summary {
  margin-bottom: 12px;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.warehouse-picking-dialog {
  width: 1050px;
  max-width: calc(100vw - 24px);
  max-height: 90vh;
  padding: 20px;
  border: 1px solid #d5e1dd;
  border-radius: 8px;
}

.warehouse-picking-dialog::backdrop { background: #0005; }
.warehouse-picking-dialog h3 { font-size: 18px; overflow-wrap: anywhere; }
.warehouse-picking-dialog .inventory-table { min-width: 700px; }
.warehouse-picking-dialog input[type="number"] { width: 100px; }
.warehouse-picking-dialog .inventory-actions { justify-content: flex-start; flex-wrap: wrap; margin-top: 16px; }
.shipment-history { margin: 16px 0; font-size: 13px; }
.shipment-history h3 { font-size: 16px; }
.shipment-entry { margin-top: 10px; overflow-wrap: anywhere; }
.shipment-entry ul { margin: 4px 0; padding-left: 20px; }
.inventory-pending-table .action-group { flex-wrap: wrap; }

@media (max-width: 700px) {
  .inventory-scan-form { grid-template-columns: minmax(0, 1fr); }
  .inventory-scan-form .inventory-filter-actions { flex-wrap: wrap; }
  .warehouse-picking-dialog { padding: 12px; }
}

.inventory-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-group button,
.inventory-tabs button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
}

.action-group button:hover,
.inventory-tabs button:hover {
  border-color: #a9b9b5;
  background: #f9fbfa;
}

.inventory-actions select {
  width: 180px;
}

.inventory-table-wrap {
  overflow: auto;
  border: 1px solid #cfd8d5;
  border-radius: 8px;
  background: #ffffff;
}

.inventory-product-list {
  --inventory-product-list-header-height: 39px;
  --inventory-product-list-row-height: 75px;
  max-height: calc(var(--inventory-product-list-header-height) + (var(--inventory-product-list-row-height) * 10));
  overflow-y: auto;
}

.inventory-product-list .inventory-table th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.inventory-inbound-product-list,
.inventory-outbound-product-list {
  max-height: calc(39px + (75px * 5) + 1px);
}

.inventory-inbound-product-list .inventory-table th,
.inventory-outbound-product-list .inventory-table th {
  height: 39px;
  box-sizing: border-box;
}

.inventory-inbound-product-list .inventory-table td,
.inventory-outbound-product-list .inventory-table td {
  height: 75px;
  box-sizing: border-box;
}

.inventory-inbound-product-list .checkbox-cell,
.inventory-outbound-product-list .checkbox-cell {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.inventory-inbound-product-list input[type="checkbox"],
.inventory-outbound-product-list input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  padding: 0;
  margin: 0;
}

.inventory-table {
  width: 100%;
  min-width: 1280px;
  border-collapse: collapse;
}

.inventory-table.inventory-movement-summary {
  min-width: 680px;
  table-layout: fixed;
}

.inventory-movement-summary > thead th:first-child {
  width: 158px;
}

.inventory-movement-summary > thead th:last-child {
  width: 110px;
}

.inventory-movement-summary > tbody > tr[data-movement-id] > td {
  white-space: normal;
  overflow-wrap: anywhere;
}

.inventory-movement-summary > tbody > tr[data-movement-id] button {
  white-space: nowrap;
}

.inventory-table th,
.inventory-table td {
  padding: 8px 9px;
  border-right: 1px solid #d5ddda;
  border-bottom: 1px solid #d5ddda;
  font-size: 13px;
  white-space: nowrap;
}

.inventory-table th {
  background: #f2f4f4;
  color: #17211f;
  font-weight: 800;
}

.inventory-table td {
  color: #30413d;
}

.inventory-table tbody tr {
  transition:
    background 0.16s ease,
    box-shadow 0.16s ease;
}

.inventory-table tbody tr:hover {
  background: #f8fbff;
}

.inventory-table tbody tr.selected-row {
  background: #eaf3ff;
  box-shadow: inset 3px 0 0 #2c5c91;
}

.inventory-table .emphasis,
.stock-zero,
.inventory-note {
  color: #e00000;
}

.stock-low {
  color: #bf6b25;
  font-weight: 800;
}

.stock-ok {
  color: #155b52;
  font-weight: 800;
}

.product-thumb {
  display: block;
  width: 58px;
  height: 58px;
  object-fit: cover;
  border: 1px solid #bfc9c6;
  background: #ffffff;
}

.product-thumb.small {
  width: 42px;
  height: 42px;
}

.inventory-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.inventory-detail {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.inventory-tabs {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: #f6f9f8;
}

.inventory-tabs button {
  border-width: 0 1px 0 0;
  border-radius: 0;
  color: #53615e;
}

.inventory-tabs button.active {
  background: #ffffff;
  color: #0c61c9;
  font-weight: 800;
}

.inventory-table-wrap.compact {
  border: 0;
  border-radius: 0;
}

.inventory-table.detail {
  min-width: 1180px;
}

.order-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.order-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.order-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

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

.order-table th {
  background: #f6f9f8;
  color: #30413d;
  font-size: 12px;
  font-weight: 800;
}

.select-col {
  width: 42px;
  min-width: 42px;
  text-align: center;
}

.select-col input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  vertical-align: middle;
}

.order-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

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

.manual-create-section {
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}

.manual-create-section legend {
  padding: 0 6px;
  color: #17211f;
  font-weight: 800;
}

.exchange-product-filter {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

.exchange-product-filter label {
  gap: 6px;
  font-size: 13px;
}

.exchange-product-filter button {
  min-height: 40px;
  white-space: nowrap;
}

.invoice-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  align-items: start;
  margin: 12px 0;
}

.invoice-preview-card {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.invoice-preview-card img {
  width: 100%;
  max-height: 420px;
  border: 1px solid #d9e2df;
  border-radius: 6px;
  object-fit: contain;
  cursor: zoom-in;
  background: #f3f6f5;
}

.invoice-preview-card figcaption,
.file-card-body {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
}

.invoice-preview-card figcaption strong,
.file-card-body strong {
  color: var(--ink);
  font-size: 13px;
}

.file-card-body {
  min-height: 180px;
  place-content: center;
  border: 1px dashed #b8c9c4;
  border-radius: 6px;
  background: #eef5f3;
  text-align: center;
}

.invoice-zoom-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(10, 20, 18, 0.72);
}

.invoice-zoom-panel {
  display: grid;
  gap: 12px;
  width: min(1180px, 96vw);
  max-height: 92vh;
  padding: 14px;
  border-radius: 8px;
  background: #ffffff;
}

.invoice-zoom-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
}

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

.invoice-zoom-panel img {
  width: 100%;
  max-height: 82vh;
  object-fit: contain;
}

.manual-create-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

.manual-create-grid .wide {
  grid-column: span 4;
}

.manual-create-customer-field {
  position: relative;
}

.manual-create-customer-results {
  display: grid;
  gap: 6px;
  max-height: 168px;
  margin-top: 8px;
  overflow-y: auto;
}

.manual-create-customer-result {
  display: grid;
  gap: 3px;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.manual-create-customer-result:hover {
  border-color: rgba(29, 107, 95, 0.35);
  background: var(--surface-muted);
}

.manual-create-customer-result strong,
.manual-create-customer-result span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manual-create-customer-result span,
.manual-create-empty {
  color: var(--muted);
  font-size: 12px;
}

.manual-create-empty {
  margin: 0;
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.manual-product-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: end;
}
.manual-product-actions { display: flex; justify-content: flex-start; gap: 10px; margin-bottom: 12px; }
.manual-product-filter { grid-template-columns: minmax(200px, 420px) auto auto; justify-content: start; align-items: end; }
.manual-picker-table { min-width: 1100px; }
.manual-product-picker-list { --inventory-product-list-header-height: 56px; }
.manual-picker-table tbody tr { height: 75px; }
@media (max-width: 640px) {
  .manual-product-filter { grid-template-columns: minmax(0, 1fr) auto; }
  .manual-product-filter label { grid-column: 1 / -1; }
}

.manual-product-picker {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

.inventory-variant-picker {
  grid-template-columns: repeat(2, minmax(160px, 1fr)) auto;
  margin-bottom: 12px;
}

.inventory-variant-table {
  min-width: 900px;
}

.inventory-variant-table input {
  min-width: 92px;
}

.inventory-note-grid {
  margin-top: 12px;
}

.after-sales-tabs {
  margin-bottom: 12px;
}

.after-sales-evidence {
  display: flex;
  gap: 6px;
  align-items: center;
}

.manual-create-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding-top: 12px;
  color: #30413d;
}

.manual-create-summary strong {
  color: #e00000;
}

.manual-other-fee {
  display: flex;
  flex-basis: 100%;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #d5e1dd;
  padding-bottom: 12px;
}

.manual-other-fee input {
  width: 160px;
  max-width: 50%;
}

.manual-tax-row {
  display: flex;
  flex-basis: 100%;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #d5e1dd;
  padding-bottom: 12px;
}

.manual-balance-row { display: flex; flex-basis: 100%; flex-wrap: wrap; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid #d5e1dd; }
.manual-balance-row label { display: flex; align-items: center; gap: 8px; }
.manual-balance-row input[type="checkbox"] { width: 18px; height: 18px; flex: 0 0 18px; }
.balance-list { max-height: 440px; overflow: auto; margin: 16px 0; }
.balance-list th { position: sticky; top: 0; background: #f2f6f4; z-index: 1; }
.balance-ledger-dialog { width: 960px; max-width: calc(100vw - 32px); max-height: 85vh; border: 1px solid #d5e1dd; border-radius: 8px; padding: 20px; }
.balance-ledger-dialog::backdrop { background: #0005; }
.balance-adjust-grid { display: grid; grid-template-columns: minmax(180px,2fr) minmax(110px,1fr) minmax(140px,1fr); gap: 12px; }
.balance-adjust-grid label { display: flex; flex-direction: column; gap: 8px; }
.balance-adjust-grid label:last-child { grid-column: 1 / -1; }
#customerBalanceAdjustmentForm fieldset { padding: 14px; border: 1px solid #d5e1dd; border-radius: 6px; }
#customerBalanceAdjustmentForm button[type="submit"] { margin-top: 12px; }
@media (max-width: 760px) { .balance-adjust-grid { grid-template-columns: minmax(0,1fr); } }

.manual-create-submit-row {
  display: flex;
  justify-content: flex-end;
}

.manual-create-submit-row .primary-button {
  min-width: 128px;
}

.manual-create-table {
  min-width: 1120px;
}

.manual-edit-table {
  min-width: 1360px;
}

.manual-edit-input {
  width: 120px;
  min-height: 30px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
}

.manual-edit-input.wide-input {
  width: 180px;
}

.manual-edit-input.number {
  width: 86px;
}

.line-number-input {
  width: 72px;
  min-height: 28px;
}

.segmented {
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.segmented button {
  padding: 0 12px;
  color: var(--muted);
}

.segmented button.active {
  border-color: rgba(29, 107, 95, 0.35);
  background: var(--surface-muted);
  color: var(--primary-dark);
  font-weight: 800;
}

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

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

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

th {
  background: #f6f9f8;
  color: #53615e;
  font-size: 12px;
  font-weight: 800;
}

td {
  font-size: 14px;
}

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

#customerTable tr {
  cursor: pointer;
}

.customer-list-scroll { overflow: auto; }
.customer-list-scroll thead th { position: sticky; top: 0; z-index: 1; }
.invoice-details-text { min-width: 240px; max-width: 420px; white-space: pre-wrap; overflow-wrap: anywhere; }
.payment-account-preview { min-width: 0; overflow-wrap: anywhere; }
.payment-account-preview .shipping-fixed { border: 1px solid var(--line); padding: 12px; font-size: 14px; }
.shipping-payment { white-space: normal; overflow-wrap: anywhere; }
.shipping-payment-private { display: flex; align-items: center; gap: 24px; }
.payment-qr { display: block; width: 180px; height: auto; max-width: 100%; object-fit: contain; }

#customerTable tr:hover td {
  background: #f8fbfa;
}

#manualOrderTable tr[data-order-no] {
  cursor: pointer;
}

#manualOrderTable tr[data-order-no]:hover td {
  background: #f8fbfa;
}

.customer-main {
  display: grid;
  gap: 5px;
}

.customer-main strong {
  font-size: 15px;
}

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

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

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.tag.key {
  background: #fff2df;
  color: #8a4f19;
}

.tag.normal {
  background: #e8f4f2;
  color: #155b52;
}

.tag.prospect {
  background: #eaf0fa;
  color: #244f82;
}

.tag.vendor {
  background: #f0edf7;
  color: #59417e;
}

.tag.active {
  background: #e6f5ec;
  color: #25613c;
}

.tag.follow {
  background: #fff6db;
  color: #7b5a10;
}

.tag.paused {
  background: #fae9ec;
  color: #8a2b36;
}

.actions-col {
  width: 128px;
}

.row-actions button {
  width: 36px;
  min-height: 34px;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 6px;
  margin-top: 12px;
  min-height: 120px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.empty-state strong {
  color: var(--ink);
}

.customer-detail-panel {
  display: grid;
  gap: 10px;
}

.customer-subpage {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.subpage-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.subpage-header h3 {
  margin: 4px 0;
  font-size: 24px;
}

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

.customer-profile-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
}

.customer-profile-grid div {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.customer-profile-grid .wide {
  grid-column: span 2;
}

.customer-profile-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.customer-profile-grid strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.detail-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.detail-toolbar label {
  width: 180px;
}

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

.table-wrap.compact {
  box-shadow: none;
}

.order-detail-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.order-detail-table th,
.order-detail-table td {
  padding: 9px 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  white-space: nowrap;
}

.order-detail-table th {
  background: #f6f9f8;
  color: #30413d;
  font-weight: 800;
}

.order-note-input {
  min-width: 160px;
  min-height: 32px;
}

.hidden {
  display: none !important;
}

.permission-hidden {
  display: none !important;
}

.customer-followups { min-width: 0; margin: 16px 0; padding: 12px 0; border-bottom: 1px solid #d8e2e0; }
.customer-followup-heading { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.customer-followup-heading h4 { margin: 0; font-size: 16px; }
#reminderGeneralTitle { margin: 0; font-size: 16px; }
.customer-followup-heading select { width: 150px; margin-left: auto; }
.customer-followup-list { overflow-y: auto; overscroll-behavior-y: contain; scrollbar-gutter: stable; }
.customer-followup-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 2px; border-bottom: 1px solid #e1e9e7; }
.customer-followup-main { display: grid; gap: 5px; min-width: 0; overflow-wrap: anywhere; }
.customer-followup-main small { color: #526862; }
.customer-followup-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.customer-followup-actions select { width: 112px; }
.customer-followup-message { margin: 6px 0 0; font-size: 13px; }
.customer-followup-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.customer-followup-tag { padding: 3px 6px; border-radius: 4px; font-size: 12px; background: #e1f2ec; color: #195d4a; }
.customer-followup-tag[data-customer-tag="sample_sent"] { background: #e7eef9; color: #305987; }
.customer-followup-tag[data-customer-tag="unconverted"] { background: #f0f1f2; color: #4d555c; }
.customer-followup-tag[data-customer-tag="interested"] { background: #fff0d5; color: #865500; }
.customer-tags-dialog { width: 420px; max-width: calc(100% - 32px); border: 1px solid #d8e2e0; border-radius: 6px; padding: 20px; }
.customer-tags-dialog::backdrop { background: rgb(0 0 0 / 35%); }
.customer-tags-dialog h3 { font-size: 18px; overflow-wrap: anywhere; }
.customer-tags-dialog fieldset { display: flex; flex-wrap: wrap; gap: 16px; padding: 12px 0; border: 0; }
.customer-tags-dialog label { display: flex; align-items: center; gap: 6px; }
.customer-tags-dialog input[type="checkbox"] { width: 18px; height: 18px; margin: 0; }
.customer-tags-dialog .action-group { justify-content: flex-end; }
.customer-followup-history { display: grid; gap: 12px; max-height: 420px; overflow-y: auto; padding-left: 24px; }
.customer-followup-history li { overflow-wrap: anywhere; }
.customer-followup-history span, .customer-followup-history time { display: block; font-size: 13px; margin-top: 4px; }
.customer-followup-form { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.customer-followup-form label { min-width: 0; }
.customer-followup-wide { grid-column: 1 / -1; }
.customer-followup-history p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0; }
.reminder-customer-search { position: relative; min-width: 0; }
.reminder-customer-matches { position: absolute; z-index: 12; top: 100%; left: 0; width: 100%; min-width: 230px; max-width: calc(100vw - 60px); max-height: 260px; overflow-y: auto; background: #fff; border: 1px solid #b9cfca; border-radius: 4px; box-shadow: 0 5px 16px #0002; }
.reminder-customer-matches button { display: block; width: 100%; padding: 10px; border: 0; border-bottom: 1px solid #e1e9e7; border-radius: 0; text-align: left; background: #fff; color: #153f37; white-space: normal; overflow-wrap: anywhere; }
.reminder-customer-matches button:hover, .reminder-customer-matches button:focus { background: #edf5f3; }
.reminder-customer-matches p { padding: 10px; margin: 0; }
@media (max-width: 640px) {
  .customer-followup-form { grid-template-columns: minmax(0,1fr); }
  .customer-followup-item { align-items: stretch; flex-direction: column; gap: 8px; }
  .customer-followup-heading select { margin-left: 0; }
  .customer-followup-actions { flex-wrap: wrap; }
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #edf2f0;
}

.auth-dialog {
  width: min(440px, 100%);
  padding: 32px;
  border: 1px solid #cfdbd7;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(17, 54, 49, 0.16);
}

.auth-dialog h1 {
  margin: 10px 0 8px;
  font-size: 26px;
}

.auth-description {
  margin: 0 0 22px;
  color: #60716d;
}

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

.auth-form label,
.employee-form-grid label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.auth-form input,
.employee-form-grid input,
.employee-form-grid select,
.permission-module select {
  width: 100%;
  min-height: 40px;
  border: 1px solid #ced9d5;
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: #142a26;
}

.auth-form .auth-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  font-weight: 500;
  cursor: pointer;
}

.auth-form .auth-remember input {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  accent-color: #176f63;
}

.auth-message {
  min-height: 20px;
  margin: 0;
  color: #176f63;
}

.auth-message.error {
  color: #b42318;
}

.password-overlay {
  background: rgba(19, 45, 40, 0.48);
}

.password-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.password-dialog-actions .primary-button {
  min-width: 112px;
}

.current-employee {
  color: #49615b;
  font-size: 13px;
}

.employee-management {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid #d6e0dd;
  border-radius: 8px;
  background: #fff;
}

.employee-heading-actions,
.employee-editor-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.employee-layout {
  display: grid;
  grid-template-columns: minmax(420px, 0.9fr) minmax(520px, 1.1fr);
  gap: 16px;
  align-items: start;
}

.employee-list-panel,
.employee-editor,
.permission-audit-panel {
  min-width: 0;
  border-top: 1px solid #d6e0dd;
  padding-top: 14px;
}

.employee-list-panel tbody tr {
  cursor: pointer;
}

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

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

.employee-active-field {
  display: flex !important;
  align-items: center;
  align-self: end;
  min-height: 40px;
}

.employee-active-field input {
  width: 18px;
  min-height: 18px;
}

.permission-tree {
  display: grid;
  gap: 12px;
  max-height: 520px;
  overflow: auto;
  border-top: 1px solid #d6e0dd;
  border-bottom: 1px solid #d6e0dd;
  padding: 12px 0;
}

.permission-module {
  display: grid;
  gap: 8px;
}

.permission-module-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  background: #f1f5f3;
}

.permission-module-heading select {
  width: 160px;
  min-height: 34px;
}

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

.permission-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #dce5e2;
  border-radius: 6px;
}

.permission-item span,
.permission-item small {
  display: block;
  min-width: 0;
}

.permission-item small {
  margin-top: 3px;
  overflow-wrap: anywhere;
  color: #6d7e79;
  font-weight: 400;
}

.audit-list {
  display: grid;
  gap: 6px;
}

.audit-item {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) 180px;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #e4ebe9;
}

.audit-item time {
  color: #657670;
  text-align: right;
}

@media (max-width: 1180px) {
  .employee-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .employee-form-grid,
  .permission-items {
    grid-template-columns: 1fr;
  }

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

  .audit-item time {
    text-align: left;
  }
}

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

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

  .sidebar {
    position: static;
    gap: 16px;
    padding: 16px;
  }

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

  .sidebar-note {
    display: none;
  }

  .workspace {
    padding: 18px;
  }

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

  .collector-form {
    display: flex;
    align-items: stretch;
    flex-direction: column;
  }

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

  .reminder-toolbar,
  .reminder-item {
    align-items: stretch;
    flex-direction: column;
  }

  .reminder-toolbar select {
    width: 100%;
  }

  .inventory-filter {
    grid-template-columns: 1fr;
  }

  .inventory-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .inventory-actions select,
  .inventory-filter-actions button {
    width: 100%;
  }

  .order-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .manual-create-grid,
  .exchange-product-filter,
  .manual-product-row {
    grid-template-columns: 1fr;
  }

  .manual-create-grid .wide {
    grid-column: auto;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions button,
  .toolbar select,
  .primary-button.inline {
    flex: 1;
    width: 100%;
  }

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

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

  .analytics-grid,
  .analytics-grid.compact,
  .analytics-two-column,
  .analytics-three-column,
  .analytics-chart-grid,
  .analytics-filter-form {
    grid-template-columns: 1fr;
  }

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

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

  .detail-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .subpage-header {
    align-items: stretch;
    flex-direction: column;
  }

  .customer-profile-grid {
    grid-template-columns: 1fr;
  }

  .customer-profile-grid .wide {
    grid-column: auto;
  }

  .detail-toolbar label {
    width: 100%;
  }

  .analysis-result,
  .analysis-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .workspace {
    padding: 14px;
  }

  .nav-list,
  .metrics,
  .two-column {
    grid-template-columns: 1fr;
  }

  .brand h1 {
    font-size: 16px;
  }

  .topbar h2 {
    font-size: 25px;
  }

  .collector-panel,
  .analysis-panel,
  .reminder-panel,
  .inventory-panel,
  .form-panel,
  .list-panel {
    padding: 14px;
  }
}
/* Central dashboard content editor. */
.dashboard-content-dialog { width: min(640px, calc(100% - 32px)); max-height: calc(100vh - 40px); overflow: auto; border: 1px solid #d5e1df; border-radius: 8px; padding: 24px; color: #102c29; }
.dashboard-content-dialog::backdrop { background: rgb(0 0 0 / 35%); }
#editNavigationBtn { margin-top: 12px; width: 100%; }
#navigationOrderDialog { color: #102c29; }
#navigationOrderGroup { width: 100%; margin-top: 6px; }
#navigationOrderList { max-height: 420px; overflow-y: auto; }
.navigation-order-row { display: grid; grid-template-columns: minmax(0, 1fr) 36px 36px; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid #d5e1df; }
.navigation-order-row span { overflow-wrap: anywhere; }
.navigation-order-row button { width: 36px; height: 36px; padding: 0; color: #102c29; background: #fff; border: 1px solid #b8ccca; border-radius: 4px; }
.navigation-order-row button:disabled { opacity: .4; cursor: default; }
.navigation-order-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.navigation-order-actions .primary-button { width: auto; margin-top: 0; }
.exchange-pricing-summary { margin-top: 12px; line-height: 1.8; overflow-wrap: anywhere; }
[data-after-sales-exchange-price][readonly] { background: #f0f4f3; color: #536965; }
#afterSalesCreateExchangeItemsTable .manual-grid-price { width: 88px; }
.dashboard-content-dialog form { display: grid; gap: 12px; }
.dashboard-content-dialog textarea { width: 100%; box-sizing: border-box; resize: vertical; }
.dashboard-content-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dashboard-content-actions button { flex: 0 0 auto; width: auto; min-width: 72px; white-space: nowrap; }
.desktop-list li { white-space: pre-wrap; overflow-wrap: anywhere; }
#inventoryMovementForm .inventory-filter-actions { grid-column: 1 / -1; }
.after-sales-order-choice-list { max-height: 326px; overflow: auto; }
.after-sales-order-choice-table { min-width: 900px; }
.after-sales-order-choice-table thead th { position: sticky; top: 0; z-index: 1; height: 46px; box-sizing: border-box; }
.after-sales-order-choice-table tbody tr { height: 56px; }
.after-sales-order-choice-table td { height: 56px; padding: 8px 12px; vertical-align: middle; }
.after-sales-order-choice-table tr[aria-selected="true"] td { background: #edf6f3; }
.after-sales-order-choice-table input[type="radio"] { width: 18px; height: 18px; min-height: 18px; padding: 0; margin: 0; }
.customer-import-columns { width: 100%; min-width: 0; table-layout: fixed; }
#customerImportForm { min-width: 0; grid-template-columns: minmax(0, 1fr); }
#customerImportMessage { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 220px; overflow: auto; }
#customerImportFile { width: 100%; min-width: 0; box-sizing: border-box; }

/* Printable order snapshot, independent of the operational tables. */
[data-view="manual-order-detail"] .panel-heading,
[data-view="after-sales-detail"] .panel-heading { flex-wrap: wrap; }
[data-view="manual-order-detail"] .panel-heading > div:first-child,
[data-view="after-sales-detail"] .panel-heading > div:first-child { min-width: 0; flex: 1 1 340px; overflow-wrap: anywhere; }
[data-view="manual-order-detail"] .toolbar-actions,
[data-view="after-sales-detail"] .toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; max-width: 100%; }
[data-view="manual-order-detail"] .toolbar-actions button,
[data-view="after-sales-detail"] .toolbar-actions button { white-space: nowrap; flex: 0 0 auto; }
#returnNoteSelect { min-width: 0; width: 380px; max-width: 100%; }
.shipping-view { min-width: 0; }
.shipping-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.shipping-toolbar h3 { margin-right: auto; }
.shipping-paper-scroll { overflow-x: auto; max-width: 100%; }
.shipping-sheet { width: 1100px; background: #fff; padding: 24px 20px; color: #000; font: 17px/1.5 "SimSun", "Songti SC", serif; margin: 0 auto 20px; box-sizing: border-box; }
.shipping-title { display: flex; justify-content: center; align-items: center; gap: 20px; margin: 0 0 10px; }
.shipping-title h2 { font: 34px/1.4 "SimSun", serif; margin: 0; color: #000; }
.shipping-logo-frame { width: 80px; height: 68px; overflow: hidden; position: relative; flex: 0 0 80px; }
.shipping-logo { width: 80px; height: 100px; object-fit: contain; position: absolute; top: -18px; left: 0; }
.shipping-meta { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr) minmax(0, .9fr); gap: 6px 18px; margin: 8px 8px 10px; }
.shipping-meta > div { overflow-wrap: anywhere; }
.shipping-order-number { font-size: 13px; align-self: end; text-align: right; }
.shipping-table { width: 100%; min-width: 0; table-layout: fixed; border-collapse: collapse; font-size: 15px; }
.shipping-table th, .shipping-table td { border: 1px solid #000; text-align: center; vertical-align: middle; padding: 5px 3px; color: #000; background: #fff; white-space: normal; overflow-wrap: anywhere; }
.shipping-table th { font-size: 17px; font-weight: 400; }
.shipping-style-col { width: 13%; }
.shipping-color-col { width: 7%; }
.shipping-size-col { width: 2.8%; }
.shipping-remark-col { width: 10%; }
.shipping-line-remark { text-align: left; white-space: pre-wrap; font-size: 11px; }
.shipping-table td.shipping-line-remark { font-size: 10px; line-height: 1.1; }
.shipping-table .shipping-product { text-align: left; font-size: 13px; }
.shipping-table .shipping-note { text-align: left; white-space: pre-wrap; }
.shipping-table tbody tr:last-child td { border-bottom: 1px solid #000; }
.shipping-fixed { border: 1px solid #000; border-top: 0; padding: 3px 5px; }
.shipping-bank-row { display: flex; justify-content: space-between; gap: 10px; }
.shipping-terms { font-size: 16px; }
.shipping-footer { display: grid; grid-template-columns: 1fr 1fr 1.5fr; gap: 8px 20px; padding: 5px 6px; }
.shipping-footer span:nth-child(3n) { text-align: right; }
.shipping-order-status { text-align: right; font-size: 13px; margin-top: 4px; }
@media print {
  @page { size: A4 landscape; margin: 8mm; }
  html, body { min-width: 0 !important; background: #fff !important; }
  body:has(.shipping-view:not(.hidden)) .sidebar,
  body:has(.shipping-view:not(.hidden)) .workspace > :not(.shipping-view:not(.hidden)),
  body:has(.shipping-view:not(.hidden)) > :not(.app-shell),
  body:has(.shipping-view:not(.hidden)) .shipping-toolbar,
  body:has(.shipping-view:not(.hidden)) .central-sync-notice { display: none !important; }
  body:has(.shipping-view:not(.hidden)) .app-shell { display: block; }
  body:has(.shipping-view:not(.hidden)) main { margin: 0; padding: 0; width: 100%; }
  .shipping-paper-scroll { overflow: visible; }
  .shipping-sheet { width: 100%; margin: 0; padding: 0; break-after: page; font-size: 14px; }
  .shipping-sheet:last-child { break-after: auto; }
  .shipping-title h2 { font-size: 28px; }
  .shipping-long-remark .shipping-logo-frame { height: 60px; }
  .shipping-long-remark .shipping-logo { height: 60px; width: 48px; }
  .shipping-long-remark .shipping-title { min-height: 60px; margin-bottom: 4px; }
  .shipping-long-remark .shipping-meta { gap: 4px 12px; margin-bottom: 6px; }
  .shipping-long-remark .shipping-payment { font-size: 12px; line-height: 1.15; }
  .shipping-long-remark .shipping-footer { font-size: 12px; gap: 4px 12px; }
  .shipping-table { font-size: 12px; }
  .shipping-table td { font-size: 12px; line-height: 1.35; }
  .shipping-table th { font-size: 14px; }
  .shipping-table .shipping-product { font-size: 11px; }
  .shipping-terms { font-size: 13px; }
  .shipping-sheet tr, .shipping-fixed, .shipping-footer { break-inside: avoid; }
}
.product-image-empty {
  display: inline-flex;
  width: 58px;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  color: #667977;
  font-size: 12px;
}
.manual-product-actions { align-items: flex-end; flex-wrap: wrap; }
.manual-style-search { display: grid; gap: 6px; width: 240px; max-width: 100%; font-size: 13px; }
.manual-style-search input { width: 100%; }
table.manual-size-grid { width: 100%; min-width: 1412px; table-layout: fixed; }
.manual-size-grid th, .manual-size-grid td { text-align: center; vertical-align: middle; padding: 6px 4px; overflow-wrap: anywhere; }
.manual-size-grid tbody td:first-child, .manual-size-grid thead tr:first-child th:first-child { position: sticky; left: 0; z-index: 1; background: #fff; }
.manual-size-grid tbody td:nth-child(2), .manual-size-grid thead tr:first-child th:nth-child(2) { position: sticky; left: 54px; z-index: 1; background: #fff; box-shadow: 1px 0 #d8e1e0; }
.manual-size-grid thead tr:first-child th:first-child, .manual-size-grid thead tr:first-child th:nth-child(2) { background: #f0f4f3; z-index: 2; }
.manual-size-grid .product-image-empty { width: 46px; }
.manual-size-grid img.product-thumb { width: 42px; height: 42px; }
.manual-size-grid input.manual-grid-quantity { width: 100%; min-width: 0; height: 32px; min-height: 32px; padding: 3px; text-align: center; border-radius: 3px; appearance: textfield; }
.manual-size-grid input.manual-grid-quantity::-webkit-inner-spin-button { appearance: none; }
.manual-size-grid input.manual-grid-quantity:disabled { background: #edf1f1; border-color: transparent; }
.manual-size-grid input.manual-grid-price { width: 100%; min-width: 0; min-height: 32px; padding: 3px; text-align: right; border-radius: 3px; }
.customer-transfer-history { max-height: 220px; overflow: auto; }
.customer-transfer-history table { min-width: 560px; }
.list-panel .actions-col { min-width: 148px; width: 148px; }
.row-actions button[data-action="transfer"] { min-width: 52px; white-space: nowrap; padding: 4px 8px; }
#inventoryPendingForm {
  grid-template-columns: minmax(180px, 420px) auto;
  justify-content: start;
}

#inventoryPendingForm .inventory-filter-actions button {
  width: auto;
  min-width: 76px;
  white-space: nowrap;
}

#inventoryPendingForm .inventory-filter-actions { flex-wrap: wrap; }
#inventoryPendingForm #inventoryPendingBatchShipBtn { min-width: 144px; }

.inventory-pending-table {
  min-width: 960px;
}

.inventory-pending-table > tbody > tr > td {
  vertical-align: top;
}

.inventory-pending-table details {
  min-width: 220px;
  max-width: 640px;
}

.inventory-pending-table summary {
  cursor: pointer;
  padding: 6px 0;
}

.inventory-pending-lines {
  overflow: auto;
  max-height: 420px;
  margin-top: 8px;
}

.inventory-pending-lines table {
  min-width: 720px;
}

.inventory-pending-shortage {
  color: #b42318;
  font-weight: 700;
}

.inventory-pending-pagination {
  flex-wrap: wrap;
  gap: 12px;
}

.submenu-item:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

#inventoryTable tr[data-product-key] { cursor: pointer; }
#inventoryTable tr[data-product-key]:focus-visible { outline: 2px solid #1d6f62; outline-offset: -2px; }
.product-detail-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; border: 0; padding: 0; margin: 16px 0; min-width: 0; }
.product-detail-fields label { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.product-detail-fields input, .product-detail-fields textarea { width: 100%; min-width: 0; box-sizing: border-box; }
.product-detail-fields input[readonly], .product-detail-fields:disabled input, .product-detail-fields:disabled textarea { background: #f2f5f4; color: #455b55; }
.product-detail-wide { grid-column: 1 / -1; }
.product-detail-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.product-detail-actions button { white-space: normal; min-height: 40px; }
#productDetailStatus { min-height: 24px; overflow-wrap: anywhere; }
#productDetailStatus.error { color: #b42318; }
#productDetailStatus.success { color: #1d6f62; }
#productDetailImagePreview { min-height: 80px; display: flex; align-items: center; }
#productDetailImagePreview .product-thumb { width: 100px; height: 100px; object-fit: contain; }
#productDetailClearImageBtn { align-self: flex-start; }
@media (max-width: 720px) {
  .product-detail-fields { grid-template-columns: minmax(0, 1fr); }
  [data-view="inventory-product-detail"] .panel-heading { flex-wrap: wrap; gap: 12px; }
  .product-detail-actions { justify-content: flex-start; }
}

@media (max-width: 720px) {
  #inventoryPendingForm {
    grid-template-columns: minmax(0, 1fr);
  }

  #inventoryPendingForm .inventory-filter-actions button {
    flex: 1;
  }
}
/* Manual platform SKU matching uses the existing inventory workspace. */
.matching-toolbar { display:flex; flex-wrap:wrap; align-items:end; gap:12px; margin:18px 0; }
[data-view="inventory-product-matches"] button { min-height:38px; padding:0 14px; border:1px solid var(--line); border-radius:8px; background:var(--surface); color:var(--ink); }
[data-view="inventory-product-matches"] button:hover { border-color:#a9b9b5; background:#f9fbfa; }
[data-view="inventory-product-matches"] button.primary { border-color:var(--primary); background:var(--primary); color:#fff; font-weight:700; }
[data-view="inventory-product-matches"] button.primary:hover { background:var(--primary-dark); }
[data-view="inventory-product-matches"] .section-heading { display:flex; justify-content:space-between; align-items:center; gap:12px; }
[data-view="inventory-product-matches"] .section-heading h2 { margin:0; font-size:22px; }
[data-view="inventory-product-matches"] .status-badge { padding:6px 10px; background:#eef3f1; border:1px solid var(--line); border-radius:6px; white-space:nowrap; font-size:13px; }
.matching-targets input[type="radio"] { width:18px; height:18px; min-height:18px; padding:0; margin:0; }
.matching-toolbar label { display:grid; gap:6px; flex:1 1 170px; min-width:0; }
.matching-toolbar input, .matching-toolbar select, .matching-fields input, .matching-fields select, .matching-dialog label>input { width:100%; min-width:0; box-sizing:border-box; }
.matching-table { width:100%; min-width:880px; }
.matching-table td { white-space:pre-line; overflow-wrap:anywhere; vertical-align:top; }
.matching-pagination { display:flex; align-items:center; justify-content:flex-end; gap:12px; margin-top:14px; }
.matching-pagination>span:first-child { margin-right:auto; }
.matching-dialog { border:1px solid #cbd9d5; border-radius:8px; padding:22px; width:580px; max-width:calc(100vw - 32px); max-height:calc(100dvh - 32px); box-sizing:border-box; overflow:auto; }
.matching-dialog-wide { width:920px; }
.matching-dialog::backdrop { background:rgb(0 0 0 / 35%); }
.matching-dialog h3 { margin:0 0 16px; font-size:20px; }
.matching-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.matching-fields label, .matching-dialog form>label { display:grid; gap:6px; }
.matching-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:10px; margin:16px 0; }
.matching-target-search { display:flex; gap:10px; }
.matching-target-search input { flex:1; min-width:0; }
.matching-targets { max-height:300px; overflow:auto; }
.matching-targets table { min-width:560px; width:100%; }
.matching-targets td { white-space:pre-line; overflow-wrap:anywhere; }
.matching-message { color:#a83232; min-height:22px; }
#matchingExternalSummary, #matchingSelected, #matchingHistory { overflow-wrap:anywhere; }
#matchingHistory { font-size:13px; padding-left:22px; }
#matchingHistory li { margin-bottom:10px; }
@media (max-width:600px) { .matching-fields { grid-template-columns:minmax(0,1fr); } .matching-dialog { padding:16px; } .matching-toolbar button { flex:1 1 120px; } }
/* External orders remain separate from manual review and stock actions. */
.doudian-source-tools {display:flex;flex-wrap:wrap;align-items:end;gap:10px;margin:12px 0;}
.doudian-source-tools label {display:grid;gap:5px;max-width:100%;}
.doudian-source-tools input {min-width:0;max-width:100%;}
.woda-review-note {overflow-wrap:anywhere;}
.woda-logistics-filters {display:grid;grid-template-columns:minmax(180px,2fr) minmax(160px,1fr) auto auto;align-items:end;gap:10px;margin:16px 0;}
.woda-logistics-filters label {display:grid;gap:6px;min-width:0;}
.woda-logistics-filters input,.woda-logistics-filters select {width:100%;min-width:0;box-sizing:border-box;}
.woda-logistics-filters button {min-height:40px;}
.woda-logistics-order {padding:16px 0;border-top:1px solid #cddbd9;overflow-wrap:anywhere;}
.woda-logistics-order h4 {margin:0 0 8px;font-size:16px;}
.woda-logistics-order small {display:block;color:#647773;}
.woda-logistics-table table {min-width:560px;table-layout:fixed;width:100%;}
.woda-logistics-table td {white-space:normal;overflow-wrap:anywhere;}
@media(max-width:600px){.woda-logistics-filters {grid-template-columns:minmax(0,1fr) minmax(0,1fr);}.woda-logistics-filters label {grid-column:1 / -1;}}
.doudian-orders-band {min-width:0;width:100%;max-width:100%;margin-top:20px;padding-top:16px;border-top:1px solid #cddbd9;}
.doudian-orders-band .table-wrap {width:100%;max-width:100%;min-width:0;overflow-x:auto;}
[data-view="order-management"],[data-view="history-orders"] {grid-template-columns:minmax(0,1fr);}
.doudian-orders-band td {white-space:pre-line;min-width:100px;}
.doudian-dialog {width:min(1100px,calc(100vw - 24px));max-height:90vh;overflow:auto;box-sizing:border-box;}
.doudian-dialog .table-wrap {max-width:100%;overflow:auto;}
.doudian-preview-row {padding:12px 0;border-top:1px solid #cddbd9;}
.doudian-preview-row small {display:block;overflow-wrap:anywhere;margin:8px 0;}
#doudianCommitSummary {overflow-wrap:anywhere;}
.doudian-orders-band[hidden],.doudian-source-tools button[hidden] {display:none !important;}
[data-view="order-management"] > .order-toolbar[hidden],
[data-view="order-management"] > .table-wrap[hidden],
[data-view="history-orders"] > .order-toolbar[hidden],
[data-view="history-orders"] > .table-wrap[hidden] {display:none !important;}
@media(max-width:600px){.doudian-source-tools {align-items:stretch;}.doudian-source-tools input {width:100%;}.doudian-dialog {padding:14px;}.doudian-source-tools button {min-height:40px;}}

#mediaLibrary {min-width:0;letter-spacing:0;display:block;}
#mediaLibrary [hidden] {display:none!important;}
.media-heading {display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;margin-bottom:16px;}
.media-heading h2 {font-size:24px;margin:0;}
.media-capacity {display:grid;gap:6px;font-size:13px;color:#526965;min-width:190px;}
.media-capacity progress {height:7px;width:100%;accent-color:#256e60;}
#mediaStatus {font-size:14px;color:#526965;min-height:24px;margin-bottom:8px;overflow-wrap:anywhere;}
.media-toolbar {display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:20px;}
.media-toolbar input {flex:1 1 240px;min-width:0;width:auto;}
.media-toolbar select {flex:0 0 145px;width:145px;}
.media-toolbar input,.media-toolbar select {height:42px;border:1px solid #ccd9d5;border-radius:6px;padding:8px 12px;background:white;}
.media-toolbar button {height:42px;white-space:nowrap;width:auto;margin-top:0;}
.media-types {display:flex;gap:0;border-bottom:1px solid #ccd9d5;margin:12px 0 16px;}
.inventory-pending-table input[type="checkbox"] {width:18px;height:18px;margin:0;cursor:pointer;accent-color:#256e60;}
.inventory-pending-table th:first-child,.inventory-pending-table td:first-child {width:42px;min-width:42px;text-align:center;}
.media-types button {width:auto;min-width:72px;height:40px;margin:0;border:0;border-bottom:2px solid transparent;border-radius:0;background:transparent;color:#435a56;padding:8px 16px;font-size:14px;}
.media-types button[aria-selected="true"] {border-bottom-color:#256e60;color:#185e50;background:#eef6f2;}
.media-upload-dialog {width:560px;}
.media-detail-image {display:block;width:100%;height:340px;object-fit:contain;background:#f2f5f4;}
#mediaUploadStatus {grid-column:1/-1;margin:0;color:#a22c2c;overflow-wrap:anywhere;}
.media-items {display:grid;grid-template-columns:repeat(auto-fill,minmax(min(240px,100%),1fr));gap:16px;}
.media-item {border:1px solid #d7dfdd;border-radius:6px;overflow:hidden;min-width:0;background:#fff;}
.media-preview {display:flex;align-items:center;justify-content:center;width:100%;aspect-ratio:16/9;border:0;border-bottom:1px solid #d7dfdd;border-radius:0;background:#edf2f0;color:#5c756d;padding:0;cursor:pointer;overflow:hidden;font-size:38px;}
.media-preview img {width:100%;height:100%;object-fit:contain;}
.media-item-info {padding:14px;min-width:0;}
.media-item h3 {font-size:15px;line-height:1.5;margin:8px 0;overflow-wrap:anywhere;}
.media-item p {font-size:13px;margin:8px 0;overflow-wrap:anywhere;}
.media-item small {font-size:12px;color:#667772;display:block;}
.media-stage {font-size:12px;background:#e7f3ee;color:#25664d;padding:3px 6px;border-radius:3px;}
.media-tags {min-height:19px;color:#667772;}
.media-actions {display:flex;gap:8px;flex-wrap:wrap;margin-top:12px;}
.media-actions button {font-size:13px;min-height:32px;padding:5px 10px;}
.media-pagination {display:flex;gap:12px;align-items:center;justify-content:flex-end;margin-top:20px;font-size:13px;}
.media-pagination button {width:36px;height:36px;padding:0;}
.media-empty {grid-column:1/-1;padding:60px 16px;text-align:center;color:#6b7c75;}
.media-uploads {border-top:1px solid #d6dfdb;margin-top:24px;padding-top:16px;}
.media-uploads h3 {font-size:16px;}
.media-upload-row {display:grid;grid-template-columns:minmax(0,1fr) minmax(120px,200px) auto;gap:16px;padding:12px 0;border-bottom:1px solid #e5eae7;align-items:center;}
.media-upload-row strong {display:block;font-size:13px;overflow-wrap:anywhere;}
.media-upload-row small {display:block;font-size:12px;color:#687d73;margin-top:4px;overflow-wrap:anywhere;}
.media-upload-row progress {width:100%;accent-color:#256e60;}
.media-upload-row .media-actions {margin:0;}
.media-dialog {width:800px;max-width:calc(100vw - 24px);max-height:90vh;box-sizing:border-box;overflow:auto;border:1px solid #c7d6cd;border-radius:6px;padding:20px;}
.media-dialog::backdrop {background:#14291d80;}
.media-dialog .media-heading h3 {font-size:18px;overflow-wrap:anywhere;max-width:calc(100% - 50px);}
.media-dialog video {width:100%;max-height:340px;aspect-ratio:16/9;background:#101b16;object-fit:contain;}
.media-edit-form {display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:20px;}
.media-edit-form label {display:grid;gap:6px;font-size:13px;min-width:0;}
.media-edit-form input,.media-edit-form select,.media-edit-form textarea {width:100%;box-sizing:border-box;border:1px solid #c7d5ce;border-radius:4px;padding:8px;font:inherit;}
.media-edit-form .media-actions {grid-column:1/-1;}
@media(max-width:600px){.media-capacity {width:100%;}.media-toolbar input {flex-basis:100%;}.media-items {grid-template-columns:1fr;}.media-upload-row {grid-template-columns:1fr;gap:8px;}.media-edit-form {grid-template-columns:1fr;}.media-dialog {padding:12px;}.media-pagination {flex-wrap:wrap;}}
/* Batch costs use unframed sections and contained table scrolling. */
.operating-section { min-width: 0; padding: 12px 0 24px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.operating-section[hidden], .operating-section [hidden], .operating-dialog [hidden] { display: none !important; }
.operating-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.operating-toolbar label { display: grid; gap: 6px; min-width: 0; }
.operating-toolbar input, .operating-toolbar select { width: 170px; max-width: 100%; box-sizing: border-box; }
.operating-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 16px; margin: 20px 0; }
.operating-summary dt { color: var(--muted); font-size: 13px; }
.operating-summary dd { margin: 6px 0 0; font-size: 18px; overflow-wrap: anywhere; }
#operatingRows table { min-width: 920px; table-layout: fixed; }
#operatingRows th:nth-child(1), #operatingRows td:nth-child(1) { width: 124px; white-space: nowrap; overflow-wrap: normal; }
#operatingRows th:nth-child(2), #operatingRows td:nth-child(2) { width: 110px; }
#operatingRows th:nth-child(3), #operatingRows td:nth-child(3) { width: 160px; white-space: nowrap; overflow-wrap: normal; font-variant-numeric: tabular-nums; }
#operatingRows th:nth-child(6), #operatingRows td:nth-child(6) { width: 144px; }
#operatingRows td:nth-child(4), #operatingRows td:nth-child(5) { white-space: normal; overflow-wrap: anywhere; }
.operating-dialog { box-sizing: border-box; }
.operating-dialog fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 14px; }
.operating-dialog li { overflow-wrap: anywhere; margin-bottom: 12px; }
@media (max-width: 600px) {
  .operating-toolbar label { flex: 1 1 120px; }
  .operating-toolbar input, .operating-toolbar select { width: 100%; }
  .operating-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
#profitAnalysis { min-width: 0; padding: 20px; background: #fff; }
#profitAnalysis h2 { font-size: 22px; margin: 0 0 20px; }
#profitAnalysis h3 { font-size: 17px; }
.profit-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 16px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.profit-summary dt { font-size: 13px; color: var(--muted); }
.profit-summary dd { margin: 6px 0 0; font-size: 20px; overflow-wrap: anywhere; }
#profitConfirmCheck { width: auto; justify-self: start; }
#profitLinkConfirm { width: auto; justify-self: start; }
#profitLinkDialog { width: 720px; }
#profitLinkDialog h3 { font-size: 16px; margin: 12px 0 0; }
#profitSearchForm { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)) auto auto; align-items: end; }
#profitSearchForm label { display: grid; gap: 6px; min-width: 0; }
#profitSearchForm input, #profitSearchForm select { width: 100%; min-width: 0; }
.cost-dialog [hidden] { display: none !important; }
@media (max-width: 1000px) {
  #profitSearchForm { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
#costAnalysis { min-width: 0; padding: 20px; background: #fff; }
#costAnalysis h2 { font-size: 22px; margin: 0 0 20px; }
#costAnalysis h3 { font-size: 17px; margin: 24px 0 12px; }
.cost-toolbar, .cost-actions, .cost-pagination { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cost-toolbar input { width: 240px; max-width: 100%; }
.cost-table-wrap { max-width: 100%; overflow-x: auto; border-top: 1px solid #e1e5e8; }
.cost-table-wrap table { min-width: 680px; width: 100%; }
.cost-table-wrap td { max-width: 260px; overflow-wrap: anywhere; }
.cost-batch-id { display: block; width: 140px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cost-pagination { justify-content: flex-end; margin-top: 12px; }
.cost-dialog { width: 560px; max-width: calc(100vw - 24px); max-height: calc(100dvh - 32px); overflow: auto; border: 1px solid #d7dce0; border-radius: 8px; padding: 24px; }
.cost-dialog::backdrop { background: rgb(0 0 0 / 35%); }
.cost-dialog h2 { font-size: 20px; }
.cost-dialog p { overflow-wrap: anywhere; }
.cost-dialog table { width: 100%; min-width: 0; table-layout: fixed; }
.cost-dialog th, .cost-dialog td { white-space: normal; overflow-wrap: anywhere; }
.cost-form { display: grid; gap: 14px; }
.cost-form label { display: grid; gap: 6px; min-width: 0; }
.cost-form input, .cost-form select, .cost-form textarea { width: 100%; min-width: 0; box-sizing: border-box; }
.cost-form [hidden] { display: none; }
.cost-form label:has(input[type="checkbox"]) { display: flex; align-items: flex-start; gap: 10px; }
.cost-form input[type="checkbox"] { order: -1; flex: 0 0 18px; width: 18px; height: 18px; margin: 3px 0 0; }
.history-date-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 16px 0; }
.history-date-filters label { display: grid; gap: 6px; min-width: 0; }
.history-date-filters input { width: 170px; min-width: 0; max-width: 100%; box-sizing: border-box; }
#historyDateError { flex-basis: 100%; margin: 0; color: #a32132; }
#historyDateError:empty { display: none; }
.history-order-scroll { overflow: auto; max-height: 318px; overscroll-behavior: contain; position: relative; }
.history-order-scroll table { border-collapse: separate; border-spacing: 0; }
.history-order-scroll thead { position: sticky; top: 0; z-index: 1; background: #f5f9f8; }
.history-order-scroll th { height: 40px; box-sizing: border-box; white-space: nowrap; }
.history-order-scroll tbody tr { height: 52px; }
.history-order-scroll td { height: 52px; box-sizing: border-box; padding-top: 8px; padding-bottom: 8px; white-space: nowrap; }
.history-order-scroll .history-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-order-scroll td:nth-child(3) .history-cell { max-width: 380px; }
.history-order-scroll .history-cell br { display: none; }
@media (max-width: 600px) {
  .history-date-filters { gap: 10px; }
  .history-date-filters label { flex: 1 1 130px; }
  .history-date-filters input { width: 100%; }
}
@media (max-width: 600px) {
  #costAnalysis { padding: 12px; }
  #profitAnalysis { padding: 12px; }
  .cost-toolbar input { flex: 1; min-width: 120px; }
  .cost-pagination { justify-content: space-between; font-size: 13px; }
  .cost-dialog { padding: 16px; }
}

#manualOrderShipmentHistory .shipment-history { margin: 16px 0 0; }
#manualOrderShipmentHistory .shipment-history h3 { margin: 0 0 12px; }
#manualOrderShipmentHistory .inventory-table-wrap { border-color: var(--line); background: transparent; }
#manualOrderShipmentHistory .shipping-table { min-width: 460px; table-layout: auto; }
#manualOrderShipmentHistory .shipping-table :is(th, td) {
  padding: 11px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  text-align: left;
  vertical-align: top;
}
#manualOrderShipmentHistory .shipping-table th { background: #f6f9f8; color: #30413d; font-size: 12px; font-weight: 800; }
#manualOrderShipmentHistory .shipping-table td { font-size: 14px; }
#manualOrderShipmentHistory .shipping-table tbody tr:last-child td { border-bottom: 0; }
#manualOrderShipmentHistory .shipment-entry {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  line-height: 1.5;
}
#manualOrderShipmentHistory:has(.shipment-history) + .manual-create-summary {
  margin-top: 12px;
  border-top: 1px solid var(--line);
}
