:root {
  --ink: #17261e;
  --muted: #718076;
  --line: #dce2d9;
  --paper: #f7f5ee;
  --surface: #fffef9;
  --soft: #edf1e9;
  --green: #215840;
  --green-deep: #173f2f;
  --lime: #d6ed68;
  --orange: #ed9b53;
  --red: #a74437;
  --shadow: 0 15px 45px rgba(31, 60, 43, 0.09);
  --radius: 22px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 100% 0%, rgba(214, 237, 104, .22), transparent 28rem),
    var(--paper);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

a { color: inherit; text-decoration: none; }

.page-shell { width: min(100%, 760px); margin: 0 auto; padding: 0 20px 112px; }

.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 13px 13px 13px 4px;
  color: var(--surface);
  background: var(--green-deep);
  font-family: Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
}
.brand strong { display: block; letter-spacing: .04em; font-size: .96rem; }
.brand small { display: block; color: var(--muted); margin-top: 1px; font-size: .66rem; }

.sync-state { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .74rem; }
.sync-state i { width: 7px; height: 7px; display: block; border-radius: 50%; background: var(--orange); }
.sync-state.ok i { background: #65a965; }
.sync-state.error i { background: var(--red); }

.view { display: none; animation: rise .32s ease both; }
.view.is-active { display: block; }

.hero { padding: 33px 2px 28px; }
.eyebrow { margin: 0 0 8px; color: var(--green); letter-spacing: .13em; font-size: .69rem; font-weight: 800; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 13px; font-size: clamp(2rem, 7vw, 3.25rem); line-height: 1.1; letter-spacing: -.055em; }
h1 em { color: var(--green); font-family: Georgia, "Songti SC", serif; font-weight: 500; }
h2 { margin-bottom: 0; font-size: 1.13rem; letter-spacing: -.035em; }
.hero-copy, .view-intro > p:last-child { margin-bottom: 24px; color: var(--muted); font-size: .91rem; line-height: 1.65; }
.view-intro { padding: 26px 2px 21px; }
.view-intro h1 { margin-bottom: 10px; font-size: clamp(1.85rem, 7vw, 2.65rem); }

.primary-button, .secondary-button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 20px;
  border: 0;
  border-radius: 15px;
  padding: 0 19px;
  cursor: pointer;
  font-weight: 800;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.primary-button { color: var(--surface); background: var(--green-deep); box-shadow: 0 8px 20px rgba(23, 63, 47, .18); }
.primary-button:hover, .primary-button:focus-visible { background: #0d3223; transform: translateY(-1px); }
.primary-button span { font-size: 1.2rem; line-height: .8; }
.primary-button.small { min-height: 41px; padding: 0 15px; font-size: .83rem; }
.secondary-button { min-height: 42px; color: var(--green-deep); background: var(--lime); }
.secondary-button:hover, .secondary-button:focus-visible { background: #c9e25c; }

.metric-strip { display: grid; grid-template-columns: .78fr .78fr 1.55fr; gap: 9px; margin-bottom: 14px; }
.metric-card { min-height: 116px; display: flex; flex-wrap: wrap; align-content: flex-end; padding: 16px 14px; border-radius: 19px; background: var(--green-deep); color: var(--surface); }
.metric-card:nth-child(2) { background: var(--orange); color: #422913; }
.metric-card.wide { background: var(--lime); color: var(--green-deep); }
.metric-card span { width: 100%; align-self: flex-start; opacity: .8; font-size: .68rem; font-weight: 800; }
.metric-card strong { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 1.65rem; letter-spacing: -.07em; }
.metric-card small { align-self: flex-end; margin: 0 0 3px 3px; font-size: .68rem; font-weight: 700; }
.metric-card.wide strong { font-size: .96rem; letter-spacing: -.03em; }

.assistant-card, .card, .weekly-card {
  margin-bottom: 27px;
  padding: 22px;
  border: 1px solid rgba(220, 226, 217, .9);
  border-radius: var(--radius);
  background: rgba(255, 254, 249, .88);
  box-shadow: var(--shadow);
}
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.section-heading.compact { margin-bottom: 13px; }
.text-button { padding: 3px 0; border: 0; color: var(--green); background: transparent; cursor: pointer; font-size: .78rem; font-weight: 800; }
.text-button:hover, .text-button:focus-visible { color: var(--green-deep); text-decoration: underline; }

.plan-list { display: grid; gap: 0; }
.plan-item { display: grid; grid-template-columns: 79px 1fr; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.plan-item:first-child { border-top: 0; padding-top: 1px; }
.plan-item-label { color: var(--muted); font-size: .72rem; font-weight: 800; }
.plan-item-content { font-size: .88rem; line-height: 1.6; }
.plan-item-content p { margin: 0 0 6px; }
.plan-item-content p:last-child { margin-bottom: 0; }
.plan-item-content .subtle { color: var(--muted); font-size: .79rem; }
.safety-note { margin: 0 0 14px; padding: 10px 12px; border-radius: 11px; color: #7e2d25; background: #fbe6e3; font-size: .8rem; line-height: 1.55; }
.hidden { display: none !important; }

.section-block { margin: 0 0 27px; }
.task-list, .log-list { display: grid; gap: 9px; }
.task-card { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255, 254, 249, .64); }
.task-card.is-done { opacity: .58; }
.task-card h3 { margin: 0 0 5px; font-size: .91rem; line-height: 1.4; letter-spacing: -.02em; }
.task-meta { display: flex; flex-wrap: wrap; gap: 5px; color: var(--muted); font-size: .68rem; }
.pill { display: inline-flex; align-items: center; min-height: 20px; padding: 2px 7px; border: 1px solid var(--line); border-radius: 99px; background: #fff; }
.pill.high { color: #8b3c23; border-color: #f1c8a3; background: #fff7ef; }
.pill.waiting { color: #66746b; background: var(--soft); }
.task-actions { display: flex; align-items: center; gap: 5px; }
.icon-button { display: grid; width: 32px; height: 32px; place-items: center; border: 1px solid var(--line); border-radius: 10px; color: var(--green); background: var(--surface); cursor: pointer; font-size: 1rem; }
.icon-button:hover, .icon-button:focus-visible { border-color: var(--green); background: var(--soft); }
.task-note { grid-column: 1 / -1; margin: -3px 0 0; color: var(--muted); font-size: .73rem; line-height: 1.45; }

.quick-note-form { display: grid; gap: 10px; }
label { display: grid; gap: 7px; color: #36453c; font-size: .8rem; font-weight: 800; }
textarea, input, select { width: 100%; border: 1px solid #d4ddd3; border-radius: 12px; outline: none; color: var(--ink); background: #fffefa; }
textarea { resize: vertical; padding: 11px 12px; line-height: 1.55; }
input, select { min-height: 42px; padding: 0 11px; }
textarea:focus, input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(33, 88, 64, .12); }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field-hint { color: var(--muted); font-size: .71rem; line-height: 1.4; }

.details-card { margin-bottom: 23px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255, 254, 249, .72); overflow: hidden; }
.details-card summary { display: flex; justify-content: space-between; align-items: center; min-height: 63px; padding: 0 19px; cursor: pointer; list-style: none; font-size: .92rem; font-weight: 800; }
.details-card summary::-webkit-details-marker { display: none; }
.details-card summary::before { content: '+'; margin-right: 9px; color: var(--green); font-size: 1.16rem; }
.details-card[open] summary::before { content: '−'; }
.details-card summary span { margin-left: auto; color: var(--muted); font-size: .69rem; font-weight: 600; }
.record-form { display: grid; gap: 15px; padding: 2px 19px 20px; }
.form-grid { display: grid; gap: 12px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
input[type="range"] { min-height: 20px; padding: 0; accent-color: var(--green); }
.range-value { color: var(--green); }
.choice-group { display: flex; flex-wrap: wrap; gap: 10px 17px; margin: 0; padding: 0; border: 0; }
.choice-group legend { width: 100%; margin-bottom: 2px; color: #36453c; font-size: .8rem; font-weight: 800; }
.choice-group label, .warning-choice { display: flex; align-items: center; gap: 7px; font-size: .77rem; font-weight: 600; }
.choice-group input, .warning-choice input { width: auto; min-height: 0; accent-color: var(--green); }
.warning-choice { padding: 11px 12px; border-radius: 11px; color: #7b3730; background: #fff0ed; line-height: 1.4; }

.log-card { padding: 14px 15px; border-left: 3px solid var(--lime); border-radius: 0 13px 13px 0; background: var(--surface); }
.log-card time { color: var(--muted); font-size: .69rem; font-weight: 800; }
.log-card p { margin: 6px 0 0; font-size: .79rem; line-height: 1.55; }
.empty { padding: 18px; border-radius: 14px; color: var(--muted); background: var(--soft); font-size: .83rem; line-height: 1.6; }

.task-create { background: var(--surface); }
.filter-row { display: flex; gap: 6px; overflow-x: auto; margin: 0 0 15px; padding-bottom: 2px; }
.filter { flex: 0 0 auto; min-height: 32px; border: 1px solid var(--line); border-radius: 99px; padding: 0 12px; color: var(--muted); background: transparent; cursor: pointer; font-size: .72rem; font-weight: 700; }
.filter.is-selected { border-color: var(--green-deep); color: var(--surface); background: var(--green-deep); }
.task-list.full .task-card { background: var(--surface); }

.review-form { display: grid; gap: 14px; }
.review-form h2 { margin-bottom: 1px; }
.weekly-card { background: linear-gradient(145deg, #edf5db, #fffef9 60%); }
.weekly-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 15px 0; }
.weekly-kpis div { padding: 12px 8px; border-radius: 13px; text-align: center; background: rgba(255,255,255,.66); }
.weekly-kpis strong { display: block; color: var(--green-deep); font-size: 1.25rem; }
.weekly-kpis span { color: var(--muted); font-size: .66rem; }
.weekly-copy { margin: 0 0 12px; font-size: .83rem; line-height: 1.62; }
.weekly-card h3 { margin: 15px 0 8px; font-size: .84rem; }
.weekly-card ol, .weekly-card ul { margin: 0; padding-left: 19px; font-size: .8rem; line-height: 1.65; }
.weekly-card li + li { margin-top: 5px; }
.missing-note { margin-top: 13px; padding: 10px 11px; border-radius: 10px; color: #73622e; background: #fff6cc; font-size: .75rem; line-height: 1.5; }

.bottom-nav { position: fixed; z-index: 5; left: 50%; bottom: 17px; display: grid; grid-template-columns: repeat(4, 1fr); width: min(calc(100% - 28px), 550px); padding: 6px; transform: translateX(-50%); border: 1px solid rgba(220, 226, 217, .85); border-radius: 20px; background: rgba(255, 254, 249, .91); box-shadow: 0 12px 35px rgba(23, 63, 47, .16); backdrop-filter: blur(15px); }
.nav-item { display: grid; place-items: center; min-height: 48px; border-radius: 14px; color: var(--muted); font-size: .66rem; font-weight: 800; }
.nav-item span { margin-bottom: 2px; font-size: 1.15rem; line-height: .9; font-weight: 500; }
.nav-item.is-active { color: var(--surface); background: var(--green-deep); }

.toast { position: fixed; z-index: 9; left: 50%; bottom: 97px; max-width: calc(100% - 48px); padding: 11px 15px; transform: translate(-50%, 20px); border-radius: 11px; color: #fff; background: #24342a; box-shadow: 0 8px 24px rgba(0,0,0,.18); opacity: 0; pointer-events: none; font-size: .78rem; transition: opacity .2s ease, transform .2s ease; }
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; }

.auth-gate { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 22px; background: rgba(247, 245, 238, .94); backdrop-filter: blur(12px); }
.auth-card { width: min(100%, 390px); display: grid; gap: 16px; padding: 31px 25px; border: 1px solid var(--line); border-radius: 26px; background: var(--surface); box-shadow: var(--shadow); }
.auth-card .brand-mark { margin-bottom: 6px; }
.auth-card .eyebrow { margin-bottom: -7px; }
.auth-card h1 { margin: 0; font-size: 2.05rem; }
.auth-card > p:not(.eyebrow):not(.auth-error) { margin: -7px 0 2px; color: var(--muted); font-size: .82rem; line-height: 1.55; }
.auth-card .primary-button { width: 100%; margin-top: 2px; }
.auth-error { margin: -5px 0 0; color: var(--red); font-size: .76rem; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (min-width: 680px) {
  .page-shell { padding-right: 28px; padding-left: 28px; }
  .topbar { height: 88px; }
  .hero { padding-top: 42px; }
  .metric-card { min-height: 125px; }
  .assistant-card, .card, .weekly-card { padding: 27px; }
}

@media (max-width: 390px) {
  .page-shell { padding-right: 15px; padding-left: 15px; }
  .metric-card { padding: 14px 11px; }
  .metric-card strong { font-size: 1.42rem; }
  .metric-card.wide strong { font-size: .84rem; }
  .form-grid.two { grid-template-columns: 1fr; }
  .form-actions { align-items: flex-end; }
}
