* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f4f7fb;
  color: #1f2a37;
}

.login-panel {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0d1b2a 0%, #1b2838 100%);
}

.login-box {
  width: 100%;
  max-width: 360px;
  padding: 32px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.login-title {
  margin: 0 0 8px;
  font-size: 22px;
  color: #0d1b2a;
  text-align: center;
}

.login-desc {
  margin: 0 0 24px;
  font-size: 13px;
  color: #64748b;
  text-align: center;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-field label {
  font-size: 13px;
  color: #475569;
}

.login-form .input {
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
}

.login-form .input:focus {
  outline: none;
  border-color: #0ea5e9;
}

.login-submit {
  margin-top: 8px;
  padding: 10px 16px;
  font-size: 15px;
}

.logout-btn {
  margin-left: auto;
  background: transparent;
  color: #94a3b8;
  border: 1px solid #475569;
}

.logout-btn:hover {
  color: #fff;
  background: #475569;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #0d1b2a;
  color: #fff;
  padding: 12px 16px;
  display: flex;
  gap: 16px;
  align-items: center;
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
}

.app-wrap {
  display: flex;
  min-height: calc(100vh - 52px);
}

.sidebar {
  width: 180px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  padding: 16px 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  border: none;
  background: transparent;
  color: #475569;
  font-size: 14px;
  cursor: pointer;
  border-left: 3px solid transparent;
  margin-left: 0;
}

.nav-item:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.nav-item.active {
  background: #eff6ff;
  color: #0ea5e9;
  border-left-color: #0ea5e9;
  font-weight: 600;
}

.main-content {
  flex: 1;
  padding: 20px;
  overflow: auto;
  background: #f4f7fb;
}

.view-content {
  max-width: 1200px;
  margin: 0 auto;
}

/* 订单总览首页 */
.dashboard-section {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}

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

.section-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  padding-left: 8px;
  border-left: 3px solid #dc2626;
}

.section-time {
  font-size: 13px;
  color: #64748b;
}

.section-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: #475569;
}

.section-summary strong {
  color: #1e293b;
}

.link-btn {
  background: none;
  border: none;
  color: #0ea5e9;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
}

.link-btn:hover {
  text-decoration: underline;
}

.realtime-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.realtime-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
}

.realtime-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-bottom: 10px;
}

.realtime-card-icon.icon-pink { background: #fce7f3; }
.realtime-card-icon.icon-green { background: #d1fae5; }
.realtime-card-icon.icon-blue { background: #dbeafe; }
.realtime-card-icon.icon-orange { background: #ffedd5; }

.realtime-card-label {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 6px;
}

.realtime-card-value {
  font-size: 24px;
  font-weight: 700;
  color: #1e293b;
}

.realtime-card-yesterday {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 6px;
}

.week-chart-wrap {
  min-height: 220px;
}

.week-chart {
  min-height: 200px;
}

.week-chart-svg {
  display: block;
}

.week-chart-axis-label {
  font-size: 11px;
  fill: #64748b;
}

.week-chart-legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 12px;
  color: #64748b;
}

.week-chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.week-chart-legend-item i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.layout {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px;
}

.panel-title {
  font-weight: 700;
  margin-bottom: 10px;
}

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

.input {
  border: 1px solid #cfd8e3;
  background: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 160px;
}

.token {
  min-width: 240px;
}

.btn {
  border: 0;
  border-radius: 8px;
  background: #334155;
  color: #fff;
  padding: 8px 12px;
  cursor: pointer;
}

.btn.primary {
  background: #0ea5e9;
}

.btn.danger {
  background: #dc2626;
}

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

.table th,
.table td {
  border-bottom: 1px solid #edf2f7;
  text-align: left;
  padding: 8px;
  font-size: 13px;
}

.table th {
  background: #f8fafc;
}

.table .col-thumb {
  width: 56px;
  text-align: center;
}

.product-thumb {
  display: inline-block;
  max-width: 44px;
  max-height: 44px;
  object-fit: cover;
  border-radius: 4px;
  vertical-align: middle;
}

.code {
  background: #0f172a;
  color: #cbd5e1;
  min-height: 120px;
  padding: 10px;
  border-radius: 8px;
  overflow: auto;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #111827;
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.kpi {
  min-width: 160px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
}

.kpi-label {
  color: #64748b;
  font-size: 12px;
}

.kpi-value {
  margin-top: 6px;
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
}

.label-inline {
  align-self: center;
  color: #334155;
}

.form-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  align-items: center;
  max-width: 720px;
}

.form-label {
  color: #475569;
  font-size: 13px;
}

.form-inline {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.form-inline .input {
  flex: 0 0 auto;
}

.hint {
  align-self: center;
  color: #64748b;
  font-size: 12px;
}

.hint-sm {
  margin: 4px 0 8px;
  font-size: 12px;
}

.gap-8 {
  gap: 8px;
}

.row.region-select-row {
  align-items: flex-start;
}

.region-wrap {
  margin-top: 10px;
  border-top: 1px dashed #dbe3ed;
  padding-top: 10px;
}

.region-select {
  min-width: 220px;
  height: 180px;
  overflow: auto;
}

.chip-list {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  background: #e2e8f0;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}

.chip-del {
  margin-left: 6px;
  border: none;
  border-radius: 999px;
  width: 16px;
  height: 16px;
  line-height: 14px;
  background: #334155;
  color: #fff;
  cursor: pointer;
  font-size: 11px;
}

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

.row.gap-8 {
  gap: 8px;
}

.btn-outline {
  background: transparent;
  color: #334155;
  border: 1px solid #94a3b8;
}

.btn-outline:hover {
  background: #f1f5f9;
}

.col-check {
  width: 36px;
  text-align: center;
}

.table .col-check input {
  cursor: pointer;
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}

.status-badge.status-0 { background: #fef3c7; color: #92400e; }
.status-badge.status-1 { background: #dbeafe; color: #1e40af; }
.status-badge.status-2 { background: #e0e7ff; color: #3730a3; }
.status-badge.status-3 { background: #d1fae5; color: #065f46; }
.status-badge.status-4 { background: #f3f4f6; color: #6b7280; }

/* 订单详情卡片 */
.order-detail-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.order-detail-sections {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.order-detail-section {
  background: #fff;
  border-radius: 10px;
  padding: 14px 16px;
  border: 1px solid #e5e7eb;
}

.order-detail-section h4 {
  margin: 0 0 12px 0;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  letter-spacing: 0.02em;
}

.order-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px 20px;
}

.order-detail-item {
  min-width: 0;
}

.order-detail-item.full-width {
  grid-column: 1 / -1;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.order-detail-label {
  display: block;
  font-size: 11px;
  color: #64748b;
  margin-bottom: 2px;
}

.order-detail-value {
  font-size: 13px;
  color: #1e293b;
}

.order-detail-value.mono {
  font-family: ui-monospace, monospace;
  font-size: 12px;
}

.order-detail-cover {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.order-detail-meta {
  display: block;
  font-size: 11px;
  color: #64748b;
  margin-top: 4px;
}

.order-json-details {
  margin-top: 12px;
  font-size: 12px;
}

.order-json-details summary {
  cursor: pointer;
  color: #64748b;
  padding: 6px 0;
}

.order-json-details .code {
  margin-top: 8px;
  max-height: 240px;
}
