:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --panel: #ffffff;
  --line: #d9dee5;
  --text: #17202a;
  --muted: #657282;
  --accent: #0f766e;
  --accent-2: #b45309;
  --soft: #e8f3f1;
  --shadow: 0 14px 28px rgba(23, 32, 42, 0.08);
}

.ads-workbench {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

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

.ads-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.metric-card.compact {
  min-height: 94px;
  padding: 12px;
}

.metric-card.compact strong {
  font-size: 18px;
  line-height: 1.25;
}

.metric-card.compact small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.money-dual.value small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.ads-campaign-table {
  min-width: 1420px;
}

.link-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  text-align: left;
}

.link-button.strong {
  font-weight: 800;
}

.pagination-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin: 12px 0;
}

.ads-breakdown {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.ads-expense-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid #b7d8d2;
  border-radius: 8px;
  background: #eef8f6;
  color: #164e48;
  font-size: 13px;
  line-height: 1.45;
}

.ads-expense-notice strong {
  flex: 0 0 auto;
}

.ads-expense-notice code,
.ads-ledger-formula code {
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(15, 118, 110, 0.1);
  color: #0f766e;
}

.ads-ledger-panel {
  display: grid;
  gap: 14px;
  min-width: 920px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.ads-ledger-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.ads-ledger-template {
  min-width: 860px;
}

.ads-ledger-template th,
.ads-ledger-template td {
  vertical-align: top;
}

.ads-ledger-formula {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px dashed #b7c5d1;
  border-radius: 8px;
  background: #ffffff;
}

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

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

.affiliate-panel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.affiliate-panel h3 {
  margin: 0;
  font-size: 15px;
}

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

.affiliate-mini-kpis div {
  border-top: 1px solid #eef1f4;
  padding-top: 8px;
}

.affiliate-mini-kpis span,
.affiliate-chip-row > span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.affiliate-mini-kpis strong {
  display: block;
  margin-top: 4px;
  font-size: 17px;
}

.affiliate-content-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
}

.affiliate-content-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfd;
}

.affiliate-content-thumb {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  background: #eef8f6;
  color: #0f766e;
  font-weight: 800;
}

.affiliate-content-card strong,
.affiliate-content-card span {
  overflow-wrap: anywhere;
}

.affiliate-content-card span,
.affiliate-content-stats small {
  color: var(--muted);
  font-size: 12px;
}

.affiliate-content-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 8px;
}

.affiliate-filter-board {
  display: grid;
  gap: 10px;
}

.affiliate-ledger-form {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

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

.affiliate-edit-table {
  margin-top: 12px;
}

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

.affiliate-suggested-block h4 {
  margin: 0;
  font-size: 14px;
}

.affiliate-chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.affiliate-chip-row > span {
  flex: 0 0 72px;
}

.affiliate-chip-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  color: var(--muted);
  font-size: 13px;
}

.affiliate-wide-table {
  min-width: 1280px;
}

.compact-table {
  min-width: 560px;
}

.inline-actions {
  display: grid;
  gap: 4px;
  justify-items: start;
}

.link-button.danger {
  color: #b91c1c;
}

@media (max-width: 980px) {
  .ads-summary-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
  .affiliate-dashboard-grid,
  .affiliate-campaign-grid,
  .affiliate-ledger-form .form-grid,
  .affiliate-content-cards {
    grid-template-columns: 1fr;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Microsoft YaHei", sans-serif;
}

.app {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

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

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

h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0;
}

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

#periodText {
  margin: 8px 0 0;
}

.user-line {
  margin: 4px 0 0;
  font-size: 13px;
}

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

.logout-form {
  margin: 0;
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(420px, 100%);
}

.login-panel {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-panel h1 {
  margin-bottom: 10px;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.login-error {
  margin: 16px 0 0;
}

.login-submit {
  width: 100%;
  justify-content: center;
}

.status {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #f1c27d;
  border-radius: 8px;
  background: #fff7ed;
  color: #7c2d12;
}

.overview-finance {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.overview-finance-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.overview-finance-head h2 {
  margin: 0;
  font-size: 18px;
}

.overview-finance-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.overview-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.overview-period-switch,
.overview-currency-switch {
  display: inline-flex;
  overflow: hidden;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.overview-period-switch button,
.overview-currency-switch button {
  min-width: 48px;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.overview-period-switch button:last-child,
.overview-currency-switch button:last-child {
  border-right: 0;
}

.overview-period-switch button.active,
.overview-currency-switch button.active {
  background: #1f66d1;
  color: #ffffff;
}

.overview-date {
  display: flex;
  align-items: center;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #ffffff;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.finance-metric-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(120px, 1fr));
  border-top: 1px solid #eef1f4;
  border-left: 1px solid #eef1f4;
}

.finance-metric {
  min-height: 92px;
  border-right: 1px solid #eef1f4;
  border-bottom: 1px solid #eef1f4;
  padding: 12px;
  background: #ffffff;
}

.finance-metric.primary {
  background: #f2f7ff;
}

.finance-metric.warning {
  background: #fff8e9;
}

.finance-metric.profit {
  background: #f1fbf7;
}

.finance-metric.loss {
  background: #fff4f4;
}

.finance-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.finance-label em {
  border-radius: 5px;
  padding: 2px 5px;
  background: #eef2f6;
  color: #506070;
  font-style: normal;
  font-size: 11px;
}

.finance-metric strong {
  display: block;
  margin-top: 9px;
  color: var(--text);
  font-size: 20px;
  line-height: 1.15;
  white-space: nowrap;
}

.finance-metric.primary strong {
  color: #1f66d1;
}

.finance-metric.warning strong {
  color: #b45309;
}

.finance-metric.profit strong {
  color: #0f766e;
}

.finance-metric.loss strong {
  color: #dc2626;
}

.finance-metric small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.dashboard-summary-test {
  border-top: 1px solid var(--line);
  padding: 14px 18px 18px;
  background: #f8fafc;
}

.dashboard-summary-test-head,
.dashboard-summary-test-meta,
.dashboard-summary-test-row {
  display: grid;
  gap: 10px;
}

.dashboard-summary-test-head {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  margin-bottom: 10px;
}

.dashboard-summary-test-head strong {
  display: block;
  font-size: 15px;
}

.dashboard-summary-test-head span,
.dashboard-summary-test-meta,
.dashboard-summary-test-row span:last-child {
  color: var(--muted);
  font-size: 12px;
}

.dashboard-summary-test-error {
  margin-bottom: 10px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff5f5;
  color: #991b1b;
  font-size: 13px;
  font-weight: 800;
}

.dashboard-summary-test-meta {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
}

.dashboard-summary-test-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.dashboard-summary-test-row {
  grid-template-columns: 140px minmax(120px, 1fr) minmax(120px, 1fr) minmax(160px, 1.4fr);
  align-items: center;
  border-top: 1px solid #eef1f4;
  padding: 10px 12px;
}

.dashboard-summary-test-row:first-child {
  border-top: 0;
}

.dashboard-summary-test-row.head {
  background: #eef4fb;
  color: #334155;
  font-size: 12px;
  font-weight: 900;
}

.dashboard-summary-test-row span:nth-child(2),
.dashboard-summary-test-row span:nth-child(3) {
  color: var(--text);
  font-weight: 800;
}

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

.metric {
  min-height: 96px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: 0;
}

.tabs {
  display: flex;
  gap: 6px;
  margin: 6px 0 14px;
  overflow-x: auto;
}

.tab {
  min-width: 92px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.tab.active {
  border-color: var(--accent);
  background: var(--soft);
  color: var(--accent);
}

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

input[type="search"] {
  width: min(420px, 100%);
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
}

.option-button {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.option-button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--soft);
  color: var(--accent);
}

.currency-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.currency-button {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

.currency-button.active {
  border-color: var(--accent);
  background: var(--soft);
  color: var(--accent);
  font-weight: 800;
}

.currency-controls small {
  margin-left: 4px;
  color: var(--muted);
}

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

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

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

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f9fafb;
  color: #334155;
  font-size: 12px;
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.sort-button span {
  min-width: 12px;
  color: var(--muted);
  font-size: 11px;
}

.sort-button.active {
  color: var(--accent);
}

.sort-button.active span {
  color: var(--accent);
}

td.wrap {
  min-width: 260px;
  max-width: 420px;
  white-space: normal;
}

.thumb-cell {
  width: 72px;
  min-width: 72px;
}

.product-thumb,
.thumb-placeholder {
  display: block;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f1f5f9;
}

.product-thumb {
  object-fit: cover;
}

.product-thumb.large,
.thumb-placeholder.large {
  width: 64px;
  height: 64px;
  line-height: 62px;
}

.thumb-placeholder {
  color: var(--muted);
  font-size: 12px;
  line-height: 46px;
  text-align: center;
}

.subtext {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  white-space: normal;
}

.warehouse-table {
  min-width: 1260px;
}

.warehouse-center-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  min-width: 1120px;
  align-items: start;
}

.warehouse-center-content {
  min-width: 0;
  max-height: calc(100vh - 190px);
  overflow: auto;
  scrollbar-gutter: stable both-edges;
}

.warehouse-side-nav {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  gap: 2px;
  min-height: calc(100vh - 220px);
  padding: 12px 10px;
  border-right: 1px solid var(--line);
  background: #fbfcfd;
}

.warehouse-side-title {
  display: grid;
  gap: 4px;
  padding: 4px 8px 10px;
  color: var(--text);
}

.warehouse-side-title span {
  color: var(--muted);
  font-size: 12px;
}

.warehouse-side-item {
  display: grid;
  gap: 3px;
  width: 100%;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0;
  padding: 9px 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.warehouse-side-item span {
  font-size: 13px;
  font-weight: 800;
}

.warehouse-side-item small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.warehouse-side-item.active {
  border-left-color: var(--accent);
  background: var(--soft);
  color: var(--accent);
}

.warehouse-side-item[data-disabled-module="true"] {
  color: #9aa4b2;
}

.warehouse-overview-board,
.warehouse-list-board,
.warehouse-placeholder {
  display: grid;
  gap: 14px;
  min-width: 980px;
  padding: 14px;
}

.warehouse-overview-kpis {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.warehouse-flow-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.warehouse-flow-panel h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.warehouse-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 8px;
}

.warehouse-flow span {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfd;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.warehouse-flow span:not(:last-child)::after {
  content: "→";
  position: absolute;
  right: -12px;
  color: var(--muted);
}

.warehouse-overview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.warehouse-list-toolbar {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 12px;
}

.warehouse-list-toolbar .module-source-note {
  flex: 1 1 560px;
}

.warehouse-list-toolbar .save-button {
  align-self: flex-start;
  white-space: nowrap;
}

.warehouse-list-table {
  min-width: 1080px;
}

.inventory-replenishment-board {
  display: grid;
  gap: 14px;
  min-width: 1380px;
  padding: 14px;
}

.replenishment-controls {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.inventory-replenishment-board > .replenishment-controls {
  position: sticky;
  top: 0;
  z-index: 6;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.inventory-replenishment-board > .module-source-note {
  position: sticky;
  top: 78px;
  z-index: 5;
}

.inventory-replenishment-board > .replenishment-kpi-grid {
  position: sticky;
  top: 132px;
  z-index: 4;
  padding-bottom: 8px;
  background: #fff;
}

.module-source-note {
  border: 1px solid #dbeafe;
  border-radius: 8px;
  padding: 10px 12px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.module-source-note.warn {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.compact-checkbox {
  min-height: 40px;
  align-items: center;
  margin-left: auto;
}

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

.compact-metric {
  min-height: 92px;
  box-shadow: none;
}

.compact-metric small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.inventory-replenishment-table {
  min-width: 1720px;
}

.inbound-ledger-board {
  display: grid;
  gap: 14px;
  min-width: 1180px;
  padding: 14px;
}

.inbound-toolbar {
  align-items: center;
  justify-content: space-between;
}

.inbound-toolbar p {
  margin: 5px 0 0;
}

.inbound-order-table {
  min-width: 1320px;
}

.inbound-stock-table {
  min-width: 1240px;
}

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

.danger-link {
  margin-left: 6px;
  border-color: #fecaca;
  color: #b91c1c;
}

.inbound-sku-search,
.component-sku-search {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) auto;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.inbound-sku-search .hint,
.component-sku-search .hint,
.inbound-sku-match-result,
.component-sku-match-result {
  grid-column: 1 / -1;
  margin: 0;
}

.inbound-line-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.inbound-line-head,
.inbound-line-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 96px 96px 96px 96px 96px minmax(140px, 0.6fr) 72px;
  gap: 10px;
  align-items: center;
  padding: 10px;
}

.inbound-line-head {
  background: #f9fafb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.inbound-line-row {
  border-top: 1px solid var(--line);
}

.inbound-line-row select,
.inbound-line-row input,
.inbound-sku-search textarea,
.component-sku-search textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.inbound-sku-search textarea,
.component-sku-search textarea {
  min-height: 58px;
  resize: vertical;
}

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

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

.rule-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.rule-card h3 {
  margin: 0;
  font-size: 14px;
}

.rule-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.warehouse-subnav {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  gap: 6px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.subtab {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fbfcfd;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.subtab.active {
  border-color: var(--accent);
  background: var(--soft);
  color: var(--accent);
}

.ads-subnav {
  align-items: center;
}

.subnav-note {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.ads-table {
  min-width: 1380px;
}

.ads-detail-table {
  min-width: 1580px;
}

.money-dual {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 800;
  line-height: 1.2;
}

.money-dual small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.service-provider-layout {
  display: grid;
  gap: 14px;
  min-width: 980px;
  padding: 14px;
}

.user-management-layout {
  display: grid;
  grid-template-columns: 340px minmax(680px, 1fr);
  gap: 14px;
  min-width: 1080px;
  padding: 14px;
}

.user-list-panel,
.user-editor-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
}

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

.managed-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfd;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.managed-user-row.active {
  border-color: var(--accent);
  background: var(--soft);
}

.managed-user-row strong,
.managed-user-row small {
  display: block;
}

.managed-user-row small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.managed-user-row em {
  border-radius: 6px;
  padding: 4px 8px;
  background: #eef8f7;
  color: var(--accent);
  font-style: normal;
  font-size: 12px;
  font-weight: 800;
}

.managed-user-row em.disabled {
  background: #f3f4f6;
  color: #6b7280;
}

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

.permission-section {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

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

.permission-card,
.scope-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfd;
}

.permission-card input,
.scope-check input {
  margin-top: 3px;
}

.permission-card strong,
.permission-card small {
  display: block;
}

.permission-card small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

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

.scope-check {
  align-items: center;
  min-height: 40px;
}

.empty.compact {
  padding: 16px;
}

.order-filter-panel,
.product-filter-panel {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  min-width: 1180px;
  border-bottom: 1px solid var(--line);
  padding: 12px;
  background: #fbfcfd;
}

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

.order-filter-group > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.order-filter-panel p,
.product-filter-panel p {
  flex-basis: 100%;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.product-sales-table {
  min-width: 1680px;
}

.status-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 220px;
}

.period-switch.compact {
  height: 40px;
  padding: 4px;
}

.service-provider-form {
  display: block;
}

.service-provider-editor {
  background: #fbfcfd;
}

.service-provider-table {
  min-width: 980px;
}

.selected-row {
  background: #eef8f7;
}

.checkbox-field {
  display: flex;
  align-items: center;
  grid-template-columns: unset;
  gap: 8px;
  margin-top: 12px;
}

.checkbox-field input {
  width: auto;
  min-height: unset;
}

.provider-preview {
  margin-top: 12px;
}

.actual-finance-head {
  min-width: 1180px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.actual-finance-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
}

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

.actual-finance-title p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.actual-finance-controls,
.actual-finance-order-filter {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 16px 14px;
}

.actual-finance-sync-panel {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 16px 14px;
  border: 1px solid #d9e8e5;
  border-radius: 8px;
  padding: 12px;
  background: #f4fbf9;
}

.sync-copy {
  flex: 1 1 280px;
  display: grid;
  gap: 4px;
  min-width: 260px;
}

.sync-copy strong {
  font-size: 14px;
}

.sync-copy span,
.sync-status {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.sync-status {
  flex: 1 1 240px;
  min-height: 40px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #ffffff;
}

.sync-status.running {
  border-color: #94a3b8;
  color: #334155;
}

.sync-status.ok {
  border-color: #99d3c8;
  color: #0f766e;
}

.sync-status.error {
  border-color: #f0b4a8;
  color: #9f1239;
}

.actual-finance-order-filter {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  background: #ffffff;
}

.actual-finance-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  border-top: 1px solid #eef1f4;
  border-left: 1px solid #eef1f4;
  background: #ffffff;
}

.actual-finance-kpis article {
  min-height: 88px;
  border-right: 1px solid #eef1f4;
  border-bottom: 1px solid #eef1f4;
  padding: 12px;
}

.actual-finance-kpis span,
.mini-field span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.actual-finance-kpis strong {
  display: block;
  margin-top: 8px;
  font-size: 19px;
  line-height: 1.25;
}

.actual-finance-source {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  border-top: 1px solid var(--line);
  padding: 10px 16px;
  color: var(--muted);
  font-size: 12px;
}

.mini-field {
  display: grid;
  gap: 5px;
}

.mini-field input,
.mini-field select {
  min-width: 150px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
}

.mini-field.wide {
  flex: 1 1 360px;
  max-width: 560px;
}

.mini-field input[type="search"] {
  width: 100%;
}

.actual-finance-table {
  min-width: 1180px;
}

.order-link-text {
  color: #1f66d1;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.ok {
  border-color: #b7d8d4;
  background: #eef8f7;
  color: #0f766e;
}

.status-pill.warn {
  border-color: #f1c27d;
  background: #fff7ed;
  color: #b45309;
}

.status-pill.missing {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.status-pill.urgent,
.status-pill.stockout30 {
  border-color: #f0b4a8;
  background: #fff4f4;
  color: #b42318;
}

.status-pill.watch {
  border-color: #f1c27d;
  background: #fff7ed;
  color: #b45309;
}

.status-pill.normal {
  border-color: #b7d8d4;
  background: #eef8f7;
  color: #0f766e;
}

.status-pill.excess {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1f66d1;
}

.status-pill.dead {
  border-color: #d1d5db;
  background: #f3f4f6;
  color: #475569;
}

.store-daily-board {
  display: grid;
  gap: 14px;
  min-width: 1080px;
  padding: 14px;
}

.store-daily-header {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) auto;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfcfd;
}

.store-daily-header h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.store-daily-header .muted {
  margin: 8px 0 0;
}

.store-daily-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.period-switch {
  display: inline-flex;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: var(--panel);
}

.period-button {
  min-width: 58px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.period-button.active {
  background: var(--soft);
  color: var(--accent);
}

.period-picker,
.period-current {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
}

.period-picker {
  min-width: 148px;
  padding: 0 10px;
}

.period-current {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  color: var(--muted);
}

.compact-button {
  height: 40px;
  padding: 0 14px;
}

.store-daily-sync {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

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

.store-kpi-card {
  width: 100%;
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.store-kpi-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.store-kpi-card strong {
  display: block;
  margin-top: 10px;
  color: var(--text);
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: 0;
}

.store-kpi-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.store-kpi-card.strong {
  border-color: #b7d8d4;
  background: #f2fbfa;
}

.store-kpi-card.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent), 0 8px 18px rgba(15, 118, 110, 0.12);
}

.store-kpi-card:hover {
  border-color: #9fb4c0;
}

.store-kpi-card.pending strong {
  color: var(--accent-2);
  font-size: 18px;
}

.store-chart-panel,
.traffic-overview-section,
.product-traffic-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.store-chart-panel .section-title-row,
.traffic-overview-section .section-title-row,
.product-traffic-section .section-title-row {
  margin: 0;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.store-chart-stack {
  display: grid;
  gap: 10px;
}

.store-chart-stack .section-title-row.compact {
  margin: 0;
}

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

.line-chart-panel {
  min-height: 290px;
}

.store-line-chart-scroll {
  overflow-x: auto;
  padding: 12px 14px 14px;
}

.store-line-chart-svg {
  display: block;
  width: 100%;
  min-width: 820px;
  height: auto;
}

.chart-title {
  fill: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.legend-label,
.selected-label {
  fill: #334155;
  font-size: 12px;
}

.line-chart-grid {
  stroke: #dbe2ea;
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.line-chart-axis {
  stroke: #b8c2cf;
  stroke-width: 1;
}

.store-trend-line {
  fill: none;
  stroke-width: 2.4;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.store-trend-point {
  stroke: #ffffff;
  stroke-width: 1.4;
}

.store-chart-scroll {
  overflow-x: auto;
  padding: 12px 14px 14px;
}

.store-chart-svg {
  display: block;
  width: 100%;
  min-width: 720px;
  height: auto;
}

.chart-bg {
  fill: #ffffff;
}

.chart-grid line {
  stroke: #e7ebef;
  stroke-width: 1;
}

.chart-grid text,
.chart-x-label {
  fill: var(--muted);
  font-size: 11px;
}

.chart-close-line {
  fill: none;
  stroke: #334155;
  stroke-width: 1.5;
  opacity: 0.65;
}

.kline-candle .wick {
  stroke-width: 2;
}

.kline-candle .body {
  stroke-width: 1;
}

.kline-candle.up .wick,
.kline-candle.up .body {
  stroke: #0f766e;
}

.kline-candle.up .body {
  fill: #d9f2ee;
}

.kline-candle.down .wick,
.kline-candle.down .body {
  stroke: #b45309;
}

.kline-candle.down .body {
  fill: #fff2df;
}

.store-hour-axis {
  border-top: 1px solid var(--line);
  padding: 10px 14px 12px;
  background: #fbfcfd;
}

.hour-axis-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.hour-axis-head small {
  font-weight: 700;
}

.hour-axis-scroll {
  overflow-x: auto;
}

.hour-axis-track {
  display: grid;
  grid-template-columns: repeat(24, minmax(34px, 1fr));
  min-width: 820px;
  gap: 0;
  align-items: start;
}

.hour-tick {
  display: grid;
  justify-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
}

.hour-tick i {
  display: block;
  width: 1px;
  height: 12px;
  background: #d7dee5;
}

.hour-tick em {
  font-style: normal;
}

.hour-tick.has-data {
  color: var(--accent);
  font-weight: 800;
}

.hour-tick.has-data i {
  width: 2px;
  height: 16px;
  background: var(--accent);
}

.traffic-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  padding: 14px;
}

.traffic-source-card {
  display: grid;
  gap: 10px;
  min-height: 158px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.traffic-source-card.ready {
  border-color: #b7d8d4;
  background: #f8fcfb;
}

.traffic-card-head {
  display: grid;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.traffic-card-head strong {
  min-width: 0;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.traffic-card-head .status-pill {
  justify-self: start;
  white-space: normal;
  text-align: center;
}

.traffic-card-value {
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
}

.traffic-source-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.traffic-api {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.traffic-source-table {
  min-width: 1360px;
}

.traffic-source-table td:first-child {
  min-width: 220px;
}

.traffic-source-table td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

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

.source-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.source-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.store-trend-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: auto;
}

.store-trend-section .section-title-row {
  position: sticky;
  left: 0;
  margin: 0;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.store-daily-table {
  min-width: 1240px;
}

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

.order-list {
  display: grid;
  gap: 0;
  min-width: 1180px;
}

.order-card {
  display: grid;
  grid-template-columns: 84px 56px minmax(300px, 1fr) 64px 150px 150px 92px;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.order-status {
  width: fit-content;
  border-radius: 6px;
  padding: 4px 8px;
  background: var(--soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.order-thumb {
  display: block;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f1f5f9;
  object-fit: cover;
}

.order-thumb.placeholder {
  color: var(--muted);
  font-size: 12px;
  line-height: 46px;
  text-align: center;
}

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

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

.order-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-title span,
.order-subline {
  color: var(--muted);
  font-size: 12px;
}

.order-subline {
  margin-top: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-qty {
  color: #dc2626;
  font-size: 20px;
  font-weight: 800;
  text-align: center;
}

.order-money span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.order-money strong {
  display: block;
  margin-top: 5px;
  font-size: 15px;
}

.detail-link {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--panel);
  color: var(--accent);
  font-weight: 800;
  cursor: pointer;
}

.detail-panel[hidden] {
  display: none;
}

.detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(15, 23, 42, 0.18);
}

.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 21;
  width: min(920px, 100%);
  overflow: auto;
  border-left: 1px solid var(--line);
  background: var(--panel);
  box-shadow: -18px 0 36px rgba(15, 23, 42, 0.16);
}

.warehouse-drawer {
  width: min(980px, 100%);
}

.detail-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.detail-header h2 {
  margin: 0;
  font-size: 22px;
}

.detail-products {
  display: grid;
  gap: 10px;
  padding: 18px 24px 0;
}

.detail-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.detail-item p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.batch-cost-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.batch-cost-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) 64px 96px 96px;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

.batch-cost-row strong {
  color: var(--text);
  text-align: right;
}

.batch-cost-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

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

.detail-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
}

.detail-block h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.money-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid #eef1f4;
}

.money-line:first-of-type {
  border-top: 0;
}

.money-line span {
  color: var(--muted);
}

.money-line small {
  display: block;
  margin-top: 3px;
  color: #8a95a3;
  font-size: 11px;
}

.money-line strong {
  text-align: right;
  white-space: nowrap;
}

.money-line.highlight strong {
  color: #dc2626;
  font-size: 17px;
}

.profit-block {
  grid-column: 1 / -1;
}

.profit-form {
  display: grid;
  gap: 0;
}

.profit-input-line strong {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.profit-input-line select {
  width: 160px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.profit-input-line input {
  width: 120px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  text-align: right;
  font: inherit;
}

.warehouse-fee-line {
  align-items: center;
}

.file-list {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.file-row {
  display: grid;
  grid-template-columns: 150px 1fr 100px 210px;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  font-size: 13px;
}

.file-row strong {
  color: var(--accent-2);
}

.editor-form {
  display: grid;
  gap: 14px;
  padding: 18px 24px 28px;
}

.editor-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
}

.editor-section h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.product-summary {
  display: grid;
  grid-template-columns: 76px 1fr;
  align-items: center;
  gap: 12px;
  background: #fbfcfd;
}

.product-summary p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

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

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

.field.full {
  margin-top: 12px;
}

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

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

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

.field textarea {
  resize: vertical;
}

.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.segmented-control {
  display: inline-flex;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: #fbfcfd;
}

.segmented-control label {
  min-width: 92px;
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.segmented-control label:has(input:checked) {
  background: var(--soft);
  color: var(--accent);
}

.segmented-control input {
  margin-right: 6px;
}

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

.section-title-row h3 {
  margin: 0;
}

.bundle-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.bundle-table-head,
.bundle-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 96px 140px 130px 86px;
  gap: 10px;
  align-items: center;
  padding: 10px;
}

.bundle-table-head {
  background: #f9fafb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.bundle-row {
  border-top: 1px solid var(--line);
}

.bundle-row select,
.bundle-row input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.cost-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.cost-preview div {
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.cost-preview span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.cost-preview strong {
  display: block;
  margin-top: 8px;
  font-size: 18px;
}

.editor-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 0 0;
  background: var(--panel);
}

.save-button {
  height: 40px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.save-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

@media (max-width: 980px) {
  .app {
    padding: 16px;
  }

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

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

  .overview-finance-head {
    align-items: stretch;
    flex-direction: column;
  }

  .overview-controls {
    justify-content: flex-start;
  }

  .finance-metric-grid {
    grid-template-columns: repeat(2, minmax(132px, 1fr));
  }

  .dashboard-summary-test-head,
  .dashboard-summary-test-meta,
  .dashboard-summary-test-row {
    grid-template-columns: 1fr;
  }

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

  .currency-controls {
    flex-wrap: wrap;
  }

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

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

  .form-grid,
  .cost-preview,
  .permission-grid,
  .scope-grid,
  .user-management-layout,
  .store-daily-header,
  .store-kpi-grid,
  .store-chart-grid,
  .store-source-row,
  .traffic-overview-grid {
    grid-template-columns: 1fr;
  }

  .store-daily-actions {
    align-items: flex-start;
    flex-direction: column;
  }
}
