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

* {
  margin: 0;
}

html {
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans JP", sans-serif;
  background-color: #0f172a;
  color: #e2e8f0;
}

body {
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

header {
  padding: 1.5rem 0;
  border-bottom: 1px solid #1e293b;
  margin-bottom: 1.5rem;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #f8fafc;
}

header p {
  font-size: 0.875rem;
  color: #94a3b8;
  margin-top: 0.25rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: #1e293b;
  border-radius: 0.5rem;
  padding: 1rem;
  grid-column: span 2;
}

.stat-card .label {
  font-size: 0.75rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card .value {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 0.25rem;
  font-variant-numeric: tabular-nums;
}

.stat-card .value.negative {
  color: #f87171;
}

.stat-card .value.positive {
  color: #4ade80;
}

.stat-card .sub {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.25rem;
}

.stat-card--hero {
  grid-column: 1 / -1;
  text-align: center;
  padding: 1.5rem 1rem;
}

.stat-card--hero .value {
  font-size: 3rem;
}

.stat-card--hero .label {
  font-size: 0.875rem;
}

.chart-container {
  background: #1e293b;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.chart-container h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #f8fafc;
}

.chart-wrapper {
  width: 100%;
  overflow-x: auto;
}

canvas {
  width: 100% !important;
  height: 400px !important;
}

.table-container {
  background: #1e293b;
  border-radius: 0.5rem;
  padding: 1rem;
  overflow-x: auto;
}

.table-container h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #f8fafc;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th {
  text-align: left;
  padding: 0.5rem;
  color: #94a3b8;
  border-bottom: 1px solid #334155;
  font-weight: 600;
}

td {
  padding: 0.5rem;
  border-bottom: 1px solid #1e293b;
  font-variant-numeric: tabular-nums;
}

tr:hover td {
  background: #334155;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  color: #94a3b8;
  font-size: 1.125rem;
}

.spinner {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  border: 3px solid #334155;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 0.75rem;
}

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

.error-message {
  background: #7f1d1d;
  color: #fca5a5;
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

footer {
  padding: 1.5rem 0;
  border-top: 1px solid #1e293b;
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: #64748b;
}
