:root {
  --sidebar-bg: #1a1a2e;
  --sidebar-bg-deep: #141422;
  --sidebar-bg-mid: #2c3e50;
  --sidebar-text: #ecf0f1;
  --sidebar-text-muted: rgba(236, 240, 241, 0.62);
  --sidebar-active: rgba(44, 62, 80, 0.85);
  --sidebar-hover: rgba(236, 240, 241, 0.08);
  --sidebar-border: rgba(236, 240, 241, 0.1);
  --sidebar-accent: #5d6d7e;
  --primary: #2c3e50;
  --primary-soft: #eef1f4;
  --accent: #34495e;
  --bg: #f3f5f9;
  --card: #ffffff;
  --border: #e6e9f0;
  --text: #303030;
  --muted: #6b7280;
  --success: #1f9d6a;
  --success-bg: #e8f7f0;
  --warning: #c47a12;
  --warning-bg: #fff4e5;
  --info: #2b6cb0;
  --info-bg: #e8f1fb;
  --danger: #c0392b;
  --sidebar-width: 208px;
  --detail-width: 320px;
  --topbar-height: 56px;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
}

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

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: flex;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

/* Sidebar — 深沉商务风 + 线型图标 */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  height: 100%;
  position: sticky;
  top: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(44, 62, 80, 0.55) 0%, transparent 55%),
    linear-gradient(180deg, #1a1a2e 0%, #151b28 48%, #2c3e50 100%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 18px 12px 14px;
  border-right: 1px solid rgba(0, 0, 0, 0.4);
  box-shadow: 6px 0 28px rgba(15, 18, 32, 0.28);
}

.brand {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 16px;
  margin: 0 2px 8px;
  border-bottom: 1px solid rgba(236, 240, 241, 0.1);
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: block;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}

.brand-title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  color: #ffffff;
  white-space: nowrap;
}

.brand-logo {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  line-height: 1.2;
  color: rgba(236, 240, 241, 0.55);
  white-space: nowrap;
}

.nav-section {
  flex: 1;
  overflow-y: auto;
  padding: 4px 2px 8px;
}

.nav-label {
  margin: 12px 12px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(236, 240, 241, 0.38);
}

.nav-item,
.nav-sub a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 450;
  margin-bottom: 2px;
  transition: background 0.15s ease, color 0.15s ease;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.nav-item.disabled,
.nav-sub a.disabled {
  color: var(--sidebar-text-muted);
  opacity: 1;
  cursor: not-allowed;
  pointer-events: none;
}

.nav-item:hover:not(.disabled),
.nav-sub a:hover:not(.disabled) {
  background: rgba(236, 240, 241, 0.08);
  color: #ffffff;
}

.nav-item.active,
.nav-sub a.active {
  background: rgba(236, 240, 241, 0.12);
  color: #ffffff;
  font-weight: 600;
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  color: #ecf0f1;
  opacity: 0.88;
  flex-shrink: 0;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.nav-text {
  flex: 1;
  min-width: 0;
}

.nav-item.active .nav-icon,
.nav-item:hover:not(.disabled) .nav-icon,
.nav-group-toggle:hover .nav-icon,
.nav-group.is-open > .nav-group-toggle .nav-icon {
  color: #ffffff;
  opacity: 1;
}

.nav-group {
  margin-bottom: 4px;
}

.nav-group-toggle {
  font: inherit;
}

.nav-group.is-open > .nav-group-toggle {
  color: #ffffff;
  background: rgba(236, 240, 241, 0.06);
}

.nav-chevron {
  width: 14px;
  height: 14px;
  color: rgba(236, 240, 241, 0.45);
  transition: transform 0.18s ease;
  display: grid;
  place-items: center;
  margin-left: auto;
}

.nav-chevron svg {
  width: 14px;
  height: 14px;
}

.nav-group.is-open .nav-chevron {
  transform: rotate(180deg);
  color: #ecf0f1;
}

.nav-sub {
  margin: 2px 0 6px 0;
  padding: 2px 0 2px 30px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-sub[hidden] {
  display: none;
}

.nav-sub a {
  font-size: 13px;
  padding: 9px 12px;
  color: var(--sidebar-text-muted);
  width: auto;
}

.nav-sub a.active {
  color: #ffffff;
  background: rgba(236, 240, 241, 0.14);
}

.nav-sub a:hover:not(.disabled) {
  color: #ffffff;
}

.nav-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(236, 240, 241, 0.1);
}

/* Main column */
.main-column {
  flex: 1;
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: var(--topbar-height);
  flex-shrink: 0;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: default;
  display: grid;
  place-items: center;
  padding: 0;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.icon-btn.is-clickable {
  cursor: pointer;
  color: var(--text);
  border: 1px solid var(--border);
  background: #fff;
  text-decoration: none;
}

.icon-btn.is-clickable:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.orders-table td.message-content {
  white-space: normal;
  max-width: 720px;
  line-height: 1.5;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-meta strong {
  font-size: 13px;
}

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

.logout-link {
  font-size: 12px;
  color: #2c3e50;
}

.content-with-detail {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.content {
  flex: 1;
  min-width: 0;
  padding: 18px 20px 24px;
  overflow: auto;
}

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

.page-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

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

.detail-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.aftersale-goods-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 560px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 12px;
}

.aftersale-goods-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.aftersale-goods-card .goods-thumb {
  width: 80px;
  height: 80px;
  flex: 0 0 80px;
  border-radius: 2px;
}

.aftersale-goods-copy {
  flex: 1;
  min-width: 0;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.aftersale-goods-name {
  line-height: 1.45;
}

.aftersale-goods-foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px 16px;
}

.aftersale-goods-pay {
  margin-left: auto;
  display: flex;
  gap: 16px;
  white-space: nowrap;
}

.aftersale-goods-discount {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.logistics-line {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.detail-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 12px;
}

.detail-block h2 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
}

.detail-fields {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 112px minmax(0, 1fr);
  margin: 0;
}

.detail-fields dt,
.detail-fields dd {
  margin: 0;
  padding: 10px 8px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.detail-fields dt {
  color: var(--muted);
}

.detail-fields dd.is-wide {
  grid-column: 2 / -1;
}

.detail-fields dd.is-full {
  grid-column: 1 / -1;
}

.customer-text {
  white-space: pre-line;
}

.detail-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.detail-status strong {
  font-size: 14px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

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

.btn-primary {
  background: #2c3e50;
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: #1a1a2e;
}

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

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

.btn-danger:hover:not(:disabled) {
  background: #fdf2f0;
}

.refresh-icon {
  width: 16px;
  height: 16px;
  margin-right: 6px;
}

#refresh-page-btn.is-refreshing .refresh-icon,
#sync-orders-btn.is-refreshing .refresh-icon,
#sync-aftersales-btn.is-refreshing .refresh-icon,
.stat-card.is-syncing .stat-icon svg {
  animation: refresh-spin 0.7s linear infinite;
}

.stat-card.is-syncing {
  border-color: #b7e4cf;
  background: #f7fcf9;
  animation: sync-card-pulse 1.2s ease-in-out infinite;
}

@keyframes sync-card-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(31, 157, 106, 0.16); }
  50% { box-shadow: 0 0 0 4px rgba(31, 157, 106, 0.14); }
}

@keyframes refresh-spin {
  to { transform: rotate(360deg); }
}

/* Stats */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.order-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.order-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
}

.order-group.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.order-group-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  flex-shrink: 0;
}

.order-group.is-active .order-group-dot {
  background: #ff6b6b;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.stat-icon svg {
  width: 18px;
  height: 18px;
}

.stat-icon.green {
  background: var(--success-bg);
  color: var(--success);
}
.stat-icon.blue {
  background: var(--info-bg);
  color: var(--info);
}
.stat-icon.orange {
  background: var(--warning-bg);
  color: var(--warning);
}

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

.stat-value {
  font-size: 18px;
  font-weight: 700;
  margin-top: 2px;
}

.stat-value.empty {
  color: #9ca3af;
  font-weight: 600;
}

.stat-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.stat-value[data-status="failed"] {
  color: var(--danger);
}

.shop-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.shop-auth-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.shop-auth-icon.is-ok {
  color: var(--success);
}

.shop-auth-icon.is-warn {
  color: var(--warning);
}

.shop-auth-icon.is-expired {
  color: var(--danger);
}

/* Filters */
.filter-bar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
  align-items: center;
}

.filter-bar select,
.filter-bar input {
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--muted);
  min-width: 120px;
}

.search-field {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-bar .search-field input[type="search"] {
  margin-left: 0;
  min-width: 200px;
  color: var(--text);
}

.aftersale-query .filter-bar {
  margin-bottom: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.search-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 0;
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}

.search-panel select,
.search-panel input {
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
  min-width: 140px;
}

.search-field-label,
.amount-range {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.search-panel input[type="datetime-local"] {
  min-width: 190px;
}

.amount-range input {
  width: 72px;
  min-width: 0;
}

.amount-unit {
  display: inline-flex;
  align-items: stretch;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

.search-panel .amount-unit input {
  height: 100%;
  border: 0;
  border-radius: 0;
  padding: 0 8px;
  background: #fff;
  -moz-appearance: textfield;
  appearance: textfield;
}

.search-panel .amount-unit input::-webkit-outer-spin-button,
.search-panel .amount-unit input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.amount-unit > span {
  display: flex;
  align-items: center;
  padding: 0 10px;
  background: #f3f4f6;
  color: #8b909a;
  border-left: 1px solid var(--border);
  font-size: 13px;
}

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

.search-submit {
  height: 34px;
  padding: 0 16px;
}

.shop-combo {
  position: relative;
}

.shop-combo-input {
  color: var(--text);
  min-width: 160px;
}

.shop-combo-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  max-height: 240px;
  overflow: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.shop-combo-list li {
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
  white-space: nowrap;
}

.shop-combo-list li.is-active,
.shop-combo-list li:hover {
  background: var(--primary-soft);
}

.search-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
}

.search-btn svg {
  width: 16px;
  height: 16px;
}

.search-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
}

/* Table */
.table-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

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

table.orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.orders-table th,
.orders-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.orders-table th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  background: #fafbfd;
}

.orders-table tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}

.orders-table tbody tr:hover,
.orders-table tbody tr.is-active {
  background: #f4f6f8;
}

.order-sn {
  color: #2c3e50;
  font-weight: 600;
}

.order-copy {
  margin-left: 4px;
  padding: 2px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  vertical-align: -3px;
  line-height: 0;
}

.order-copy svg {
  width: 14px;
  height: 14px;
}

.order-copy:hover,
.order-copy.is-copied {
  color: var(--success);
}

.copy-toast {
  position: fixed;
  z-index: 40;
  transform: translateY(-50%);
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--success-bg);
  color: var(--success);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  pointer-events: none;
}

.cell-tip-bubble {
  position: fixed;
  z-index: 30;
  max-width: 320px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #1a1a2e;
  color: #fff;
  font-size: 12px;
  line-height: 1.5;
  white-space: normal;
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.18);
  pointer-events: none;
}

.cell-tip-bubble::after {
  content: "";
  position: absolute;
  left: 14px;
  border: 6px solid transparent;
}

.cell-tip-bubble.is-above::after {
  top: 100%;
  border-top-color: #1a1a2e;
}

.cell-tip-bubble.is-below::after {
  bottom: 100%;
  border-bottom-color: #1a1a2e;
}

.platform-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f3f4f6;
  font-size: 12px;
}

.platform-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e02e24;
}

.status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.status-badge.s1 {
  background: var(--warning-bg);
  color: var(--warning);
}
.status-badge.s2 {
  background: var(--info-bg);
  color: var(--info);
}
.status-badge.s3 {
  background: var(--success-bg);
  color: var(--success);
}
.status-badge.s0 {
  background: #f3f4f6;
  color: var(--muted);
}

.link-action {
  color: #2c3e50;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

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

.page-size-form label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.page-size-form select {
  min-width: 88px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.pagination a {
  color: #2c3e50;
}

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

/* Detail panel */
.detail-panel {
  width: var(--detail-width);
  flex-shrink: 0;
  background: var(--card);
  border-left: 1px solid var(--border);
  padding: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.22s ease, padding 0.22s ease;
  position: relative;
}

.detail-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.detail-panel h2 {
  margin: 0;
  font-size: 15px;
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.detail-toggle {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}

.detail-toggle:hover {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: #c5cae8;
}

.detail-panel.is-collapsed {
  width: 40px;
  padding: 12px 6px;
  overflow: hidden;
}

.detail-panel.is-collapsed .detail-panel-header {
  flex-direction: column;
  align-items: center;
  margin-bottom: 0;
}

.detail-panel.is-collapsed h2,
.detail-panel.is-collapsed #detail-empty,
.detail-panel.is-collapsed #detail-body {
  display: none !important;
}

.detail-panel.is-collapsed .detail-toggle {
  width: 28px;
}

.detail-expand-rail {
  display: none;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.12em;
  margin-top: 12px;
  cursor: pointer;
  user-select: none;
  padding: 8px 0;
  text-align: center;
}

.detail-panel.is-collapsed .detail-expand-rail {
  display: block;
}

.detail-expand-rail:hover {
  color: var(--primary);
}

.detail-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 24px 8px;
  text-align: center;
  line-height: 1.6;
}

.detail-section {
  margin-bottom: 16px;
}

.detail-section h3 {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  text-transform: none;
}

.detail-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.detail-item:last-child {
  border-bottom: none;
}

.detail-thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #eef0f6;
  flex-shrink: 0;
  object-fit: cover;
  display: block;
}

.detail-item-meta {
  flex: 1;
  min-width: 0;
}

.detail-item-meta strong {
  display: block;
  font-size: 13px;
}

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

.detail-price {
  font-weight: 600;
  white-space: nowrap;
}

.detail-block {
  background: #f8f9fc;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}

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

.timeline-empty {
  font-size: 12px;
  color: var(--muted);
  padding: 8px 0;
}

/* Login — 参考抖店：左侧文案，右侧手机登录 */
body.login-body {
  height: auto;
  min-height: 100%;
  overflow: auto;
  background: #e8f2ff;
}

.login-page {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #e8f2ff;
  padding: 0;
  overflow: hidden;
}

.login-page::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 58%;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 900' fill='none'%3E%3Ccircle cx='90' cy='140' r='180' stroke='%234c6fff' stroke-opacity='0.16' stroke-width='1.2'/%3E%3Ccircle cx='620' cy='760' r='220' stroke='%232563eb' stroke-opacity='0.1' stroke-width='1.2'/%3E%3Cpath d='M-20 520C140 430 220 610 420 500C560 420 640 470 820 360' stroke='%234c6fff' stroke-opacity='0.14' stroke-width='1.4'/%3E%3Cpath d='M40 240C180 300 260 180 420 250' stroke='%232563eb' stroke-opacity='0.1' stroke-width='1'/%3E%3Crect x='520' y='120' width='90' height='90' rx='18' stroke='%234c6fff' stroke-opacity='0.12' stroke-width='1'/%3E%3Ccircle cx='250' cy='680' r='4' fill='%234c6fff' fill-opacity='0.16'/%3E%3Ccircle cx='470' cy='180' r='3' fill='%232563eb' fill-opacity='0.14'/%3E%3Ccircle cx='560' cy='420' r='3' fill='%234c6fff' fill-opacity='0.12'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left center;
  background-size: cover;
}

.login-layout,
.login-footer {
  position: relative;
  z-index: 1;
}

.login-layout {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 48px;
  width: min(1120px, calc(100% - 80px));
  margin: 0 auto;
  padding: 160px 0 32px;
  background: #e8f2ff;
}

.login-hero {
  flex: 1;
  min-width: 0;
  color: #1d2129;
}

.login-brand {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.login-hero h1 {
  margin: 28px 0 16px;
  font-size: 40px;
  line-height: 1.25;
  font-weight: 700;
}

.login-hero p {
  margin: 0;
  max-width: 460px;
  font-size: 16px;
  line-height: 1.7;
  color: #4e5969;
}

.login-panel {
  flex: 0 0 400px;
}

.login-card {
  width: 100%;
  background: #fff;
  border-radius: 12px;
  padding: 28px 28px 24px;
  box-shadow: 0 8px 32px rgba(31, 56, 108, 0.08);
}

.login-logo {
  display: inline-block;
  margin: 0 0 18px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.22em;
  line-height: 1;
  color: #1d4ed8;
}

.login-logo::after {
  content: "";
  display: block;
  width: 36px;
  height: 3px;
  margin-top: 10px;
  border-radius: 2px;
  background: #4c6fff;
}

.login-tabs {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin-bottom: 8px;
}

.login-tab {
  position: relative;
  font-size: 18px;
  font-weight: 600;
  color: #86909c;
  padding-bottom: 8px;
  text-decoration: none;
}

a.login-tab.is-active {
  color: #1d2129;
}

.login-tab.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 24px;
  height: 3px;
  border-radius: 2px;
  background: #4c6fff;
  transform: translateX(-50%);
}

.login-card-tip {
  margin: 10px 0 0;
  text-align: right;
  color: #86909c;
  font-size: 12px;
}

.login-legal {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  margin: 16px 0 0;
  text-align: left;
  color: #86909c;
  font-size: 12px;
}

.login-agree {
  display: inline-flex;
  align-items: center;
}

.login-agree input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: #4c6fff;
}

.login-legal a {
  color: #4c6fff;
  text-decoration: none;
}

.login-legal a:hover {
  text-decoration: underline;
}

.legal-body {
  background: #f3f5f9;
}

.legal-page {
  display: flex;
  min-height: 100vh;
}

.legal-nav {
  width: 208px;
  flex-shrink: 0;
  background: #1a1a2e;
  color: #ecf0f1;
  padding: 28px 16px;
}

.legal-brand {
  display: block;
  margin: 0 8px 24px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
}

.legal-nav a:not(.legal-brand) {
  display: block;
  margin-bottom: 4px;
  padding: 10px 12px;
  border-radius: 8px;
  color: rgba(236, 240, 241, 0.72);
  text-decoration: none;
  font-size: 14px;
}

.legal-nav a.is-active,
.legal-nav a:not(.legal-brand):hover {
  background: rgba(236, 240, 241, 0.12);
  color: #fff;
}

.legal-main {
  flex: 1;
  max-width: 760px;
  padding: 40px 48px 64px;
}

.legal-main h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.legal-meta {
  margin: 0 0 20px;
  color: #6b7280;
  font-size: 13px;
}

.legal-main h2 {
  margin: 28px 0 8px;
  font-size: 16px;
}

.legal-main p,
.legal-main li {
  color: #303030;
  font-size: 14px;
  line-height: 1.75;
}

.legal-main ul {
  margin: 8px 0 0;
  padding-left: 1.2em;
}

.login-card .form-field {
  margin-bottom: 16px;
}

.login-card .form-field input {
  height: 44px;
  border-radius: 4px;
  border-color: #e5e6eb;
  background: #fff;
  color: #1d2129;
}

.login-card .form-field input::placeholder {
  color: #c9cdd4;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  top: 0;
  right: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: #86909c;
  cursor: pointer;
}

.password-toggle svg {
  width: 20px;
  height: 20px;
}

.password-toggle .eye-shut,
.password-toggle.is-visible .eye-open {
  display: none;
}

.password-toggle.is-visible .eye-shut {
  display: inline;
}

.password-toggle:hover {
  color: #4c6fff;
}

.code-field {
  position: relative;
}

.code-field input {
  padding-right: 108px;
}

.code-btn {
  position: absolute;
  top: 0;
  right: 0;
  height: 44px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: #4c6fff;
  font-size: 14px;
  cursor: pointer;
}

.code-btn:disabled {
  color: #86909c;
  cursor: default;
}

.code-hint {
  margin: -8px 0 12px;
  font-size: 12px;
  color: #86909c;
}

.login-submit {
  width: 100%;
  height: 44px;
  margin-top: 8px;
  border: 0;
  border-radius: 4px;
  background: #5b7cff;
  color: #fff;
  font-size: 16px;
  justify-content: center;
}

.login-submit:hover {
  background: #3d63f5;
}

.login-footer {
  padding: 16px 24px 20px;
  text-align: center;
  font-size: 12px;
  color: #86909c;
}

.login-footer a {
  color: #86909c;
}

.login-footer a:hover {
  color: #4c6fff;
}

@media (max-width: 900px) {
  .login-layout {
    flex-direction: column;
    justify-content: center;
    width: min(440px, calc(100% - 32px));
    gap: 28px;
    padding-top: 160px;
  }

  .login-hero {
    text-align: center;
  }

  .login-logo::after {
    margin-left: auto;
    margin-right: auto;
  }

  .login-hero h1 {
    font-size: 28px;
  }

  .login-hero p {
    margin: 0 auto;
  }

  .login-panel {
    flex-basis: auto;
    width: 100%;
  }
}

.form-field {
  margin-bottom: 14px;
}

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

.form-field input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
}

.form-error {
  background: #fdecea;
  color: var(--danger);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  margin-bottom: 12px;
}

.login-card .btn-primary {
  width: 100%;
  height: 40px;
  margin-top: 6px;
}

.login-links {
  margin: 14px 0 0;
  text-align: center;
  font-size: 13px;
}

.login-links a {
  color: var(--primary);
}

.form-note {
  background: var(--info-bg);
  color: var(--info);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  margin-bottom: 12px;
}

.settings-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  max-width: 640px;
}

.settings-desc {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.settings-card .form-field-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.amount-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-field .switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.form-field .switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  opacity: 0;
}

.switch-track {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: #d1d5db;
  transition: background 0.15s ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.2);
  transition: transform 0.15s ease;
}

.form-field .switch input:checked + .switch-track {
  background: #2563eb;
}

.form-field .switch input:checked + .switch-track::after {
  transform: translateX(18px);
}

.form-field .switch input:focus-visible + .switch-track {
  outline: 2px solid rgba(37, 99, 235, 0.45);
  outline-offset: 2px;
}

.switch-text {
  font-size: 13px;
  line-height: 22px;
  color: var(--muted);
}

.form-field .switch input:checked ~ .switch-text {
  color: #2563eb;
  font-weight: 600;
}

.flash-list {
  list-style: none;
  margin: 12px 20px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flash {
  background: var(--success-bg);
  color: var(--success);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
}

.flash.error {
  background: #fdecea;
  color: var(--danger);
}

.flash.warning,
.flash.info {
  background: var(--warning-bg);
  color: var(--warning);
}

.password-banner {
  margin: 12px 20px 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 13px;
}

.password-banner a {
  color: inherit;
  font-weight: 600;
}

.goods-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  display: block;
  background: #eef1f4;
}

.goods-thumb-empty {
  border: 1px solid var(--border);
}

.analysis-date {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.analysis-hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.sales-hero {
  grid-template-columns: repeat(4, 1fr);
}

.analysis-metric {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.analysis-metric:first-child {
  background: #1a1a2e;
  border-color: #1a1a2e;
  color: #fff;
}

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

.analysis-metric:first-child .analysis-metric-label,
.analysis-metric:first-child .analysis-metric-note {
  color: rgba(255, 255, 255, 0.72);
}

.analysis-metric-value {
  margin-top: 8px;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

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

.analysis-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px 8px;
}

.analysis-panel h2 {
  margin: 0 0 14px;
  font-size: 15px;
}

.analysis-bars {
  list-style: none;
  margin: 0;
  padding: 0;
}

.analysis-bars li {
  margin-bottom: 14px;
}

.analysis-bar-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 13px;
}

.analysis-bar-head span:last-child {
  color: var(--muted);
}

.analysis-bar-track {
  height: 8px;
  border-radius: 999px;
  background: #eef1f4;
  overflow: hidden;
}

.analysis-bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #2c3e50;
}

.analysis-empty {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

/* 胶囊开关：开启蓝 / 关闭灰 */
.switch-capsule {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  vertical-align: middle;
}

.switch-capsule input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.switch-capsule-track {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #c4c9d4;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.switch-capsule-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.2);
  transition: transform 0.2s ease;
}

.switch-capsule input:checked + .switch-capsule-track {
  background: #2563eb;
}

.switch-capsule input:checked + .switch-capsule-track .switch-capsule-knob {
  transform: translateX(20px);
}

.switch-capsule input:focus-visible + .switch-capsule-track {
  outline: 2px solid rgba(37, 99, 235, 0.45);
  outline-offset: 2px;
}

.switch-capsule-text {
  font-size: 13px;
  color: var(--muted);
  min-width: 2em;
}

.switch-capsule-text.is-on {
  display: none;
  color: #2563eb;
  font-weight: 600;
}

.switch-capsule input:checked ~ .switch-capsule-text.is-on {
  display: inline;
}

.switch-capsule input:checked ~ .switch-capsule-text.is-off {
  display: none;
}

.erp-dialog {
  border: none;
  padding: 0;
  background: transparent;
  max-width: calc(100vw - 32px);
}

.erp-dialog::backdrop {
  background: rgba(15, 18, 32, 0.45);
}

.erp-dialog-card {
  width: min(420px, calc(100vw - 32px));
  margin: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(16, 24, 40, 0.18);
  overflow: hidden;
}

.erp-dialog-header {
  padding: 18px 20px 10px;
}

.erp-dialog-header h2 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
}

.erp-dialog-header .muted {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.erp-dialog-body {
  padding: 4px 12px 12px;
  max-height: min(360px, 50vh);
  overflow: auto;
}

.erp-dialog-shop-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.erp-dialog-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}

.erp-dialog-check:hover {
  background: var(--primary-soft);
}

.erp-dialog-check-all {
  margin-bottom: 4px;
  font-weight: 600;
}

.erp-dialog-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.erp-dialog-body .empty-hint {
  margin: 8px;
  padding: 16px 12px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.erp-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
}

@media (max-width: 1200px) {
  .stats-row,
  .analysis-hero {
    grid-template-columns: 1fr;
  }
  .detail-panel {
    display: none;
  }
}

@media (max-width: 900px) {
  .sidebar {
    display: none;
  }
  .stats-row {
    grid-template-columns: 1fr;
  }
  .amount-row {
    grid-template-columns: 1fr;
  }
  .detail-fields {
    grid-template-columns: 96px minmax(0, 1fr);
  }
  .detail-fields dd.is-wide {
    grid-column: auto;
  }
  .detail-fields dd.is-full {
    grid-column: 1 / -1;
  }
  .aftersale-goods-pay {
    margin-left: 0;
  }
}
