* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: system-ui, "Microsoft YaHei", sans-serif;
}

button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
}

textarea {
  resize: vertical;
}

.page-header {
  margin-bottom: 18px;
}

.card {
  margin-bottom: 14px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgb(16 55 47 / 5%);
}

.card h2 {
  margin: 0 0 14px;
  font-size: 1.05rem;
}

.hero-number {
  color: var(--brand);
  font-size: 3rem;
  line-height: 1;
}

.hero-date {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: .82rem;
}

.hero-date input {
  width: auto;
  min-height: 38px;
  padding: 6px 9px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.metric span,
.metric small,
.task-row small,
.issue-card span {
  color: var(--muted);
  font-size: .75rem;
}

.metric strong {
  color: var(--brand);
  font-size: 1.15rem;
}

.section-title,
.task-row,
.target-card,
.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.task-row,
.target-card,
.issue-card {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.task-row > div,
.target-card,
.issue-card {
  display: grid;
  gap: 5px;
}

.task-row select {
  width: auto;
  min-width: 94px;
}

.pill {
  padding: 4px 8px;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 999px;
  font-size: .75rem;
}

.stack {
  display: grid;
  gap: 12px;
}

.secondary-action,
.link-button {
  min-height: 44px;
  padding: 10px 14px;
  color: var(--brand);
  background: var(--brand-soft);
  border: 0;
  border-radius: 10px;
  font-weight: 700;
}

.link-button {
  min-height: auto;
  padding: 6px 8px;
  background: transparent;
}

.notice {
  padding: 10px 12px;
  background: var(--brand-soft);
  border-radius: 10px;
  font-size: .875rem;
}

.ai-result {
  margin-top: 16px;
  padding: 14px;
  background: #f0f7f5;
  border: 1px solid #cfe3dd;
  border-radius: 14px;
}

.ai-result h3,
.ai-result h4 {
  margin: 0 0 10px;
}

.subtabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 14px;
  padding: 5px;
  background: #e8efed;
  border-radius: 14px;
}

.subtabs button {
  min-height: 42px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 10px;
  font-weight: 700;
}

.subtabs button.active {
  color: var(--brand);
  background: var(--surface);
  box-shadow: 0 3px 12px rgb(16 55 47 / 8%);
}

.subtabs button span {
  display: inline-grid;
  min-width: 20px;
  min-height: 20px;
  place-items: center;
  color: white;
  background: var(--brand);
  border-radius: 999px;
  font-size: .72rem;
}

.review-item,
.plan-suggestion {
  display: grid;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.review-item > div:first-child,
.plan-suggestion > div {
  display: grid;
  gap: 4px;
}

.review-item small,
.plan-suggestion small {
  color: var(--muted);
}

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

.choice-row button {
  min-height: 40px;
  padding: 8px 12px;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid #c8ded8;
  border-radius: 10px;
  font-weight: 700;
}

.analysis-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.analysis-heading > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.analysis-heading h3 {
  margin: 0;
}

.analysis-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: white;
  background: var(--brand);
  border-radius: 10px;
  font-size: .72rem;
  font-weight: 800;
}

.analysis-summary {
  padding: 12px;
  color: var(--ink) !important;
  background: white;
  border-left: 4px solid var(--brand);
  border-radius: 8px;
}

.focus-card h2 {
  margin: 4px 0 0;
}

.focus-label {
  color: var(--danger);
  font-size: .75rem;
  font-weight: 800;
}

.focus-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.focus-stats span {
  display: grid;
  gap: 4px;
  padding: 10px;
  color: var(--muted);
  background: var(--canvas);
  border-radius: 10px;
  font-size: .75rem;
}

.focus-stats strong {
  color: var(--ink);
  font-size: .9rem;
}

.daily-action {
  padding: 12px;
  background: var(--brand-soft);
  border-radius: 12px;
}

.daily-action small {
  color: var(--brand);
  font-weight: 700;
}

.daily-action p {
  margin-bottom: 0;
  color: var(--ink);
}

.timeline-item {
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: 14px;
  padding: 18px 0;
  border-top: 1px solid var(--border);
}

.timeline-item time {
  color: var(--brand);
  font-size: .82rem;
  font-weight: 800;
}

.timeline-item p {
  margin-top: 0;
  white-space: pre-wrap;
}

.timeline-summary {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  background: var(--brand-soft);
  border-radius: 10px;
  font-size: .85rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag-row span {
  padding: 4px 8px;
  color: var(--brand);
  background: white;
  border: 1px solid #c8ded8;
  border-radius: 999px;
  font-size: .75rem;
}

.forecast-hero {
  overflow: hidden;
  background: linear-gradient(145deg, #ffffff 35%, #eaf5f1);
}

.confidence {
  padding: 5px 9px;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 800;
}

.confidence.low {
  color: #8a5c18;
  background: #fff2d9;
}

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

.score-gauge {
  display: grid;
  gap: 5px;
  padding: 12px;
  background: rgb(255 255 255 / 85%);
  border: 1px solid var(--border);
  border-radius: 13px;
}

.score-gauge span,
.score-gauge small {
  color: var(--muted);
  font-size: .75rem;
}

.score-gauge strong {
  color: var(--brand);
  font-size: 1.15rem;
}

.gauge-track {
  height: 7px;
  overflow: hidden;
  background: #dce8e4;
  border-radius: 999px;
}

.gauge-track i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #54aa93, var(--brand));
  border-radius: inherit;
}

.target-date {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin-top: 14px;
  padding: 12px;
  background: var(--brand);
  border-radius: 13px;
  color: white;
}

.target-date strong {
  text-align: right;
}

.target-date small {
  grid-column: 1 / -1;
  opacity: .8;
}

.gap-total {
  color: var(--danger);
}

.priority-card {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.priority-card > div {
  display: grid;
  gap: 4px;
}

.priority-card small {
  color: var(--muted);
}

.priority-card b {
  color: var(--brand);
  font-size: .82rem;
}

.priority-rank {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: white;
  background: var(--brand);
  border-radius: 10px;
  font-weight: 800;
}

.shenlun-gap {
  display: flex;
  justify-content: space-between;
  padding: 12px;
  background: var(--canvas);
  border-radius: 10px;
}

.trend-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.trend-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 12px;
  background: var(--canvas);
  border-radius: 12px;
}

.trend-card > div {
  display: flex;
  justify-content: space-between;
}

.trend-card b {
  font-size: 1.2rem;
}

.trend-card small {
  color: var(--muted);
}

.trend-direction {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 800;
}

.trend-direction.up { color: var(--brand); }
.trend-direction.down { color: var(--danger); }

.sparkline {
  width: 100%;
  height: 32px;
  color: var(--brand);
}

.sparkline.empty {
  height: 32px;
  background: linear-gradient(90deg, transparent, #dce8e4, transparent);
  opacity: .6;
}

.weekly-task {
  display: grid;
  grid-template-columns: 4rem 1fr;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.weekly-task > span {
  align-self: start;
  padding: 5px 7px;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 8px;
  text-align: center;
  font-size: .75rem;
  font-weight: 800;
}

.weekly-task > div {
  display: grid;
  gap: 4px;
}

.weekly-task small {
  color: var(--muted);
}

.weekly-target-head,
.weekly-target-row {
  display: grid;
  grid-template-columns: 1.25fr repeat(3, minmax(0, .8fr));
  align-items: center;
  gap: 8px;
}

.weekly-target-head {
  padding: 0 4px;
  color: var(--muted);
  font-size: .72rem;
  text-align: center;
}

.weekly-target-head span:first-child {
  text-align: left;
}

.weekly-target-row {
  padding: 9px 0;
  border-top: 1px solid var(--border);
}

.weekly-target-row label {
  position: relative;
}

.weekly-target-row input {
  min-width: 0;
  padding-right: 24px;
  text-align: center;
}

.weekly-target-row label span {
  position: absolute;
  z-index: 1;
  right: 7px;
  top: 50%;
  color: var(--muted);
  font-size: .72rem;
  transform: translateY(-50%);
  pointer-events: none;
}

.weekly-ai-result {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.weekly-ai-result > .primary-action {
  width: 100%;
  margin-top: 14px;
}

.weekly-task p {
  margin: 2px 0 0;
  font-size: .82rem;
}

.target-line {
  display: grid;
  gap: 8px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.target-line > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.target-line > div:last-child {
  color: var(--muted);
  font-size: .82rem;
}

.target-line b {
  color: var(--danger);
}

.plan-intro {
  background: linear-gradient(145deg, var(--brand), #2e8f77);
  color: white;
}

.plan-intro .eyebrow,
.plan-intro p {
  color: rgb(255 255 255 / 82%);
}

.empty-state {
  padding: 24px;
  text-align: center;
  background: var(--canvas);
  border: 1px dashed #bfd1cc;
  border-radius: 12px;
}

.user-task {
  display: grid;
  gap: 10px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
}

.user-task-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.user-task-head > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-kind {
  padding: 4px 7px;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 7px;
  font-size: .72rem;
  font-weight: 800;
}

.icon-button {
  width: 36px;
  height: 36px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  font-size: 1.5rem;
}

.task-note {
  padding: 8px 10px;
  color: var(--muted);
  background: var(--canvas);
  border-radius: 8px;
}

.task-progress {
  display: grid;
  gap: 7px;
}

.task-progress > div:first-child {
  display: flex;
  justify-content: space-between;
  font-size: .82rem;
}

.progress-controls {
  display: grid;
  grid-template-columns: 1fr 70px 1fr;
  gap: 8px;
}

.progress-controls button {
  min-height: 40px;
  color: var(--brand);
  background: var(--brand-soft);
  border: 0;
  border-radius: 9px;
  font-weight: 800;
}

.progress-controls input {
  min-height: 40px;
  text-align: center;
}

.task-number-grid {
  grid-template-columns: repeat(2, 1fr);
}

.button-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.button-row > * {
  flex: 1;
}

.plan-review-result {
  margin-top: 16px;
  padding: 15px;
  background: #f0f7f5;
  border: 1px solid #c8ded8;
  border-radius: 14px;
}

.direct-answer {
  margin: 12px 0;
  padding: 12px;
  background: white;
  border-left: 4px solid var(--brand);
  border-radius: 8px;
}

.direct-answer small {
  color: var(--brand);
  font-weight: 800;
}

.direct-answer p {
  margin-bottom: 0;
  color: var(--ink);
}

.ratio-bar {
  display: flex;
  height: 34px;
  overflow: hidden;
  border-radius: 10px;
}

.ratio-bar span {
  display: grid;
  min-width: 0;
  place-items: center;
  color: white;
  background: #5e8fb5;
  font-size: .72rem;
  font-weight: 800;
}

.ratio-bar span:last-child {
  background: var(--brand);
}

.review-task {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid #c8ded8;
}

.review-task > div {
  display: grid;
  gap: 4px;
}

.review-task span {
  color: var(--brand);
  font-size: .75rem;
  font-weight: 800;
}

.review-task p {
  margin: 0;
}

.review-applied {
  padding: 8px 10px;
  color: var(--brand) !important;
  background: var(--brand-soft);
  border-radius: 8px;
  font-size: .8rem;
}

.home-four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.home-focus {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.home-focus span {
  color: var(--muted);
  font-size: .8rem;
}

.stage-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin: 20px 0 24px;
}

.stage-track-line {
  position: absolute;
  z-index: 0;
  top: 14px;
  right: 12.5%;
  left: 12.5%;
  height: 5px;
  overflow: hidden;
  background: #efb5b5;
  border-radius: 999px;
}

.stage-track-line i {
  display: block;
  height: 100%;
  background: #4d91cb;
}

.stage-node {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 5px;
  text-align: center;
}

.stage-node i {
  width: 28px;
  height: 28px;
  background: #eaa0a0;
  border: 5px solid white;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #d7dfdd;
}

.stage-node.completed i,
.stage-node.current i {
  background: #4d91cb;
}

.stage-node span {
  position: absolute;
  top: 6px;
  color: white;
  font-size: .68rem;
  font-weight: 800;
}

.stage-node small {
  max-width: 7rem;
  color: var(--muted);
  font-size: .68rem;
}

.current-stage {
  padding: 15px;
  background: var(--canvas);
  border-radius: 13px;
}

.current-stage h3 {
  margin: 3px 0;
}

.stage-detail {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.stage-detail span {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: .82rem;
}

.stage-detail b {
  color: var(--ink);
}

.correction-box {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
}

.correction-box summary {
  color: var(--brand);
  cursor: pointer;
  font-weight: 800;
}

.correction-box form {
  margin-top: 12px;
}

.correction-result {
  margin-top: 12px;
  padding: 12px;
  background: var(--brand-soft);
  border-radius: 10px;
}

.timing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--border);
}

.timing-row > div {
  display: grid;
  gap: 3px;
}

.timing-row > div:last-child {
  text-align: right;
}

.timing-row small,
.timing-row span {
  color: var(--muted);
  font-size: .75rem;
}

.timing-row .late { color: var(--danger); }
.timing-row .good { color: var(--brand); }

.check-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

.check-field input {
  width: auto;
  min-height: auto;
}

.target-question-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
}

.target-question-form button {
  grid-column: 1 / -1;
}

.target-input {
  display: grid;
  grid-template-columns: 1fr 90px auto;
  align-items: center;
  gap: 6px;
}

.target-input input {
  min-width: 0;
}

.clean-list {
  margin: 0;
  padding-left: 20px;
}

.progress-row {
  display: grid;
  grid-template-columns: 7.5rem 1fr 3rem;
  margin: 10px 0;
  font-size: .82rem;
}

progress {
  width: 100%;
  accent-color: var(--brand);
}

@media (max-width: 370px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .score-board,
  .trend-grid,
  .home-four,
  .target-question-form {
    grid-template-columns: 1fr;
  }

  .focus-stats {
    grid-template-columns: 1fr;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .weekly-target-head {
    display: none;
  }

  .weekly-target-row {
    grid-template-columns: 1fr repeat(3, minmax(0, 1fr));
  }
}

.page {
  width: min(100%, 42rem);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 24px 16px calc(88px + env(safe-area-inset-bottom));
}

.page h1 {
  margin: 0;
  font-size: 1.5rem;
}

.page p {
  color: var(--muted);
}

.onboarding-header {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 0.875rem;
  font-weight: 700;
}

.onboarding-form {
  display: grid;
  gap: 18px;
}

.onboarding-form fieldset {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.onboarding-form legend {
  padding: 0 6px;
  font-weight: 700;
}

.field,
.module-row {
  display: grid;
  gap: 6px;
}

.field > span,
.field-help {
  color: var(--muted);
  font-size: 0.875rem;
}

.field-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
}

.module-row {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.form-errors,
.startup-error {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.form-errors ul {
  margin-bottom: 0;
  padding-left: 20px;
}

.primary-action {
  min-height: 48px;
  padding: 12px 16px;
  color: white;
  background: var(--brand);
  border: 0;
  border-radius: 12px;
  font-weight: 700;
}

.bottom-nav {
  position: fixed;
  z-index: 10;
  inset: auto 0 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 8px 4px max(8px, env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.bottom-nav[hidden] {
  display: none;
}

.bottom-nav button {
  min-width: 0;
  min-height: 48px;
  padding: 4px;
  overflow: hidden;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 10px;
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottom-nav button.active {
  color: var(--brand);
  background: var(--brand-soft);
  font-weight: 700;
}

.bottom-nav button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
