/* Report details share the mini program's calm cards and readable type scale. */
.estimate-detail,
.record-detail,
.health-detail {
  --report-accent: #2f80ed;
  --report-tint: #eef6ff;
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 20px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.65;
}

.estimate-detail { --report-accent: #237249; --report-tint: #eaf7ef; }
.previsit-detail { --report-accent: #a16714; --report-tint: #fff5e4; }
.simulation-detail { --report-accent: #7556b8; --report-tint: #f2edff; }

.estimate-hero,
.record-hero,
.health-hero {
  display: flex;
  min-height: 170px;
  padding: 26px 28px;
  align-items: center;
  justify-content: space-between;
  flex-direction: row;
  gap: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 3px 16px rgba(31, 42, 55, .025);
}

.estimate-hero > div:first-child,
.record-hero-main,
.health-hero > div:first-child { min-width: 0; flex: 1; }

.estimate-status,
.record-status,
.health-status {
  display: inline-flex;
  min-height: 27px;
  padding: 3px 10px;
  align-items: center;
  border-radius: 7px;
  background: var(--report-tint);
  color: var(--report-accent);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
}

.estimate-hero h2,
.record-hero h2,
.health-hero h2 {
  max-width: none;
  margin: 11px 0 8px;
  color: var(--ink);
  font-size: 26px;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: -.4px;
  overflow-wrap: anywhere;
}

.record-hero-main > small,
.health-hero > div > small {
  display: block;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.record-hero h2,
.health-hero h2 { margin-top: 4px; }

.estimate-hero p,
.record-hero p,
.health-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.estimate-hero-total,
.record-hero-side,
.health-hero-side {
  min-width: 210px;
  max-width: 300px;
  padding: 18px 22px;
  flex: 0 0 auto;
  border-radius: 12px;
  background: var(--report-tint);
  text-align: left;
}

.estimate-hero-total span,
.estimate-hero-total small,
.record-hero-side span,
.record-hero-side small,
.health-hero-side span,
.health-hero-side small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.estimate-hero-total strong,
.record-hero-side strong,
.health-hero-side strong {
  display: block;
  max-width: none;
  margin: 4px 0;
  color: var(--report-accent);
  font-size: 29px;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: -.5px;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.health-hero .health-hero-side small { margin-top: 0; }

.estimate-layout,
.record-detail-layout,
.health-layout {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) 260px;
  align-items: start;
  gap: 20px;
}

.record-main-column,
.health-main {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 20px;
}

.estimate-items-panel,
.estimate-summary,
.estimate-note,
.record-main-panel,
.record-summary,
.simulation-disclaimer,
.health-section,
.health-summary {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 3px 16px rgba(31, 42, 55, .025);
}

.estimate-section-head,
.record-section-head,
.health-section-head {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
}

.estimate-section-head h3,
.estimate-summary h3,
.record-section-head h3,
.record-summary h3,
.health-section-head h3,
.health-summary h3 {
  margin: 0 0 5px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 650;
  line-height: 1.55;
}

.estimate-section-head p,
.record-section-head p,
.health-section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.estimate-summary,
.record-summary,
.health-summary {
  position: sticky;
  top: 0;
  padding: 22px;
}

.estimate-summary dl,
.record-summary dl,
.health-summary dl { margin: 14px 0; }

.estimate-summary dl > div,
.record-summary dl > div,
.health-summary dl > div {
  display: flex;
  padding: 9px 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.estimate-summary dt,
.record-summary dt,
.health-summary dt { flex: 0 0 auto; }

.estimate-summary dd,
.record-summary dd,
.health-summary dd {
  min-width: 0;
  max-width: 145px;
  margin: 0;
  color: var(--ink);
  font-weight: 500;
  text-align: right;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.estimate-summary > p,
.record-summary > p,
.health-summary > p {
  margin: 16px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
}

.estimate-item,
.health-treatment {
  display: grid;
  padding: 20px 24px;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.estimate-item:last-child,
.health-treatment:last-child { border-bottom: 0; }

.estimate-item-index,
.health-treatment-index {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: var(--report-tint);
  color: var(--report-accent);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.estimate-item-title,
.health-treatment-title {
  display: flex;
  min-height: 28px;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.estimate-item-title b,
.health-treatment-title b {
  min-width: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.estimate-item-title span,
.health-treatment-title em {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f9fc;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  font-style: normal;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.estimate-item-main p,
.health-treatment p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.health-treatment small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.health-treatment > strong {
  margin-top: 3px;
  padding: 3px 8px;
  border-radius: 6px;
  background: #eaf7ef;
  color: #237249;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.6;
  white-space: nowrap;
}

.estimate-item-price {
  display: flex;
  min-width: 86px;
  padding-top: 2px;
  align-items: flex-end;
  flex-direction: column;
  font-variant-numeric: tabular-nums;
}

.estimate-item-price strong { color: var(--ink); font-size: 17px; font-weight: 650; }
.estimate-item-price small { color: #8a94a3; font-size: 11px; text-decoration: line-through; }
.estimate-item-price em { margin: 3px 0; padding: 1px 6px; border-radius: 5px; background: var(--report-tint); color: var(--report-accent); font-size: 11px; font-style: normal; }
.estimate-summary dd.discount { color: var(--report-accent); }

.estimate-payable {
  display: flex;
  padding: 18px 0 0;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  border-top: 1px solid var(--line);
}

.estimate-payable span { color: var(--ink); font-size: 13px; }
.estimate-payable strong { color: var(--report-accent); font-size: 25px; font-weight: 650; line-height: 1.4; font-variant-numeric: tabular-nums; }
.estimate-note { padding: 20px 24px; }
.estimate-note span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 13px; }
.estimate-note p { margin: 0; color: var(--ink); font-size: 14px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }

.record-field-grid,
.health-care-grid {
  display: grid;
  padding: 4px 24px 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 28px;
}

.record-field { min-width: 0; padding: 18px 0; border-bottom: 1px solid var(--line); }
.record-field.wide { grid-column: 1 / -1; }
.record-field span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.record-field p { margin: 0; color: var(--ink); font-size: 14px; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; }

.simulation-compare { display: grid; padding: 22px 24px 24px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.simulation-image-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.simulation-image-card:last-child { border-color: #ded6ef; }
.simulation-image-head { display: flex; padding: 14px; align-items: flex-start; justify-content: space-between; gap: 8px; }
.simulation-image-head span { color: var(--ink); font-size: 14px; font-weight: 600; }
.simulation-image-card:last-child .simulation-image-head span { color: var(--report-accent); }
.simulation-image-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.simulation-image-head em { flex: 0 0 auto; padding: 3px 6px; border-radius: 5px; background: var(--report-tint); color: var(--report-accent); font-size: 10px; font-weight: 400; font-style: normal; }
.simulation-image-button { position: relative; display: block; width: 100%; height: 280px; padding: 0; overflow: hidden; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: #f7f9fc; cursor: zoom-in; }
.simulation-image-button img { display: block; width: 100%; height: 100%; object-fit: contain; }
.simulation-image-button > span { right: 12px; bottom: 12px; padding: 5px 9px; border-radius: 7px; background: rgba(31, 42, 55, .76); color: #fff; font-size: 11px; }
.simulation-image-button:focus-visible > span { opacity: 1; }
.simulation-image-missing { display: grid; height: 280px; place-items: center; border-top: 1px solid var(--line); background: #f7f9fc; color: var(--muted); font-size: 13px; }
.record-note { padding: 22px 24px; }
.record-note p { margin: 0; color: var(--ink); font-size: 14px; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; }
.simulation-disclaimer { display: flex; padding: 18px 20px; align-items: flex-start; gap: 12px; border-color: #e6e0f0; background: #f7f4fc; box-shadow: none; }
.simulation-disclaimer span { flex: 0 0 auto; padding: 3px 7px; border-radius: 6px; background: #ece5f8; color: var(--report-accent); font-size: 11px; font-weight: 600; }
.simulation-disclaimer p { margin: 1px 0 0; color: var(--muted); font-size: 13px; line-height: 1.75; overflow-wrap: anywhere; }

.health-attachment-grid { display: grid; padding: 22px 24px 24px; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.health-attachment-grid button { min-width: 0; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff; text-align: left; cursor: zoom-in; transition: border-color .15s ease, box-shadow .15s ease; }
.health-attachment-grid button:hover { border-color: #a7caf6; box-shadow: 0 3px 12px rgba(47, 128, 237, .07); }
.health-attachment-grid img { display: block; width: 100%; aspect-ratio: 1.3; object-fit: cover; background: #f7f9fc; }
.health-attachment-grid span { display: block; padding: 9px 10px; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.6; text-overflow: ellipsis; white-space: nowrap; }
.health-case-list { display: grid; padding: 22px 24px 24px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.health-case { display: flex; min-width: 0; padding: 14px; align-items: flex-start; gap: 12px; border: 1px solid var(--line); border-radius: 10px; background: #f7f9fc; }
.health-case img { width: 56px; height: 56px; flex: 0 0 56px; border-radius: 8px; object-fit: cover; }
.health-case div { min-width: 0; }
.health-case b { display: block; color: var(--ink); font-size: 14px; font-weight: 600; line-height: 1.65; overflow-wrap: anywhere; }
.health-case p { display: block; margin: 5px 0 0; overflow: visible; color: var(--muted); font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; -webkit-line-clamp: unset; }
.health-billing { margin-top: 8px; padding: 16px; border: 0; border-radius: 10px; background: var(--report-tint); }
.health-billing span,
.health-billing small { display: block; color: var(--muted); font-size: 12px; line-height: 1.7; }
.health-billing strong { display: block; margin: 4px 0; color: var(--blue); font-size: 26px; font-weight: 650; line-height: 1.5; font-variant-numeric: tabular-nums; }
.health-timeline { margin-top: 22px; }
.health-timeline h4 { margin: 0 0 12px; color: var(--ink); font-size: 14px; font-weight: 600; }
.health-visit { position: relative; padding: 0 0 18px 15px; border-left: 1px solid #d9e6f7; }
.health-visit:last-child { padding-bottom: 0; }
.health-visit::before { position: absolute; top: 7px; left: -4px; width: 7px; height: 7px; border-radius: 50%; background: #b4d2f8; content: ""; }
.health-visit:first-of-type::before { background: var(--blue); }
.health-visit span { padding-right: 27px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.health-visit p { margin: 5px 0 0; color: var(--ink); font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.health-visit em { position: absolute; top: 0; right: 0; color: var(--blue); font-size: 10px; font-style: normal; }
.estimate-empty,
.health-empty { margin: 0; padding: 36px 24px; color: var(--muted); font-size: 14px; line-height: 1.7; text-align: center; }

@media (max-width: 1400px) {
  .estimate-hero,
  .record-hero,
  .health-hero { padding: 24px; }
  .estimate-hero-total,
  .record-hero-side,
  .health-hero-side { min-width: 190px; max-width: 250px; padding: 16px 18px; }
  .estimate-section-head,
  .record-section-head,
  .health-section-head { padding-right: 20px; padding-left: 20px; }
  .estimate-item,
  .health-treatment { padding-right: 20px; padding-left: 20px; gap: 10px; }
  .record-field-grid,
  .health-care-grid,
  .simulation-compare,
  .health-attachment-grid,
  .health-case-list { padding-right: 20px; padding-left: 20px; }
  .simulation-image-head { flex-wrap: wrap; }
  .simulation-image-button,
  .simulation-image-missing { height: 230px; }
  .health-case-list { grid-template-columns: 1fr; }
}

@media (max-width: 1200px) {
  .estimate-layout,
  .record-detail-layout,
  .health-layout { grid-template-columns: minmax(0, 1fr); }
  .estimate-summary,
  .record-summary,
  .health-summary { position: static; }
  .estimate-summary dl,
  .record-summary dl,
  .health-summary dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }
  .estimate-summary dd,
  .record-summary dd,
  .health-summary dd { max-width: none; }
  .simulation-image-head { flex-wrap: nowrap; }
  .simulation-image-button,
  .simulation-image-missing { height: 280px; }
  .health-case-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .simulation-image-button img,
  .simulation-image-button > span,
  .health-attachment-grid button { transition: none; }
}
