:root {
  color-scheme: light;
  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --ink: #111827;
  --muted: #6b7280;
  --tertiary: #9ca3af;
  --line: rgba(60, 60, 67, .14);
  --blue: #007aff;
  --red: #ff3b30;
  --orange: #ff9500;
  --green: #34c759;
  --purple: #5856d6;
  --shadow: 0 14px 32px rgba(15, 23, 42, .08);
}

* {
  box-sizing: border-box;
}

html {
  background: #e9eaee;
}

body {
  margin: 0;
  color: var(--ink);
  background: #e9eaee;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.app {
  min-height: 100vh;
  max-width: 430px;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.content {
  min-height: 100vh;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 16px 24px;
}

.nav-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.nav-title h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.08;
  font-weight: 800;
  color: #111827;
}

.nav-subtitle {
  margin-top: 7px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
  font-weight: 500;
}

.nav-subtitle strong {
  color: var(--red);
  font-weight: 800;
}

.segmented {
  background: rgba(118, 118, 128, .12);
  border-radius: 12px;
  padding: 3px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  margin-bottom: 18px;
}

.segment {
  min-height: 34px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #374151;
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
}

.segment.active {
  background: #fff;
  color: #111827;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .12);
}

.section-label {
  margin: 0 4px 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.message-list {
  display: grid;
  gap: 10px;
}

.message-card {
  border: 1px solid rgba(255,255,255,.76);
  border-radius: 18px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 1px 0 rgba(255,255,255,.7), 0 10px 24px rgba(15, 23, 42, .04);
  padding: 14px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 18px;
  gap: 12px;
  align-items: start;
  cursor: pointer;
}

.message-card:active {
  transform: scale(.992);
}

.message-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.message-icon svg {
  width: 24px;
  height: 24px;
}

.message-card.abnormal .message-icon {
  background: linear-gradient(180deg, #ff453a, #ff2d55);
}

.message-card.adherence .message-icon {
  background: linear-gradient(180deg, #34c759, #30b0c7);
}

.message-card.other .message-icon {
  background: linear-gradient(180deg, #5856d6, #007aff);
}

.message-body {
  min-width: 0;
}

.message-topline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.message-title {
  margin: 0;
  min-width: 0;
  font-size: 17px;
  line-height: 1.25;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
  flex: 0 0 auto;
}

.message-summary {
  margin: 4px 0 0;
  color: #4b5563;
  font-size: 14px;
  line-height: 1.42;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.message-meta {
  margin-top: 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--tertiary);
  font-size: 12px;
  font-weight: 600;
}

.type-pill {
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(118, 118, 128, .12);
  color: #4b5563;
}

.message-card.abnormal .type-pill {
  background: rgba(255, 59, 48, .1);
  color: #d70015;
}

.message-card.adherence .type-pill {
  background: rgba(52, 199, 89, .12);
  color: #248a3d;
}

.chevron {
  color: #c7c7cc;
  align-self: center;
}

.chevron svg {
  width: 18px;
  height: 18px;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.back-button {
  border: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(118, 118, 128, .12);
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.back-button svg {
  width: 22px;
  height: 22px;
}

.detail-title {
  flex: 1;
  min-width: 0;
}

.detail-title h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.18;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.report-card {
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.76);
}

.report-frame {
  display: block;
  width: 100%;
  min-height: calc(100vh - 242px);
  border: 0;
  background: #fff;
}

.feedback-panel {
  margin-top: 12px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(255,255,255,.76);
  box-shadow: 0 10px 24px rgba(15, 23, 42, .04);
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.feedback-status {
  grid-column: 1 / -1;
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-align: center;
}

.feedback-panel button {
  border: 0;
  border-radius: 13px;
  min-height: 42px;
  background: rgba(118, 118, 128, .12);
  color: #1f2937;
  font-size: 14px;
  font-weight: 700;
}

.feedback-panel button.selected {
  background: rgba(0, 122, 255, .12);
  color: var(--blue);
}

.empty {
  border-radius: 18px;
  background: rgba(255,255,255,.72);
  padding: 30px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

@media (min-width: 720px) {
  body {
    padding: 24px 0;
  }

  .app {
    min-height: min(860px, calc(100vh - 48px));
    border-radius: 34px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, .14);
  }

}
