/* WK Body Report */
.inbody-page {
  display: grid;
  gap: 22px;
}

.report-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-end;
}

.report-sheet {
  width: min(100%, 1040px);
  min-height: 1280px;
  margin: 0 auto;
  padding: 34px 42px 28px;
  background:
    linear-gradient(rgba(122, 142, 154, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(122, 142, 154, 0.055) 1px, transparent 1px),
    var(--panel, #fff);
  background-size: 18px 18px;
  border: 1px solid rgba(120, 80, 72, 0.18);
  border-radius: 18px;
  box-shadow: 0 28px 70px rgba(28, 38, 52, 0.12);
  color: var(--text, #20242a);
}

.report-header {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 24px;
  align-items: end;
  margin-bottom: 10px;
}

.report-brand {
  color: #8f302b;
  font-size: 42px;
  font-weight: 900;
  letter-spacing: -0.045em;
  line-height: 1;
}

.report-rule {
  height: 5px;
  margin-top: 12px;
  background: #8f302b;
}

.report-meta-card {
  display: grid;
  gap: 6px;
  justify-items: end;
  font-size: 13px;
}

.report-meta-card strong {
  font-size: 18px;
}

.report-person-row {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.7fr 0.8fr 1.8fr;
  border-top: 1px solid rgba(49, 62, 72, 0.22);
  border-bottom: 1px solid rgba(49, 62, 72, 0.22);
  margin-bottom: 24px;
}

.report-person-row > div {
  padding: 8px 12px;
  border-right: 1px solid rgba(49, 62, 72, 0.18);
}

.report-person-row > div:last-child {
  border-right: 0;
}

.report-person-row span {
  display: block;
  color: rgba(49, 62, 72, 0.7);
  font-size: 12px;
}

.report-person-row strong {
  display: block;
  margin-top: 3px;
  font-size: 15px;
}

.report-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 28px;
}

.report-main-column,
.report-side-column {
  display: grid;
  align-content: start;
  gap: 20px;
}

.report-section,
.side-section,
.score-card {
  break-inside: avoid;
}

.report-section h3,
.side-section h3,
.score-card h3 {
  margin: 0 0 8px;
  color: #627b88;
  font-size: 22px;
  font-weight: 800;
  font-family: Georgia, 'Times New Roman', serif;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.report-table td {
  padding: 8px 10px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.9);
}

.composition-table td:first-child,
.composition-table td:nth-child(2) {
  background: rgba(201, 217, 225, 0.75);
}

.composition-table .sum td:first-child,
.composition-table .sum td:nth-child(2) {
  background: rgba(183, 203, 214, 0.95);
}

.report-value {
  text-align: right;
  font-size: 18px;
  font-weight: 700;
}

.range-stack {
  display: grid;
  gap: 10px;
}

.range-row {
  display: grid;
  grid-template-columns: 92px 1fr 54px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.range-label strong,
.range-label span {
  display: block;
}

.range-label span {
  color: rgba(49, 62, 72, 0.66);
  font-size: 11px;
}

.range-track {
  position: relative;
  height: 32px;
  border-bottom: 1px solid rgba(34, 45, 52, 0.3);
  background: linear-gradient(90deg, #202020 var(--pos), #d7d7d7 0);
  clip-path: inset(12px 0 6px 0);
}

.range-track::before {
  content: "";
  position: absolute;
  inset: 12px 0 6px;
  background: repeating-linear-gradient(90deg, transparent 0 9.5%, rgba(255,255,255,0.55) 9.5% 10%);
}

.range-normal {
  position: absolute;
  top: 12px;
  bottom: 6px;
  left: var(--normal-start);
  width: calc(var(--normal-end) - var(--normal-start));
  background: rgba(255, 255, 255, 0.32);
}

.range-zone {
  position: absolute;
  top: -1px;
  font-size: 10px;
  color: rgba(49, 62, 72, 0.72);
}

.range-zone-under { left: 2%; }
.range-zone-normal { left: 38%; }
.range-zone-over { right: 4%; }

.range-marker {
  position: absolute;
  top: 9px;
  left: var(--pos);
  width: 2px;
  height: 22px;
  background: #8f302b;
  transform: translateX(-1px);
}

.range-number {
  font-size: 17px;
  font-weight: 800;
  text-align: right;
}

.segment-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.segment-card {
  background: rgba(207, 221, 229, 0.72);
  padding: 12px;
  min-height: 286px;
}

.segment-card h4 {
  margin: 0 0 8px;
  color: #627b88;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 17px;
}

.segment-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 130px 1fr;
  align-items: center;
  min-height: 232px;
}

.segment-body {
  width: 130px;
  height: 220px;
  fill: rgba(255, 255, 255, 0.82);
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 2;
}

.segment-side {
  display: grid;
  gap: 8px;
  font-size: 12px;
}

.segment-side strong,
.segment-trunk strong {
  display: block;
  padding-bottom: 3px;
  border-bottom: 1px dashed rgba(49, 62, 72, 0.5);
  font-size: 15px;
}

.segment-trunk {
  position: absolute;
  left: 50%;
  top: 43%;
  min-width: 72px;
  transform: translate(-50%, -50%);
  text-align: center;
  font-size: 12px;
}

.history-chart {
  width: 100%;
  min-height: 130px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(49, 62, 72, 0.18);
}

.history-label {
  font-size: 10px;
  fill: rgba(49, 62, 72, 0.75);
  font-weight: 700;
}

.history-line {
  stroke: rgba(49, 62, 72, 0.18);
  stroke-width: 1;
}

.history-polyline {
  fill: none;
  stroke: #222;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.score-card,
.side-section {
  border-top: 1px solid rgba(49, 62, 72, 0.28);
  padding-top: 11px;
}

.score-number {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 4px 0;
}

.score-number strong {
  font-size: 46px;
  line-height: 1;
  font-family: Georgia, 'Times New Roman', serif;
}

.score-number span {
  font-size: 13px;
}

.score-card p {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
}

.side-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.side-table td {
  padding: 4px 0;
  border-bottom: 1px solid rgba(49, 62, 72, 0.1);
  vertical-align: top;
}

.side-table td:last-child {
  text-align: right;
  font-weight: 700;
}

.visceral-level {
  font-size: 22px;
  margin-bottom: 6px;
}

.gauge {
  position: relative;
  display: flex;
  justify-content: space-between;
  padding-top: 12px;
  font-size: 12px;
}

.gauge::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 5px;
  height: 2px;
  background: rgba(49, 62, 72, 0.42);
}

.gauge i {
  position: absolute;
  left: var(--pos);
  top: 0;
  width: 3px;
  height: 12px;
  background: #8f302b;
  transform: translateX(-50%);
}

.report-admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 20px;
}

.report-empty {
  display: grid;
  min-height: 240px;
  place-items: center;
  color: rgba(49, 62, 72, 0.72);
  text-align: center;
}

.report-empty.small {
  min-height: 110px;
  border: 1px dashed rgba(49, 62, 72, 0.22);
}

@media (max-width: 900px) {
  .report-toolbar,
  .report-header,
  .report-layout,
  .report-admin-grid,
  .segment-pair {
    grid-template-columns: 1fr;
  }

  .report-sheet {
    padding: 24px 18px;
    min-height: auto;
  }

  .report-person-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 8mm;
  }

  html,
  body {
    background: #fff !important;
  }

  .print-hidden,
  .topbar,
  .mobile-nav,
  .report-admin-grid,
  [data-inbody-message] {
    display: none !important;
  }

  .shell,
  .inbody-page {
    display: block !important;
    width: auto !important;
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .report-sheet {
    width: 100% !important;
    min-height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background-size: 14px 14px !important;
  }

  .report-brand {
    font-size: 34px;
  }

  .report-layout {
    grid-template-columns: 1fr 260px;
    gap: 18px;
  }

  .report-section h3,
  .side-section h3,
  .score-card h3 {
    font-size: 17px;
  }

  .range-row {
    grid-template-columns: 78px 1fr 42px;
  }

  .segment-card {
    min-height: 232px;
  }

  .segment-grid {
    grid-template-columns: 1fr 96px 1fr;
    min-height: 184px;
  }

  .segment-body {
    width: 96px;
    height: 172px;
  }
}

/* v3: 全中文報告與 SVG 圖表修正 */
.report-brand {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: -0.04em;
}

.report-section h3,
.side-section h3,
.score-card h3,
.segment-card h4 {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: -0.04em;
}

.composition-table td {
  vertical-align: middle;
}

.composition-table td:first-child {
  width: 108px;
  font-weight: 800;
}

.composition-table .composition-range {
  width: 134px;
  color: rgba(49, 62, 72, 0.72);
  font-size: 12px;
}

.composition-table td:nth-child(3) {
  width: 210px;
  background: rgba(244, 248, 250, 0.78);
}

.mini-gauge {
  display: block;
  width: 100%;
  height: 32px;
}

.gauge-base,
.range-base {
  fill: rgba(214, 219, 222, 0.95);
}

.gauge-normal,
.range-normal-svg {
  fill: rgba(143, 48, 43, 0.25);
}

.gauge-marker,
.range-marker-svg {
  stroke: #8f302b;
  stroke-width: 3;
  stroke-linecap: round;
}

.gauge-tip,
.range-caption {
  fill: rgba(49, 62, 72, 0.72);
  font-size: 9px;
}

.range-row-v3 {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 72px;
  gap: 9px;
  align-items: center;
}

.range-row-v3 + .range-row-v3 {
  margin-top: 8px;
}

.range-chart {
  display: block;
  width: 100%;
  height: 46px;
  overflow: visible;
}

.range-tick {
  stroke: rgba(255, 255, 255, 0.75);
  stroke-width: 1;
}

.range-value-label {
  fill: #162335;
  font-size: 10px;
  font-weight: 800;
}

.history-chart {
  min-height: 188px;
}

.history-date {
  fill: rgba(49, 62, 72, 0.65);
  font-size: 9px;
  font-weight: 500;
}

.history-dot {
  fill: #202020;
  stroke: #fff;
  stroke-width: 1;
}

.history-value {
  fill: #162335;
  font-size: 9px;
  font-weight: 800;
}

.visceral-level {
  display: flex;
  gap: 10px;
  align-items: baseline;
}

.visceral-level span {
  color: rgba(49, 62, 72, 0.72);
  font-size: 12px;
}

.visceral-chart {
  display: block;
  width: 100%;
  height: 50px;
}

.list-row.is-selected {
  outline: 2px solid rgba(143, 48, 43, 0.35);
  background: rgba(143, 48, 43, 0.06);
}

@media print {
  .range-row-v3 {
    grid-template-columns: 72px minmax(0, 1fr) 58px;
  }

  .range-chart {
    height: 40px;
  }

  .history-chart {
    min-height: 142px;
  }
}
