:root {
  --primary-dark: #244f47;
  --primary: #347669;
  --primary-soft: #e7f2ee;
  --primary-pale: #f6fbf9;
  --ink: #203631;
  --muted: rgba(32, 54, 49, 0.62);
  --faint: rgba(32, 54, 49, 0.36);
  --line: rgba(52, 118, 105, 0.12);
  --surface: rgba(255, 255, 255, 0.96);
  --warm: #fbf7ee;
  --warning: #94622a;
  --page: #edf4f1;
  --shadow: 0 18px 46px rgba(36, 79, 71, 0.09);
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, rgba(52, 118, 105, 0.13), transparent 28%),
    linear-gradient(135deg, #edf4f1 0%, #fbfdfc 58%, #eaf2ef 100%);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.demo-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(390px, 430px);
  align-items: center;
  justify-content: center;
  gap: clamp(24px, 5vw, 72px);
  padding: clamp(18px, 4vw, 48px);
}

.demo-rail {
  max-width: 360px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-logo,
.brand-mark,
.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-weight: 780;
}

.brand-logo {
  width: 92px;
  height: 92px;
  overflow: hidden;
  border: 1px solid rgba(52, 118, 105, 0.1);
  border-radius: 26px;
  background: #ffffff;
  box-shadow: 0 18px 42px rgba(52, 118, 105, 0.16);
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.28);
}

.brand-mark {
  width: 76px;
  height: 76px;
  border-radius: 24px;
  color: #ffffff;
  background: linear-gradient(145deg, #347669, #5b9789);
  font-size: 34px;
  box-shadow: 0 18px 42px rgba(52, 118, 105, 0.18);
}

.eyebrow,
.section-kicker,
.stage-phase {
  margin: 0;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.brand-block h1 {
  margin-top: 4px;
  color: var(--primary-dark);
  font-size: 32px;
  line-height: 1.05;
}

.rail-copy {
  margin-top: 28px;
  color: rgba(32, 54, 49, 0.68);
  font-size: 17px;
  line-height: 1.7;
}

.rail-card {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 12px 30px rgba(36, 79, 71, 0.06);
}

.rail-card span {
  display: block;
  color: rgba(32, 54, 49, 0.5);
  font-size: 13px;
  font-weight: 650;
}

.rail-card strong {
  display: block;
  margin-top: 8px;
  color: var(--primary-dark);
  font-size: 16px;
  line-height: 1.45;
}

.rail-card.quiet {
  background: var(--warm);
}

.phone-frame {
  position: relative;
  width: min(100%, 414px);
  height: min(860px, calc(100vh - 32px));
  min-height: 720px;
  overflow: hidden;
  border: 1px solid rgba(52, 118, 105, 0.16);
  border-radius: 34px;
  background:
    radial-gradient(circle at 14% 0%, rgba(52, 118, 105, 0.09), transparent 34%),
    linear-gradient(180deg, #f7fbf9 0%, #ffffff 42%);
  box-shadow: 0 26px 70px rgba(36, 79, 71, 0.18);
}

.phone-status {
  height: 42px;
  padding: 14px 22px 0;
  display: flex;
  justify-content: space-between;
  color: rgba(32, 54, 49, 0.66);
  font-size: 12px;
  font-weight: 760;
  background: rgba(255, 255, 255, 0.9);
}

.screen {
  height: calc(100% - 42px - 70px);
  overflow-y: auto;
  padding-bottom: 22px;
  scrollbar-width: none;
}

.screen::-webkit-scrollbar {
  display: none;
}

.page-header {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 26px 22px 22px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(59, 122, 109, 0.06);
  backdrop-filter: blur(14px);
}

.page-header h2 {
  color: #2c5c52;
  font-size: 28px;
  line-height: 1.1;
}

.page-header p {
  margin-top: 8px;
  color: rgba(59, 122, 109, 0.68);
  font-size: 15px;
}

.content {
  padding: 16px 14px 24px;
}

.card {
  margin-bottom: 13px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(36, 79, 71, 0.055);
}

.stage-dashboard {
  background:
    linear-gradient(145deg, rgba(52, 118, 105, 0.09), rgba(255, 255, 255, 0.96) 46%),
    #ffffff;
}

.stage-hero,
.section-head,
.list-head,
.profile-row,
.stat-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.stage-title {
  margin-top: 6px;
  color: var(--primary-dark);
  font-size: 24px;
  line-height: 1.15;
}

.muted {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.counter {
  width: 58px;
  height: 58px;
  border: 1px solid rgba(52, 118, 105, 0.14);
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.76);
  line-height: 1;
}

.counter strong {
  color: var(--primary-dark);
  font-size: 23px;
}

.counter span {
  color: rgba(52, 118, 105, 0.46);
  font-size: 12px;
}

.boundary,
.assistant-status,
.toast-inline {
  margin-top: 13px;
  padding: 11px 12px;
  border-radius: 14px;
  color: #6e4e24;
  background: var(--warm);
  font-size: 12px;
  line-height: 1.45;
}

.boundary b {
  margin-right: 6px;
  color: var(--warning);
}

.assistant-status,
.toast-inline {
  margin-top: 0;
  margin-bottom: 12px;
  color: #2f6d61;
  background: var(--primary-soft);
}

.progress {
  height: 5px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(52, 118, 105, 0.11);
}

.progress span,
.slider-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #347669, #78aa9a);
}

.timeline {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
  margin-top: 14px;
}

.stage-node {
  min-width: 0;
  border: 0;
  padding: 0;
  color: rgba(32, 54, 49, 0.5);
  background: transparent;
  text-align: center;
}

.stage-node span {
  width: 27px;
  height: 27px;
  margin: 0 auto 6px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(52, 118, 105, 0.16);
  border-radius: 50%;
  background: #fff;
  color: rgba(52, 118, 105, 0.6);
  font-size: 12px;
  font-weight: 780;
}

.stage-node em {
  display: block;
  overflow: hidden;
  color: inherit;
  font-size: 11px;
  font-style: normal;
  font-weight: 680;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-node.active {
  color: var(--primary-dark);
}

.stage-node.active span {
  border-color: var(--primary);
  color: #fff;
  background: var(--primary);
  box-shadow: 0 0 0 5px rgba(52, 118, 105, 0.08);
}

.section-head h3,
.list-head h3,
.card h3 {
  margin-top: 4px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.25;
}

.task {
  display: flex;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid rgba(52, 118, 105, 0.08);
}

.task:first-child {
  border-top: 0;
}

.task-badge,
.list-count {
  flex: 0 0 auto;
  height: 25px;
  min-width: 39px;
  padding: 0 9px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 12px;
  font-weight: 760;
}

.task b,
.check-item b,
.record-item b {
  display: block;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.3;
}

.task p,
.check-item p,
.record-item p {
  margin-top: 4px;
  color: rgba(32, 54, 49, 0.58);
  font-size: 12px;
  line-height: 1.45;
}

.field {
  margin-top: 15px;
}

.field:first-child {
  margin-top: 0;
}

.field label {
  display: block;
  margin-bottom: 9px;
  color: rgba(32, 54, 49, 0.74);
  font-size: 13px;
  font-weight: 720;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  min-height: 34px;
  padding: 8px 11px;
  border: 1px solid rgba(52, 118, 105, 0.12);
  border-radius: 12px;
  color: rgba(32, 54, 49, 0.66);
  background: #ffffff;
  font-size: 13px;
  line-height: 1.1;
}

.chip.active {
  border-color: var(--primary);
  color: #ffffff;
  background: var(--primary);
}

.score-panel {
  margin-top: 15px;
  padding: 15px;
  border-radius: 16px;
  background: var(--primary-pale);
}

.score-copy {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.score-number {
  color: var(--primary-dark);
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
}

.score-number span {
  color: rgba(52, 118, 105, 0.44);
  font-size: 14px;
}

input[type="range"] {
  width: 100%;
  margin: 14px 0 2px;
  accent-color: var(--primary);
}

textarea,
.demo-input {
  width: 100%;
  min-height: 74px;
  resize: vertical;
  border: 1px solid rgba(52, 118, 105, 0.12);
  border-radius: 14px;
  padding: 12px;
  color: var(--ink);
  background: #ffffff;
  outline: none;
}

textarea:focus,
.demo-input:focus {
  border-color: rgba(52, 118, 105, 0.4);
  box-shadow: 0 0 0 4px rgba(52, 118, 105, 0.08);
}

.primary-btn,
.ghost-btn {
  width: 100%;
  min-height: 43px;
  border: 0;
  border-radius: 14px;
  font-weight: 780;
}

.primary-btn {
  color: #ffffff;
  background: linear-gradient(135deg, #347669, #579184);
}

.ghost-btn {
  color: var(--primary);
  background: var(--primary-soft);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.summary-cell {
  min-height: 64px;
  padding: 12px 10px;
  border-radius: 15px;
  background: var(--primary-pale);
}

.summary-cell span {
  display: block;
  color: rgba(32, 54, 49, 0.52);
  font-size: 11px;
}

.summary-cell strong {
  display: block;
  margin-top: 6px;
  color: var(--primary-dark);
  font-size: 18px;
}

.chat {
  display: grid;
  gap: 13px;
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.message.user {
  justify-content: flex-end;
}

.avatar {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  font-size: 16px;
}

.bubble {
  max-width: 292px;
  padding: 12px 13px;
  border: 1px solid rgba(52, 118, 105, 0.1);
  border-radius: 16px;
  color: rgba(32, 54, 49, 0.78);
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(36, 79, 71, 0.045);
  font-size: 13px;
  line-height: 1.55;
}

.message.user .bubble {
  border-color: var(--primary);
  color: #ffffff;
  background: var(--primary);
}

.quick-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 11px;
}

.quick-options button,
.small-btn {
  border: 0;
  border-radius: 12px;
  padding: 8px 10px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 12px;
  font-weight: 760;
}

.inputbar {
  position: sticky;
  bottom: 10px;
  margin-top: 14px;
  min-height: 49px;
  padding: 7px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(36, 79, 71, 0.12);
}

.inputbar input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.inputbar button {
  flex: 0 0 auto;
  border: 0;
  border-radius: 13px;
  padding: 9px 13px;
  color: #ffffff;
  background: var(--primary);
  font-weight: 760;
}

.upload {
  width: 33px;
  height: 33px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: #8aa79f;
  background: #edf4f1;
  font-size: 20px;
}

.rehab-list {
  display: grid;
  gap: 12px;
}

.stage-row {
  min-height: 76px;
  width: 100%;
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(52, 118, 105, 0.1);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 8px 21px rgba(36, 79, 71, 0.045);
  text-align: left;
}

.stage-row.active {
  border-color: rgba(52, 118, 105, 0.3);
  background: linear-gradient(135deg, #ffffff, #edf8f4);
}

.marker {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--primary);
  box-shadow: 0 0 0 7px rgba(52, 118, 105, 0.09);
}

.stage-row div {
  flex: 1;
  min-width: 0;
}

.stage-row b {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 17px;
}

.stage-row small {
  width: 78px;
  color: rgba(32, 54, 49, 0.5);
  font-size: 12px;
  line-height: 1.35;
  text-align: right;
}

.check-item {
  width: 100%;
  display: flex;
  gap: 11px;
  padding: 12px 0;
  border: 0;
  border-top: 1px solid rgba(52, 118, 105, 0.08);
  background: transparent;
  text-align: left;
}

.check-item:first-of-type {
  border-top: 0;
}

.checkbox {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(52, 118, 105, 0.2);
  border-radius: 50%;
  color: #ffffff;
  font-size: 14px;
  font-weight: 900;
}

.check-item.done .checkbox {
  border-color: var(--primary);
  background: var(--primary);
}

.check-item.done b {
  color: rgba(32, 54, 49, 0.52);
  text-decoration: line-through;
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 15px;
}

.profile-avatar {
  width: 66px;
  height: 66px;
  border-radius: 18px;
  box-shadow: none;
}

.profile-hero h3 {
  color: var(--ink);
  font-size: 21px;
}

.profile-hero p {
  margin-top: 4px;
  color: rgba(32, 54, 49, 0.58);
}

.stat-row {
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(52, 118, 105, 0.08);
}

.stat-row:last-child {
  border-bottom: 0;
}

.stat-row span {
  color: rgba(32, 54, 49, 0.62);
  font-size: 14px;
}

.stat-row strong {
  color: var(--primary-dark);
  font-size: 14px;
  text-align: right;
}

.tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 70px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid rgba(59, 122, 109, 0.08);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px);
}

.tab {
  border: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: rgba(59, 122, 109, 0.6);
  background: transparent;
  font-size: 12px;
}

.tab-dot {
  width: 5px;
  height: 5px;
  border: 1px solid rgba(59, 122, 109, 0.2);
  border-radius: 50%;
}

.tab.active {
  color: var(--primary);
  font-weight: 780;
}

.tab.active .tab-dot {
  width: 8px;
  height: 8px;
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: 0 0 0 5px rgba(59, 122, 109, 0.08);
}

@media (max-width: 760px) {
  body {
    background: #f7fbf9;
  }

  .demo-shell {
    display: block;
    min-height: 100vh;
    padding: 0;
  }

  .demo-rail {
    display: none;
  }

  .phone-frame {
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
}
