/* ===== 全局重置 & 字体 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: #f1f5f9;
  color: #0f172a;
  padding: 24px;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.app-container {
  max-width: 1320px;
  width: 100%;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
  padding: 32px 36px 40px;
  transition: all 0.2s;
}

/* ===== 标题 ===== */
.app-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  border-bottom: 2px solid #eef2f6;
  padding-bottom: 20px;
}
.app-header .icon {
  font-size: 32px;
  line-height: 1;
}
.app-header h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #0f172a;
}
.app-header .badge {
  margin-left: auto;
  background: #eef2ff;
  color: #4f46e5;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 16px;
  border-radius: 30px;
  letter-spacing: 0.3px;
}

/* ===== 主体网格 ===== */
.main-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 28px;
  margin-bottom: 28px;
}

/* ===== 输入面板 ===== */
.input-panel {
  background: #f8fafc;
  border-radius: 18px;
  padding: 22px 24px 26px;
  border: 1px solid #e9edf2;
}
.input-panel h2 {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.input-panel h2 span {
  font-size: 18px;
}

.input-group {
  margin-bottom: 16px;
}
.input-group label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
  color: #334155;
  margin-bottom: 4px;
}
.input-group label .unit {
  font-weight: 400;
  color: #94a3b8;
  font-size: 12px;
}
.input-group .hint {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
  padding-left: 2px;
}

.input-group input {
  width: 100%;
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 500;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  color: #0f172a;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  outline: none;
}
.input-group input:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}
.input-group input:hover {
  border-color: #cbd5e1;
}
.input-group input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}
.input-group input[type="number"] {
  -moz-appearance: textfield;
}
.input-row-duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.input-row-duo .input-group {
  margin-bottom: 0;
}

/* ===== 结果面板 ===== */
.result-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-cards {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}
.result-card {
  background: #f8fafc;
  border-radius: 16px;
  padding: 18px 20px 16px;
  border: 1px solid #e9edf2;
  transition: background 0.15s;
}
.result-card .label {
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.result-card .value {
  font-size: 28px;
  font-weight: 700;
  color: #0f172a;
  margin-top: 4px;
  letter-spacing: -0.5px;
  line-height: 1.2;
}
.result-card .value .currency {
  font-size: 16px;
  font-weight: 500;
  color: #94a3b8;
  margin-left: 4px;
}
.result-card .sub {
  font-size: 13px;
  color: #94a3b8;
  margin-top: 4px;
}
.result-card.highlight {
  background: #eef2ff;
  border-color: #c7d2fe;
}
.result-card.highlight .value {
  color: #4f46e5;
}
.result-card .trend {
  font-size: 13px;
  font-weight: 500;
  margin-top: 4px;
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  background: #dcfce7;
  color: #166534;
}

.result-detail-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-top: 4px;
}
.result-detail-item {
  background: #ffffff;
  border-radius: 12px;
  padding: 12px 16px;
  border: 1px solid #e9edf2;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.result-detail-item .label {
  font-size: 13px;
  color: #64748b;
}
.result-detail-item .value {
  font-size: 16px;
  font-weight: 600;
  color: #0f172a;
}

/* ===== 图表容器 ===== */
.chart-section {
  margin-top: 8px;
  border-top: 2px solid #eef2f6;
  padding-top: 24px;
}
.chart-section .chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.chart-section .chart-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
}
.chart-section .chart-header .legend-tip {
  font-size: 13px;
  color: #94a3b8;
}
.chart-wrapper {
  position: relative;
  height: 340px;
}

/* ===== 数据表格 ===== */
.table-section {
  margin-top: 20px;
  border-top: 2px solid #eef2f6;
  padding-top: 20px;
}
.table-section .table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.table-section .table-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
}
.table-section .table-header .count {
  font-size: 13px;
  color: #94a3b8;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid #e9edf2;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 500px;
}
table thead {
  background: #f8fafc;
  border-bottom: 1px solid #e9edf2;
}
table th {
  padding: 12px 16px;
  text-align: right;
  font-weight: 600;
  color: #475569;
  font-size: 12px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
table th:first-child {
  text-align: center;
}
table td {
  padding: 10px 16px;
  text-align: right;
  border-bottom: 1px solid #f1f5f9;
  font-variant-numeric: tabular-nums;
}
table td:first-child {
  text-align: center;
  font-weight: 500;
  color: #475569;
}
table tbody tr:hover {
  background: #f8fafc;
}
table tbody tr:last-child td {
  border-bottom: none;
}
table .highlight-row td {
  background: #eef2ff;
  font-weight: 600;
  color: #4f46e5;
}
table .highlight-row td:first-child {
  color: #4f46e5;
}

.text-muted {
  color: #94a3b8;
}

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
  .app-container {
    padding: 24px 20px 32px;
  }
  .main-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .input-panel {
    padding: 18px 20px 22px;
  }
}

@media (max-width: 640px) {
  body {
    padding: 12px;
  }
  .app-container {
    padding: 18px 14px 24px;
    border-radius: 18px;
  }
  .app-header h1 {
    font-size: 20px;
  }
  .app-header .badge {
    font-size: 11px;
    padding: 3px 12px;
  }
  .result-cards {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .result-detail-row {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .result-card .value {
    font-size: 22px;
  }
  .input-row-duo {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .chart-wrapper {
    height: 240px;
  }
  table {
    font-size: 12px;
    min-width: 380px;
  }
  table th,
  table td {
    padding: 8px 10px;
  }
  .main-grid {
    gap: 16px;
  }
  .input-panel {
    padding: 14px 16px 18px;
  }
}

@media (max-width: 400px) {
  .result-detail-row {
    grid-template-columns: 1fr;
  }
  .app-header .icon {
    font-size: 24px;
  }
  .app-header h1 {
    font-size: 17px;
  }
}

/* ===== 小工具 ===== */
.mt-1 {
  margin-top: 6px;
}
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.gap-1 {
  gap: 6px;
}
