:root {
  --bg: #f6f4ee;
  --surface: #fffdfa;
  --text: #20231e;
  --muted: #74776f;
  --line: #e7e4dc;
  --green: #2f6b4f;
  --green-soft: #dcebe1;
  --orange: #d87c46;
  --orange-soft: #f7e4d7;
  --blue: #5076a1;
  --blue-soft: #dfe9f3;
  --purple: #806995;
  --purple-soft: #ebe3f1;
  --danger: #ad4b48;
  --radius: 22px;
  --shadow: 0 12px 30px rgba(50, 49, 42, .07);
}
* { box-sizing: border-box; }
html { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { margin: 0; min-height: 100vh; background: var(--bg); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
#app { width: min(100%, 760px); min-height: 100vh; margin: 0 auto; padding: max(18px, env(safe-area-inset-top)) 18px calc(96px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 76px; margin-bottom: 18px; }
.eyebrow { margin: 0 0 5px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(25px, 7vw, 34px); letter-spacing: -.04em; }
h2 { margin-bottom: 0; font-size: 23px; letter-spacing: -.03em; }
h3 { margin-bottom: 5px; font-size: 17px; }
.icon-button, .close-button { border: 0; border-radius: 50%; background: var(--text); color: white; cursor: pointer; }
.icon-button { width: 48px; height: 48px; font-size: 28px; line-height: 1; box-shadow: var(--shadow); }
.close-button { width: 36px; height: 36px; background: #eeece6; color: var(--text); font-size: 24px; }
.page { display: none; animation: appear .18s ease; }
.page.active { display: block; }
@keyframes appear { from { opacity: 0; transform: translateY(4px); } }
.hero { position: relative; overflow: hidden; padding: 24px; border-radius: 28px; background: var(--green); color: white; box-shadow: var(--shadow); }
.hero::after { content: ""; position: absolute; width: 150px; height: 150px; right: -55px; top: -60px; border-radius: 50%; background: rgba(255,255,255,.08); }
.hero p { margin-bottom: 18px; color: rgba(255,255,255,.76); }
.hero-number { display: flex; align-items: baseline; gap: 7px; }
.hero-number strong { font-size: 52px; line-height: .95; letter-spacing: -.06em; }
.hero-number span { opacity: .78; }
.hero-progress { height: 7px; margin-top: 20px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.18); }
.hero-progress i { display: block; height: 100%; border-radius: inherit; background: #fff; }
.section-head { display: flex; align-items: end; justify-content: space-between; margin: 28px 2px 12px; }
.section-head h2 { font-size: 20px; }
.section-head button, .text-button { border: 0; padding: 4px; background: transparent; color: var(--green); font-size: 14px; font-weight: 700; }
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.summary-card, .card { border: 1px solid rgba(36,37,31,.04); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.summary-card { min-height: 138px; padding: 18px; text-align: left; cursor: pointer; }
.summary-card .icon { display: grid; width: 38px; height: 38px; place-items: center; margin-bottom: 17px; border-radius: 13px; font-size: 19px; }
.summary-card strong { display: block; margin-bottom: 4px; font-size: 20px; }
.summary-card small { color: var(--muted); }
.sleep .icon { background: var(--blue-soft); color: var(--blue); }
.exercise .icon { background: var(--orange-soft); color: var(--orange); }
.mood .icon { background: var(--purple-soft); color: var(--purple); }
.study .icon { background: var(--green-soft); color: var(--green); }
.card { padding: 18px; }
.empty { padding: 26px 18px; text-align: center; color: var(--muted); }
.empty strong { display: block; margin-bottom: 6px; color: var(--text); }
.list { display: grid; gap: 10px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); cursor: pointer; }
.list-item.done { opacity: .58; }
.list-item.done .item-title { text-decoration: line-through; }
.item-dot { flex: 0 0 auto; width: 11px; height: 11px; border-radius: 50%; background: var(--green); }
.item-main { min-width: 0; flex: 1; }
.item-title { overflow: hidden; margin-bottom: 3px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.item-meta { color: var(--muted); font-size: 12px; }
.badge { flex: 0 0 auto; padding: 5px 9px; border-radius: 99px; background: #efeee9; color: var(--muted); font-size: 11px; font-weight: 700; }
.check-button { display: grid; flex: 0 0 auto; width: 29px; height: 29px; place-items: center; border: 1.5px solid #cbc9c2; border-radius: 50%; background: transparent; }
.done .check-button { border-color: var(--green); background: var(--green); color: white; }
.action-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.action-card { min-height: 122px; padding: 18px; border: 0; border-radius: var(--radius); text-align: left; cursor: pointer; }
.action-card span { display: block; margin-bottom: 20px; font-size: 25px; }
.action-card strong { display: block; font-size: 16px; }
.action-card small { color: var(--muted); }
.action-card:nth-child(1) { background: var(--blue-soft); }
.action-card:nth-child(2) { background: var(--orange-soft); }
.action-card:nth-child(3) { background: var(--purple-soft); }
.action-card:nth-child(4) { background: var(--green-soft); }
.action-card:nth-child(5) { background: #ece8dc; }
.action-card:nth-child(6) { background: #e5e8e0; }
.segmented { display: flex; gap: 4px; padding: 4px; margin-bottom: 16px; border-radius: 15px; background: #eae8e1; }
.segmented button { flex: 1; padding: 9px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: 0 2px 8px rgba(40,40,35,.08); }
.course-row { display: flex; gap: 11px; overflow-x: auto; padding: 2px 1px 8px; scrollbar-width: none; }
.course-chip { min-width: 132px; padding: 15px; border: 0; border-radius: 17px; background: var(--surface); box-shadow: var(--shadow); text-align: left; }
.course-chip i { display: block; width: 9px; height: 9px; margin-bottom: 18px; border-radius: 50%; }
.course-chip strong, .course-chip small { display: block; }
.course-chip small { margin-top: 3px; color: var(--muted); }
.review-card textarea { min-height: 74px; }
.review-card .primary { width: 100%; margin-top: 8px; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { padding: 18px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.stat span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.stat strong { font-size: 24px; letter-spacing: -.04em; }
.chart-card { padding: 18px 14px 12px; }
.chart { display: flex; height: 160px; align-items: end; gap: 7px; padding-top: 15px; }
.bar-group { display: flex; min-width: 0; height: 100%; flex: 1; flex-direction: column; align-items: center; justify-content: end; gap: 6px; }
.bar-value { height: 18px; color: var(--muted); font-size: 9px; white-space: nowrap; }
.bar { width: min(25px, 75%); min-height: 3px; border-radius: 7px 7px 3px 3px; background: var(--green); transition: height .25s ease; }
.bar-label { color: var(--muted); font-size: 10px; }
.settings-list { display: grid; gap: 1px; overflow: hidden; padding: 0; }
.settings-list button { display: flex; align-items: center; justify-content: space-between; padding: 17px 18px; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); text-align: left; }
.settings-list button:last-child { border-bottom: 0; }
.settings-list small { display: block; margin-top: 3px; color: var(--muted); }
.tabbar { position: fixed; z-index: 20; right: 0; bottom: 0; left: 0; display: flex; width: min(calc(100% - 20px), 570px); justify-content: space-around; margin: 0 auto max(9px, env(safe-area-inset-bottom)); padding: 8px 8px 7px; border: 1px solid rgba(35,35,30,.07); border-radius: 23px; background: rgba(255,253,250,.92); box-shadow: 0 12px 35px rgba(40,40,35,.17); backdrop-filter: blur(18px); }
.tab { display: grid; min-width: 62px; gap: 2px; place-items: center; padding: 5px 12px; border: 0; border-radius: 15px; background: transparent; color: #8a8c84; }
.tab span { height: 24px; font-size: 20px; line-height: 23px; }
.tab small { font-size: 10px; }
.tab.active { background: var(--green-soft); color: var(--green); font-weight: 700; }
dialog { width: min(calc(100% - 24px), 560px); max-height: min(88vh, 760px); margin: auto auto 10px; overflow-y: auto; border: 0; border-radius: 28px; background: var(--surface); box-shadow: 0 25px 80px rgba(20,20,18,.25); }
dialog::backdrop { background: rgba(26,28,24,.42); backdrop-filter: blur(3px); }
.modal-head { position: sticky; z-index: 2; top: 0; display: flex; align-items: start; justify-content: space-between; padding: 22px 20px 15px; background: var(--surface); }
#modalBody { display: grid; gap: 15px; padding: 4px 20px 10px; }
.modal-actions { position: sticky; z-index: 2; bottom: 0; display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; padding: 15px 20px max(18px, env(safe-area-inset-bottom)); background: linear-gradient(transparent 0, var(--surface) 18%); }
label { display: grid; gap: 7px; color: #4d504a; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 13px; outline: none; background: #faf9f5; color: var(--text); }
input, select { height: 47px; padding: 0 13px; }
textarea { min-height: 88px; padding: 13px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.choice { padding: 9px 13px; border: 1px solid var(--line); border-radius: 99px; background: #faf9f5; color: var(--muted); font-size: 13px; }
.choice.selected { border-color: var(--green); background: var(--green-soft); color: var(--green); font-weight: 700; }
.range-line { display: flex; align-items: center; gap: 12px; }
.range-line input { height: auto; padding: 0; accent-color: var(--green); box-shadow: none; }
.range-value { min-width: 45px; color: var(--green); font-size: 18px; text-align: right; }
.primary, .secondary, .danger { min-height: 44px; padding: 0 17px; border-radius: 13px; font-weight: 700; }
.primary { border: 0; background: var(--green); color: white; }
.secondary { border: 1px solid var(--line); background: #f2f0eb; }
.danger { border: 0; background: #f5dfde; color: var(--danger); }
.ghost { background: transparent; }
.hidden { display: none !important; }
#toast { position: fixed; z-index: 100; right: 20px; bottom: 100px; left: 20px; max-width: 420px; margin: auto; padding: 13px 18px; border-radius: 14px; background: #242720; color: white; opacity: 0; box-shadow: var(--shadow); text-align: center; transform: translateY(15px); transition: .2s; pointer-events: none; }
#toast.show { opacity: 1; transform: translateY(0); }
@media (min-width: 640px) { dialog { margin: auto; } .summary-grid { grid-template-columns: repeat(4, 1fr); } .action-grid { grid-template-columns: repeat(3, 1fr); } }
@media (prefers-color-scheme: dark) {
  :root { --bg:#171914; --surface:#20231d; --text:#f3f1e9; --muted:#a3a69d; --line:#353830; --green:#6aa481; --green-soft:#283e31; --orange-soft:#493429; --blue-soft:#293844; --purple-soft:#3a3041; --shadow:0 12px 30px rgba(0,0,0,.18); }
  input,select,textarea,.choice { background:#1a1c17; } .secondary,.badge { background:#2c2f28; } .close-button { background:#30332c; } .segmented { background:#151712; }
}
