:root {
  --bg: #f8f7f0;
  --paper: #fffdf7;
  --paper-strong: #ffffff;
  --ink: #20231f;
  --muted: #687063;
  --line: #ddd8c8;
  --green: #3f8f4b;
  --green-soft: #e9f4e5;
  --blue: #2f73b9;
  --blue-soft: #e8f1fb;
  --red: #bf3028;
  --red-soft: #fae9e5;
  --gold: #b7791f;
  --gold-soft: #fff2d6;
  --purple: #6a55a7;
  --shadow: 0 18px 42px rgba(62, 55, 36, 0.1);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(63, 143, 75, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(63, 143, 75, 0.05) 1px, transparent 1px),
    var(--bg);
  background-size: 34px 34px;
  color: var(--ink);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui,
    sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.hero {
  position: relative;
  min-height: 230px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 42%);
  align-items: center;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255, 253, 247, 0.96), rgba(255, 253, 247, 0.72) 48%, rgba(255, 253, 247, 0.12));
  z-index: 1;
}

.hero-copy {
  position: relative;
  z-index: 2;
  padding: 34px 38px;
}

.date-range {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 15px;
}

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

h1 {
  margin-bottom: 10px;
  font-size: clamp(40px, 4vw, 72px);
  line-height: 1.02;
  letter-spacing: 0;
  font-family: "STKaiti", "Kaiti SC", "KaiTi", serif;
}

.hero-text {
  max-width: 720px;
  margin-bottom: 22px;
  color: #3c4039;
  font-size: 18px;
  line-height: 1.72;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-login {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-width: 720px;
  margin-top: 14px;
}

.admin-login label {
  color: var(--muted);
  font-size: 13px;
}

.admin-login input {
  width: 180px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
}

.admin-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 7px;
  padding: 0 9px;
  color: var(--red);
  background: var(--red-soft);
  font-size: 13px;
  font-weight: 700;
}

.admin-status.active {
  color: var(--green);
  background: var(--green-soft);
}

.button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  color: var(--ink);
  background: var(--paper-strong);
}

.button.compact {
  min-height: 38px;
  padding: 0 12px;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button.primary {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.button.ghost:hover,
.button.primary:hover {
  transform: translateY(-1px);
}

.hero-asset {
  position: absolute;
  right: 0;
  top: 0;
  width: 56%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 16px 0;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.92);
  box-shadow: 0 12px 28px rgba(58, 52, 35, 0.07);
}

.metric {
  padding: 16px;
}

.metric-label,
.source-chip,
.points-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 6px;
  padding: 0 8px;
  font-size: 13px;
  color: var(--muted);
  background: rgba(63, 143, 75, 0.08);
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1.15;
}

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

.progress-track {
  height: 8px;
  margin: 12px 0 8px;
  overflow: hidden;
  border-radius: 99px;
  background: #e5e1d3;
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 180ms ease;
}

.progress-track.blue span {
  background: var(--blue);
}

.dashboard {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.left-rail,
.right-rail,
.main-stage {
  display: grid;
  gap: 16px;
}

.panel {
  padding: 16px;
}

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

.panel-heading h2 {
  margin-bottom: 4px;
  font-size: 18px;
}

.panel-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.analysis-list,
.task-overview,
.points-rules,
.reward-shop {
  display: grid;
  gap: 10px;
}

.analysis-card,
.overview-card,
.rule-card,
.reward-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-strong);
}

.analysis-card,
.overview-card,
.rule-card {
  padding: 12px;
}

.analysis-card strong,
.overview-card strong {
  display: block;
  margin-bottom: 5px;
}

.analysis-card p,
.overview-card p,
.rule-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.priority {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 22px;
  margin-right: 8px;
  border-radius: 5px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.priority.p0 {
  background: var(--red);
}

.priority.p1 {
  background: var(--gold);
}

.priority.p2 {
  background: var(--green);
}

.materials-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.materials-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 9px;
  align-items: center;
  min-height: 34px;
  color: #30342f;
  font-size: 14px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.tag {
  border-radius: 5px;
  padding: 3px 7px;
  color: var(--red);
  background: var(--red-soft);
  font-size: 12px;
  white-space: nowrap;
}

.tag.optional {
  color: var(--green);
  background: var(--green-soft);
}

.plan-heading {
  align-items: center;
}

.date-picker {
  display: grid;
  gap: 5px;
  min-width: 170px;
}

.date-picker label {
  color: var(--muted);
  font-size: 13px;
}

.date-picker input {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
}

.week-grid {
  display: grid;
  gap: 12px;
}

.week-card {
  display: grid;
  grid-template-columns: 145px minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.week-meta {
  padding: 14px;
  background: linear-gradient(180deg, var(--green-soft), #f7fbf5);
  border-right: 1px solid var(--line);
}

.week-meta h3 {
  margin-bottom: 8px;
  color: #246b32;
  font-size: 18px;
}

.week-meta p {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.week-meta strong {
  display: block;
  font-size: 13px;
}

.day-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 44px;
  padding: 9px 12px;
  border-bottom: 1px solid #eee8db;
}

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

.day-row.selected {
  background: #f4f9ff;
  box-shadow: inset 3px 0 0 var(--blue);
}

.day-date {
  color: var(--muted);
  font-size: 13px;
}

.day-tasks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.task-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  border: 1px solid #d9ddcf;
  border-radius: 7px;
  padding: 0 8px;
  background: #fff;
  color: #30342f;
  font-size: 13px;
}

.task-chip.readonly,
.check-row.readonly {
  background: #faf9f3;
  color: var(--muted);
}

.task-chip input:disabled,
.check-row input:disabled,
.recite-card input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.task-chip input,
.check-row input,
.recite-card input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

.day-points {
  color: var(--gold);
  font-size: 13px;
  white-space: nowrap;
}

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

.recite-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px;
  min-height: 78px;
  border: 1px solid #d9d1eb;
  border-radius: 8px;
  padding: 10px;
  background: #fbf9ff;
}

.recite-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--purple);
}

.recite-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.today-checklist {
  display: grid;
  gap: 9px;
}

.check-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 9px;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}

.check-row span {
  color: var(--muted);
  font-size: 13px;
}

.points-pill {
  color: var(--gold);
  background: var(--gold-soft);
  font-weight: 700;
}

.rule-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.rule-card strong {
  color: #2d332b;
}

.rule-card span {
  color: var(--gold);
  font-weight: 700;
}

.reward-card {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 10px;
  padding: 10px;
  align-items: center;
}

.reward-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 28px;
}

.reward-card strong {
  display: block;
  margin-bottom: 3px;
}

.reward-card small {
  display: block;
  color: var(--muted);
  line-height: 1.4;
}

.spend-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 108px;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #eee8db;
  align-items: end;
}

.spend-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

.spend-form input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
}

.spend-form .button {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 38px;
  justify-content: center;
}

.spend-form input:disabled {
  cursor: not-allowed;
  background: #f7f4eb;
}

.ledger {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.ledger li {
  display: grid;
  grid-template-columns: 76px 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  border-bottom: 1px solid #eee8db;
  color: var(--muted);
  font-size: 13px;
}

.ledger li:last-child {
  border-bottom: 0;
}

.ledger strong {
  color: var(--ink);
  font-weight: 600;
}

.ledger .spend-entry strong,
.ledger .spend-entry span:last-child {
  color: var(--red);
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.58);
}

@media (max-width: 1320px) {
  .dashboard {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .right-rail {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 980px) {
  .app-shell {
    width: min(100% - 20px, 760px);
  }

  .hero,
  .dashboard,
  .summary-grid,
  .right-rail {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .hero::before {
    background: rgba(255, 253, 247, 0.82);
  }

  .hero-asset {
    width: 100%;
    opacity: 0.42;
  }

  .hero-copy {
    padding: 28px 22px;
  }

  .week-card {
    grid-template-columns: 1fr;
  }

  .week-meta {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .day-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .recitation-grid {
    grid-template-columns: 1fr;
  }

  .plan-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .spend-form {
    grid-template-columns: 1fr;
  }
}
