:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #f9fbfd;
  --line: #dce5ea;
  --line-soft: #e9eef2;
  --text: #102033;
  --muted: #5b6878;
  --subtle: #8793a3;
  --teal: #0aa6a0;
  --teal-dark: #078780;
  --teal-soft: #e8f8f6;
  --coral: #ef6b4d;
  --coral-soft: #fff0eb;
  --green: #2f9e55;
  --green-soft: #e9f8ef;
  --amber: #f4b41b;
  --navy: #142238;
  --shadow: 0 18px 42px rgba(19, 38, 58, 0.08);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.62;
}

svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.app-shell {
  min-height: 100vh;
  max-width: 100vw;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  min-width: 0;
  padding: 28px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--teal), #20c7b3);
  color: #fff;
  font-weight: 800;
}

.brand strong {
  display: block;
  color: var(--teal-dark);
  font-size: 24px;
  line-height: 1.05;
}

.brand span {
  display: block;
  color: var(--navy);
  margin-top: 7px;
}

.nav-list {
  min-width: 0;
  max-width: 100%;
  display: grid;
  gap: 8px;
}

.nav-item,
.profile-button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  color: var(--navy);
  text-align: left;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-item:hover,
.profile-button:hover {
  background: var(--surface-soft);
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, var(--teal), #05b7ad);
  box-shadow: 0 10px 24px rgba(10, 166, 160, 0.2);
}

.profile-button {
  margin-top: auto;
  width: 100%;
  justify-content: flex-start;
}

.profile-button svg {
  margin-left: auto;
}

.avatar {
  width: 34px;
  height: 34px;
  border: 1px solid var(--navy);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
}

.main {
  padding: 24px;
  min-width: 0;
}

.topbar {
  min-height: 46px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.topbar h1 {
  display: inline-block;
  margin: 0 20px 0 0;
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: 0;
}

.date-chip {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--navy);
  box-shadow: 0 6px 16px rgba(20, 34, 56, 0.04);
}

.streak {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--navy);
  white-space: nowrap;
}

.streak strong {
  font-size: 24px;
}

.reminder-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.reminder-panel,
.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.reminder-panel {
  padding: 18px 20px;
}

.reminder-panel.mint {
  background: linear-gradient(135deg, #f4fffd, #ffffff);
  border-color: #c9e9e5;
}

.reminder-panel.coral {
  background: linear-gradient(135deg, #fff8f5, #ffffff);
  border-color: #f3d1c6;
}

.reminder-head,
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.reminder-head h2,
.panel-head h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0;
}

.reminder-head strong {
  color: var(--teal);
  font-size: 18px;
}

.coral .reminder-head strong {
  color: var(--coral);
}

.check-row {
  min-height: 56px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--navy);
}

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

input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--teal);
}

.mini-input {
  width: 76px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 9px;
  text-align: right;
}

.routine-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--teal);
}

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

.panel {
  min-width: 0;
  padding: 16px;
}

.text-button {
  min-height: 30px;
  border: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
}

.text-button svg {
  width: 16px;
  height: 16px;
}

.word-stage {
  min-height: 190px;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 16px 4px 10px;
}

.word-sound {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--teal);
  background: var(--teal-soft);
}

.scenario-label {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 700;
}

.word-stage h3 {
  margin: 0;
  font-size: 32px;
  line-height: 1.1;
}

.word-stage p,
.word-stage small {
  display: block;
  margin: 8px 0;
  color: var(--muted);
}

.word-stage strong {
  display: block;
  margin-top: 16px;
  font-size: 17px;
}

.word-actions {
  display: grid;
  grid-template-columns: 54px minmax(0, 92px) minmax(0, 100px) 54px;
  gap: 10px;
  margin-bottom: 14px;
}

.icon-button,
.soft-button,
.primary-button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  font-weight: 700;
}

.icon-button {
  background: var(--surface);
  color: var(--muted);
}

.icon-button:first-child svg {
  transform: rotate(180deg);
}

.primary-button {
  border-color: var(--teal);
  background: linear-gradient(135deg, var(--teal), #09b8ac);
  color: #fff;
}

.soft-button {
  color: var(--teal-dark);
  background: var(--teal-soft);
  border-color: #afe2dd;
}

.wide {
  width: 100%;
  margin-top: 12px;
}

.metric-line {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 14px;
}

.metric-line strong {
  color: var(--green);
}

.progress-track {
  height: 8px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 99px;
  background: #e8edf1;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), #40c6bd);
}

.mood-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 18px 0;
}

.mood-button {
  min-height: 64px;
  border: 1px solid transparent;
  border-radius: 8px;
  display: grid;
  place-items: center;
  gap: 7px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
}

.mood-button span {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.mood-0 span {
  background: #f05a6a;
}

.mood-1 span {
  background: #f5a642;
}

.mood-2 span {
  background: #f2ca3b;
}

.mood-3 span {
  background: #80c96b;
}

.mood-4 span {
  background: var(--teal);
}

.mood-button.selected {
  border-color: var(--teal);
  color: var(--navy);
  background: var(--teal-soft);
}

.field-line,
.quality-row {
  min-height: 56px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px 38px;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line-soft);
}

.field-line input,
.body-grid input,
.input-grid input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--navy);
  background: var(--surface);
}

.quality-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.quality-row div {
  display: flex;
  gap: 8px;
}

.quality-dot {
  width: 24px;
  height: 24px;
  border: 1px solid #cbd5dd;
  border-radius: 50%;
  background: var(--surface);
}

.quality-dot.filled {
  background: var(--teal);
  border-color: var(--teal);
}

.calorie-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 17px 0 14px;
  text-align: center;
}

.calorie-summary div {
  border-right: 1px solid var(--line);
}

.calorie-summary div:last-child {
  border-right: 0;
}

.calorie-summary span,
.calorie-summary small {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.calorie-summary strong {
  display: block;
  margin: 4px 0 2px;
  font-size: 26px;
  line-height: 1.1;
}

.green {
  color: var(--green);
}

.nutrition-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  padding: 15px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.calorie-ring {
  --fill: 50%;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  background: conic-gradient(var(--teal) var(--fill), var(--coral) 0 78%, var(--amber) 0 100%);
  position: relative;
}

.calorie-ring::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: #fff;
}

.calorie-ring strong,
.calorie-ring span {
  position: relative;
  z-index: 1;
}

.calorie-ring strong {
  font-size: 25px;
}

.calorie-ring span {
  color: var(--muted);
  font-size: 12px;
}

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

.nutrition-list span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.teal {
  background: var(--teal);
}

.coral {
  background: var(--coral);
}

.amber {
  background: var(--amber);
}

.green-dot {
  background: var(--green);
}

.activity-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding-top: 14px;
}

.activity-strip span {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.activity-strip strong {
  color: var(--navy);
}

.journal-panel textarea {
  width: 100%;
  height: 156px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
  padding: 14px;
  color: var(--navy);
  background: #fbfcfd;
}

.tab-row {
  display: flex;
  gap: 18px;
  padding-top: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.tab-row button {
  border: 0;
  padding: 0 0 10px;
  background: transparent;
  color: var(--muted);
}

.tab-row button.active {
  color: var(--teal-dark);
  box-shadow: inset 0 -3px var(--teal);
}

.journal-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  color: var(--subtle);
}

.progress-panel {
  display: flex;
  flex-direction: column;
}

.progress-task {
  min-height: 58px;
  display: grid;
  grid-template-columns: 24px minmax(112px, 1fr) 48px 104px;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
}

.progress-task:last-child {
  border-bottom: 0;
}

.progress-task em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  text-align: right;
}

.progress-task i {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: #e6ebef;
}

.progress-task b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.plan-table {
  padding-top: 8px;
}

.plan-row {
  min-height: 39px;
  display: grid;
  grid-template-columns: 22px 38px minmax(104px, 1fr) 58px 54px;
  align-items: center;
  gap: 7px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}

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

.plan-row span {
  color: var(--teal-dark);
  font-weight: 700;
}

.plan-row strong {
  min-width: 0;
  line-height: 1.25;
}

.plan-row em,
.plan-row small {
  color: var(--muted);
  font-style: normal;
  text-align: right;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.input-grid,
.body-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
  padding-top: 14px;
}

.body-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.input-grid label,
.body-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.food-grid {
  grid-template-columns: minmax(0, 1fr) 110px 100px auto;
}

.switch-line {
  min-height: 40px;
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  padding-top: 19px;
}

.switch-line input {
  width: 18px;
  height: 18px;
}

.log-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.log-list span {
  min-height: 34px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
}

.log-list strong {
  color: var(--navy);
}

.quiet-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 14px 16px;
    gap: 14px;
    overflow-x: hidden;
  }

  .brand {
    padding: 0;
  }

  .nav-list {
    display: flex;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .nav-item {
    flex: 0 0 auto;
  }

  .profile-button {
    display: none;
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body {
    overflow-x: hidden;
  }

  .app-shell {
    overflow-x: hidden;
  }

  .main {
    width: 100vw;
    max-width: 100vw;
    padding: 16px;
    overflow-x: hidden;
  }

  .sidebar {
    width: 100vw;
    max-width: 100vw;
  }

  .reminder-grid,
  .dashboard-grid,
  .detail-grid {
    width: 100%;
    max-width: 100%;
  }

  .reminder-panel,
  .panel {
    width: 100%;
    max-width: calc(100vw - 32px);
    overflow: hidden;
  }

  .topbar {
    display: grid;
  }

  .topbar h1 {
    display: block;
    margin: 0 0 10px;
    font-size: 28px;
  }

  .streak {
    white-space: normal;
  }

  .reminder-grid,
  .dashboard-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .word-stage {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .word-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .word-actions > * {
    min-width: 0;
  }

  .mood-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calorie-summary,
  .activity-strip {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .calorie-summary div {
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
    padding: 10px 0;
  }

  .nutrition-row {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .progress-task {
    grid-template-columns: 24px minmax(0, 1fr) 54px;
  }

  .progress-task i {
    grid-column: 2 / -1;
    width: 100%;
  }

  .plan-row {
    grid-template-columns: 24px 42px minmax(0, 1fr);
  }

  .plan-row em,
  .plan-row small {
    display: none;
  }

  .input-grid,
  .food-grid,
  .body-grid {
    grid-template-columns: 1fr;
  }

  .switch-line {
    padding-top: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
