* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: #333;
  background: #f0f2f5;
}

/* 登录页 */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
  background: #fff;
  padding: 40px;
  border-radius: 8px;
  width: 380px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.login-box h1 {
  font-size: 22px;
  text-align: center;
  margin-bottom: 4px;
}

.login-box .subtitle {
  text-align: center;
  color: #999;
  margin-bottom: 28px;
}

/* 布局 */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  background: #001529;
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.nav-groups { flex: 1; padding: 8px 0; overflow-y: auto; }
.nav-group { margin-bottom: 8px; }
.nav-group-title {
  padding: 8px 20px 4px;
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.logo {
  padding: 20px 16px;
  font-size: 16px;
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar nav {
  flex: 1;
  padding: 12px 0;
}

.nav-item {
  display: block;
  padding: 12px 20px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  transition: all 0.2s;
}

.nav-item:hover,
.nav-item.active {
  color: #fff;
  background: #1890ff;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.main {
  flex: 1;
  padding: 24px;
  overflow: auto;
}

.page { display: none; }
.page.active { display: block; }

.page h2 {
  font-size: 20px;
  margin-bottom: 20px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-header h2 { margin-bottom: 0; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stats-grid.secondary {
  grid-template-columns: repeat(4, 1fr);
}

.stat-card {
  background: #fff;
  border-radius: 6px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.stat-card.small .stat-value { font-size: 24px; }

.stat-label {
  color: #999;
  font-size: 13px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 600;
  color: #1890ff;
}

/* 表单 */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  color: #666;
  font-size: 13px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-size: 14px;
  outline: none;
}

.form-group input:focus,
.form-group select:focus {
  border-color: #1890ff;
  box-shadow: 0 0 0 2px rgba(24,144,255,0.2);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.form-box {
  background: #fff;
  padding: 20px;
  border-radius: 6px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.form-box h3 {
  font-size: 15px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0f0f0;
}

.form-actions {
  display: flex;
  gap: 8px;
}

.hidden { display: none !important; }

/* 按钮 */
.btn {
  padding: 8px 16px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.btn:hover { border-color: #1890ff; color: #1890ff; }

.btn-primary {
  background: #1890ff;
  border-color: #1890ff;
  color: #fff;
}

.btn-primary:hover {
  background: #40a9ff;
  border-color: #40a9ff;
  color: #fff;
}

.btn-block { width: 100%; }

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  background: transparent;
  border-color: rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.85);
}

.btn-sm:hover {
  border-color: #fff;
  color: #fff;
}

/* 表格 */
.table-wrap {
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead { background: #fafafa; }

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
}

th {
  font-weight: 600;
  color: #666;
  font-size: 13px;
}

td.empty {
  text-align: center;
  color: #999;
  padding: 32px;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.tag-green { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.tag-red { background: #fff2f0; color: #ff4d4f; border: 1px solid #ffccc7; }
.tag-orange { background: #fff7e6; color: #fa8c16; border: 1px solid #ffd591; }

.main .btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  background: #fff;
  border-color: #d9d9d9;
  color: #333;
}
.main .btn-sm:hover { border-color: #1890ff; color: #1890ff; }
.btn-danger { background: #ff4d4f; border-color: #ff4d4f; color: #fff; }
.btn-danger:hover { background: #ff7875; color: #fff; }

.card {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  margin-top: 16px;
  overflow: hidden;
}
.card-header { padding: 16px 20px; border-bottom: 1px solid #f0f0f0; }
.card-header h3 { font-size: 15px; margin: 0; }

.stat-sub { font-size: 12px; color: #999; margin-top: 4px; }

.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 24px 20px;
  min-height: 160px;
}
.trend-bar-wrap { flex: 1; text-align: center; }
.trend-bar {
  background: linear-gradient(180deg, #1890ff, #69c0ff);
  border-radius: 4px 4px 0 0;
  margin: 0 auto 6px;
  width: 80%;
  min-height: 4px;
}
.trend-label { font-size: 11px; color: #999; }
.trend-val { font-size: 11px; color: #666; }

.filters { display: flex; gap: 8px; align-items: center; }
.filters input, .page-header select, .page-header input[type=month] {
  padding: 6px 10px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-size: 13px;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.config-section {
  background: #fff;
  padding: 20px;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.config-section h3 { font-size: 15px; margin-bottom: 12px; color: #333; }
.config-section p { margin-bottom: 6px; color: #666; line-height: 1.6; }
.config-section ul { padding-left: 20px; color: #666; }
.config-section li { margin-bottom: 4px; }

.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}

.mono { font-family: Consolas, monospace; font-size: 12px; }
.small { font-size: 12px; }

.error-msg {
  color: #ff4d4f;
  font-size: 13px;
  margin-bottom: 12px;
  min-height: 20px;
}

.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  background: #333;
  color: #fff;
  padding: 12px 20px;
  border-radius: 4px;
  z-index: 9999;
  transition: opacity 0.3s;
}

.toast.success { background: #52c41a; }
.toast.error { background: #ff4d4f; }

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .sidebar { width: 160px; }
}

.channel-coupon-panel { margin-bottom: 20px; padding: 16px 20px; background: #fff; border-radius: 8px; }
.channel-coupon-grid { display: grid; gap: 14px; margin-top: 16px; }
.channel-coupon-card {
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 14px 16px;
  background: #fafafa;
}
.channel-coupon-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  font-weight: 600;
}
.channel-coupon-head label { display: flex; align-items: center; gap: 8px; cursor: pointer; }

.finance-filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.finance-filters select,
.finance-filters input[type="date"],
.finance-filters input[type="month"] {
  padding: 6px 10px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-size: 14px;
}
.period-filter { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.period-filter select, .period-filter input[type="date"], .period-filter input[type="month"] {
  padding: 6px 10px; border: 1px solid #d9d9d9; border-radius: 4px; font-size: 14px;
}
.flow-summary { margin: 12px 0 16px; }
.flow-summary-hint { margin: 0 0 10px; color: #888; font-size: 13px; }
