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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background-color: #ebeef2;
  color: #1f2933;
}

body {
  min-height: 100vh;
}

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

.app-header {
  height: 72px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  background-color: #ffffff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
  position: sticky;
  top: 0;
  z-index: 10;
  justify-content: center;
}

.menu-toggle {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: none;
  background: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-right: 8px;
}

.menu-icon {
  width: 18px;
  height: 2px;
  background-color: #111827;
  position: relative;
}

.menu-icon::before,
.menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background-color: #111827;
}

.menu-icon::before {
  top: -6px;
}

.menu-icon::after {
  top: 6px;
}

.app-brand {
  display: flex;
  align-items: center;
  margin: 0 auto;
}

.app-logo {
  width: 32px;
  height: 32px;
  margin-right: 10px;
  object-fit: contain;
}

.app-title {
  font-size: 22px;
  font-weight: 700;
}

.app-main {
  flex: 1;
  display: flex;
  min-height: 0;
}

.sidebar {
  width: 400px;
  max-width: 360px;
  min-width: 280px;
  background-color: #f9fafb;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
}

.sidebar-scroll {
  overflow-y: auto;
  flex: 1;
}

.sidebar-section {
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background-color: #ffffff;
  margin-bottom: 12px;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #e5e7eb;
  color: #374151;
}

.sidebar-section-chevron {
  width: 10px;
  height: 10px;
  border-left: 2px solid #6b7280;
  border-bottom: 2px solid #6b7280;
  transform: rotate(-45deg);
  margin-right: 8px;
  transition: transform 0.2s ease;
}

.sidebar-section-body {
  padding: 12px 14px 14px;
  display: none;
}

.sidebar-section-title {
  flex: 1;
  font-size: 18px;
  font-weight: 600;
}

.sidebar-section.open .sidebar-section-body {
  display: block;
}

.sidebar-section.open .sidebar-section-chevron {
  transform: rotate(135deg);
}

.sidebar-subtitle {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #9ca3af;
  margin-top: 8px;
  margin-bottom: 4px;
}

.field-group {
  margin-bottom: 10px;
}

.field-label-row {
  display: flex;
  align-items: baseline;
  font-size: 15px;
  margin-bottom: 4px;
  gap: 4px;
}

.field-label {
  font-weight: 600;
  color: #111827;
}

.field-range {
  margin-left: auto;
  font-size: 11px;
  color: #9ca3af;
}

.field-link {
  font-size: 11px;
  color: #2563eb;
  cursor: pointer;
}

.field-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.choice-toggle {
  display: inline-flex;
  border: 1px solid #d1d5db;
  overflow: hidden;
  background-color: #ffffff;
}

.choice-pill {
  position: relative;
}

.choice-pill input {
  display: none;
}

.choice-pill span {
  display: inline-block;
  min-width: 60px;
  padding: 6px 18px;
  text-align: center;
  font-size: 15px;
  color: #6b7280;
}

.choice-pill:first-child span {
  border-right: 1px solid #d1d5db;
}

.choice-pill input:checked + span {
  background-color: rgb(0, 82, 155);
  color: #ffffff;
  font-weight: 600;
}

.field-input {
  flex: 1;
  height: 32px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  padding: 0 8px;
  font-size: 15px;
  outline: none;
}

.field-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15);
}

.field-unit {
  font-size: 11px;
  color: #6b7280;
  white-space: nowrap;
}

.sidebar-footer {
  padding: 12px 16px 16px;
  border-top: 1px solid #e5e7eb;
  background-color: #f9fafb;
}

.primary-button {
  width: 100%;
  height: 40px;
  border-radius: 8px;
  border: none;
  background: rgb(0, 82, 155);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 10px;
}

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

.sidebar-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #4b5563;
}

.toggle input {
  display: none;
}

.toggle-switch {
  width: 34px;
  height: 18px;
  border-radius: 999px;
  background-color: #e5e7eb;
  position: relative;
}

.toggle-switch::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background-color: #ffffff;
  position: absolute;
  top: 2px;
  left: 2px;
  transition:
    transform 0.2s ease,
    background-color 0.2s ease;
}

.toggle input:checked + .toggle-switch {
  background-color: #22c55e;
}

.toggle input:checked + .toggle-switch::before {
  transform: translateX(16px);
}

.toggle-label {
  white-space: nowrap;
}

.link-button {
  border: none;
  background: none;
  padding: 0;
  font-size: 12px;
  color: #2563eb;
  cursor: pointer;
}

.content {
  flex: 1;
  padding: 16px 20px;
  overflow-y: auto;
}

.panel-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.panel-header {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 8px;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  font-size: 13px;
  font-weight: 600;
}

.panel-chevron {
  width: 10px;
  height: 10px;
  border-left: 2px solid #6b7280;
  border-bottom: 2px solid #6b7280;
  transform: rotate(-45deg);
  margin-right: 8px;
}

.panel-title {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  color: #4b5563;
}

.card {
  border-radius: 4px;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.result-card {
  padding: 16px 18px;
  margin-bottom: 16px;
}

.result-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}

.result-title {
  font-size: 14px;
  font-weight: 600;
}

.result-score {
  font-size: 12px;
  color: #6b7280;
}

.result-body {
  font-size: 13px;
}

.result-group-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  gap: 8px;
}

.result-group-label {
  font-weight: 500;
}

.result-group-value {
  font-weight: 600;
}

.result-group-value.low {
  color: #16a34a;
}

.result-group-value.intermediate {
  color: #ea580c;
}

.result-group-value.high {
  color: #b91c1c;
}

.result-table-wrapper {
  margin-bottom: 8px;
  overflow-x: auto;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.result-table th,
.result-table td {
  border: 1px solid #e5e7eb;
  padding: 4px 6px;
  text-align: center;
}

.result-table th:first-child,
.result-table td:first-child {
  text-align: left;
}

.result-error {
  font-size: 14px;
  color: #b91c1c;
}

.result-grid {
  display: flex;
  flex-wrap: wrap;
  border-top: 1px solid #e5e7eb;
  border-left: 1px solid #e5e7eb;
}

.result-item {
  padding: 14px 12px;
  border-right: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  box-sizing: border-box;
  width: 25%;
}

.result-item:nth-child(n + 9) {
  width: 20%;
}

@media (max-width: 640px) {
  .result-item {
    width: 50%;
  }

  .result-item:nth-child(n + 9) {
    width: 100%;
  }
}

.result-item-label {
  font-size: 16px;
  color: #6b7280;
  margin-bottom: 2px;
}

.result-item-value {
  font-size: 20px;
  font-weight: 500;
  color: #111827;
}

.result-item-value.missing {
  color: #b91c1c;
}

.pdf-download-wrapper {
    margin-top: 12px;
    display: flex;
    justify-content: center;
}

.pdf-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: 1px solid #d1d5db;
    background-color: #ffffff;
    color: #111827;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.pdf-button:hover {
    background-color: #f3f4f6;
}

.pdf-icon {
    font-size: 16px;
}

.chart-card {
  padding: 16px 18px 18px;
}

.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.chart-tabs {
  display: inline-flex;
  border-radius: 999px;
  background-color: #eef2ff;
  padding: 2px;
}

.chart-tab {
  border: none;
  padding: 6px 14px;
  font-size: 12px;
  border-radius: 999px;
  background: none;
  color: #4b5563;
  cursor: pointer;
}

.chart-tab.active {
  background-color: #ffffff;
  color: #1f2937;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.chart-header-right {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #9ca3af;
}

.chart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 260px;
  gap: 16px;
  margin-top: 8px;
}

.chart-main {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: stretch;
}

.chart-axis-y {
  font-size: 11px;
  color: #6b7280;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12px;
}

.chart-plot {
  position: relative;
  border-radius: 10px;
  background: linear-gradient(to top, #eff6ff, #ffffff);
  border: 1px solid #e5e7eb;
  padding: 32px 32px 30px;
  overflow: hidden;
}

.chart-bands {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 26px;
  display: grid;
  grid-template-columns: 0.8fr 1fr 0.9fr 0.9fr 0.8fr 1.2fr;
}

.chart-band {
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #111827;
}

.band-vl {
  background-color: #a7f3d0;
}

.band-l {
  background-color: #bfdbfe;
}

.band-ml {
  background-color: #fde68a;
}

.band-mh {
  background-color: #fed7aa;
}

.band-h {
  background-color: #fecaca;
}

.band-vh {
  background-color: #fca5a5;
}

.chart-curve {
  position: absolute;
  left: 32px;
  right: 32px;
  bottom: 54px;
  height: 120px;
  background:
    radial-gradient(
      circle at 20% 100%,
      rgba(96, 165, 250, 0.6),
      transparent 60%
    ),
    radial-gradient(
      circle at 55% 100%,
      rgba(96, 165, 250, 0.8),
      transparent 60%
    ),
    radial-gradient(
      circle at 85% 100%,
      rgba(249, 115, 22, 0.7),
      transparent 60%
    );
  opacity: 0.9;
}

.chart-axis-x {
  position: absolute;
  left: 32px;
  right: 32px;
  bottom: 28px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #6b7280;
}

.chart-axis-label {
  position: absolute;
  left: 32px;
  right: 32px;
  bottom: 8px;
  font-size: 11px;
  text-align: center;
  color: #111827;
}

.chart-axis-sub {
  margin-left: 4px;
  font-size: 10px;
  color: #9ca3af;
}

.chart-side {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.legend {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 4px;
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  margin-right: 8px;
}

.legend-label {
  flex: 1;
  color: #4b5563;
}

.legend-value {
  font-weight: 600;
  color: #111827;
}

.legend-vl {
  background-color: #22c55e;
}

.legend-l {
  background-color: #3b82f6;
}

.legend-ml {
  background-color: #eab308;
}

.legend-mh {
  background-color: #f97316;
}

.legend-h {
  background-color: #ef4444;
}

.legend-vh {
  background-color: #b91c1c;
}

.chart-note {
  font-size: 11px;
  color: #6b7280;
  line-height: 1.4;
}

.chart-note p {
  margin: 0 0 4px;
}

@media (max-width: 992px) {
  .app-main {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    max-width: none;
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
  }

  .chart-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .chart-side {
    flex-direction: row;
    gap: 16px;
  }

  .legend {
    flex: 1;
  }
}
