:root {
  --st-bg: #ffffff;
  --st-app-bg: #f7f9fc;
  --st-border: #e6eaf1;
  --st-text: #262730;
  --st-muted: #6c7383;
  --st-primary: #ff4b4b;
  --st-primary-hover: #ff2f2f;
  --st-focus: #9ec5ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  background: var(--st-app-bg);
  color: var(--st-text);
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2.5rem;
}

h1,
h2,
h3 {
  margin: 0 0 0.55rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 2rem;
  margin-bottom: 0.35rem;
}

h2 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

h3 {
  font-size: 1rem;
  color: #31333f;
}

label {
  display: inline-flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 500;
  color: #31333f;
}

.card {
  background: var(--st-bg);
  border: 1px solid var(--st-border);
  border-radius: 0.5rem;
  padding: 1rem 1rem 1.1rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.02), 0 8px 24px rgba(15, 23, 42, 0.04);
}

.notice {
  margin: 0 0 1rem;
  color: #0f172a;
  background: #f0f8ff;
  border: 1px solid #d6ebff;
  border-radius: 0.5rem;
  padding: 0.65rem 0.8rem;
}

.controls {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

input[type="number"],
input[type="text"],
input[type="file"],
textarea {
  width: 100%;
  min-height: 2.35rem;
  border: 1px solid var(--st-border);
  border-radius: 0.5rem;
  padding: 0.45rem 0.65rem;
  background: #fff;
  color: var(--st-text);
  outline: none;
}

textarea {
  min-height: 5rem;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: #7db6ff;
  box-shadow: 0 0 0 0.2rem rgba(125, 182, 255, 0.25);
}

.file-label {
  min-width: 280px;
}

button {
  border: 1px solid transparent;
  background: var(--st-primary);
  color: #fff;
  border-radius: 0.5rem;
  min-height: 2.35rem;
  padding: 0.45rem 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background-color 0.12s ease, transform 0.08s ease;
}

button:hover {
  background: var(--st-primary-hover);
}

button:active {
  transform: translateY(1px);
}

button:focus-visible {
  outline: 2px solid var(--st-focus);
  outline-offset: 2px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
  font-size: 0.82rem;
  background: #fff;
}

th,
td {
  border: 1px solid #edf1f7;
  padding: 0.38rem 0.45rem;
  text-align: center;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafd;
  color: #31333f;
  font-weight: 600;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--st-border);
  border-radius: 0.5rem;
  background: #fff;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.chart {
  border: 1px solid var(--st-border);
  border-radius: 0.5rem;
  padding: 0.65rem;
  background: #fff;
}

.scale-chart-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.35rem;
}

.chart-shell {
  border: 1px solid #e8eef7;
  border-radius: 0.5rem;
  padding: 0.45rem 0.55rem 0.25rem;
  margin-bottom: 0.5rem;
  background: #ffffff;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.74rem;
  color: #475467;
  background: #f8fafc;
  border: 1px solid #e8edf4;
  border-radius: 999px;
  padding: 0.18rem 0.5rem;
}

.legend-item.legend-toggle {
  cursor: pointer;
  user-select: none;
}

.legend-item.legend-toggle:focus-visible {
  outline: 2px solid var(--st-focus);
  outline-offset: 2px;
}

.legend-item.is-off {
  opacity: 0.45;
}

.legend-line {
  width: 18px;
  height: 4px;
  border-radius: 999px;
  display: inline-block;
  background: var(--series-color, #2563eb);
  border-bottom: 2px solid var(--series-color, #2563eb);
}

.legend-line.dashed {
  background: transparent;
  border-bottom-style: dashed;
}

.chart-svg .series-line {
  stroke: var(--series-color, #2563eb);
}

.chart-svg .series-line.dashed {
  stroke-dasharray: 6 5;
}

.chart-svg .series-point {
  fill: var(--series-color, #2563eb);
}

.series-color-0 { --series-color: #2563eb; color: #2563eb; }
.series-color-1 { --series-color: #dc2626; color: #dc2626; }
.series-color-2 { --series-color: #059669; color: #059669; }
.series-color-3 { --series-color: #7c3aed; color: #7c3aed; }
.series-color-4 { --series-color: #d97706; color: #d97706; }
.series-color-5 { --series-color: #0891b2; color: #0891b2; }
.series-color-6 { --series-color: #be185d; color: #be185d; }
.series-color-7 { --series-color: #334155; color: #334155; }
.series-color-muted { --series-color: #6b7280; color: #6b7280; }

.table-wrap.spaced {
  margin-bottom: 0.8rem;
}

.small {
  font-size: 0.78rem;
  color: var(--st-muted);
}

.site-footer {
  margin-top: 0.5rem;
}

.disclaimer-card h2 {
  margin-bottom: 0.45rem;
}

.disclaimer-card .small {
  margin: 0 0 0.45rem;
}

.disclaimer-card .small:last-child {
  margin-bottom: 0;
}

.pdf-render-host {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 1160px;
  background: #ffffff;
  z-index: -1;
}

.pdf-render-root {
  max-width: 1160px;
  padding: 0;
}

@media (max-width: 760px) {
  .container {
    padding: 0.9rem 0.75rem 1.25rem;
  }

  h1 {
    font-size: 1.55rem;
  }

  .controls {
    gap: 0.5rem;
  }

  button,
  input[type="number"],
  input[type="text"],
  input[type="file"],
  textarea {
    width: 100%;
  }
}

@media print {
  body {
    background: #ffffff;
    font-size: 12px;
  }

  .container {
    max-width: none;
    padding: 0;
  }

  .no-print {
    display: none !important;
  }

  .card {
    box-shadow: none;
    break-inside: avoid-page;
    page-break-inside: avoid;
    margin-bottom: 0.7rem;
  }

  .chart,
  .chart-shell,
  .table-wrap {
    break-inside: avoid-page;
    page-break-inside: avoid;
  }

  .chart-svg {
    max-width: 100% !important;
  }

  button,
  input,
  textarea {
    display: none !important;
  }
}
