:root {
  --paper: #f4f3f8;
  --surface: #ffffff;
  --ink: #22192e;
  --muted: #6e6680;
  --line: #ddd8e6;
  --cherry: #c81f55;
  --cherry-soft: #fbe3eb;
  --cherry-ink: #8f1239;
  --leaf: #2e8b67;
  --leaf-soft: #ddf2e9;
  --amber-soft: #fdf0d6;
  --amber-ink: #8a5a06;
  --radius-lg: 18px;
  --radius: 10px;
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #17121e; --surface: #211a2a; --ink: #eee8f5; --muted: #a79fb6; --line: #3a3046;
    --cherry: #e23d74; --cherry-soft: #47192b; --cherry-ink: #ffb3cb;
    --leaf: #5ccc9f; --leaf-soft: #17392c; --amber-soft: #3d2d0c; --amber-ink: #f5c86a;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.55 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cherry); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px;
  padding: 12px 24px; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs a { color: var(--muted); text-decoration: none; font-size: 15px; white-space: nowrap; padding: 6px 12px; border-radius: 999px; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current=page] { color: var(--cherry-ink); background: var(--cherry-soft); font-weight: 500; }
.logout { margin: 0; }
.top-actions { display: flex; gap: 6px; align-items: center; }
.top-actions a { text-decoration: none; color: var(--ink); }
.top-actions a[aria-current=page] { background: var(--cherry-soft); border-color: var(--cherry-soft); color: var(--cherry-ink); }
.list-card .btn { margin-left: auto; }
.drive.ok { background: var(--leaf-soft); color: var(--ink); padding: 12px 14px; border-radius: var(--radius); margin: 0; }

.btn { text-decoration: none; color: var(--ink); display: inline-block; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 16px;
  cursor: pointer; font-weight: 500; font-size: 15px; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--cherry); border-color: var(--cherry); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--cherry); border-color: transparent; background: transparent; padding-left: 0; }
.btn.small { padding: 5px 12px; font-size: 14px; }

main { max-width: 1180px; margin: 0 auto; padding: 0 24px 80px; }

/* ---------- hero: the one bold thing ---------- */
.hero { padding: 56px 0 24px; }
.hero-line { margin: 0; max-width: 22ch; font-size: clamp(30px, 4.6vw, 52px); line-height: 1.15; font-weight: 600;
  letter-spacing: -0.02em; text-wrap: balance; }
.hero-line b { font-weight: 700; color: var(--cherry); font-variant-numeric: tabular-nums; }

.block { margin-top: 48px; }
.block h2 { font-size: 22px; font-weight: 600; margin: 0 0 16px; letter-spacing: -0.01em; }
.empty { color: var(--muted); margin: 0; }

/* ---------- in progress ---------- */
.active-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.goal-card { background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column;
  border: 1px solid var(--line); }
.goal-card .photo { aspect-ratio: 16 / 9; background: var(--cherry-soft); display: grid; place-items: center;
  font-size: 56px; cursor: pointer; border: 0; padding: 0; width: 100%; }
.goal-card .photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.goal-card .body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.goal-card h3 { margin: 0; font-size: 18px; font-weight: 600; line-height: 1.3; }
.goal-card h3 button { all: unset; cursor: pointer; }
.goal-card h3 button:hover { color: var(--cherry); }
.meter { height: 10px; border-radius: 999px; background: var(--cherry-soft); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--cherry); border-radius: inherit; }
.meter-label { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.meter-label strong { color: var(--ink); font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 13px; padding: 2px 10px; border-radius: 999px; background: var(--paper); color: var(--muted); }
.tag.warn { background: var(--amber-soft); color: var(--amber-ink); }
.tag.done { background: var(--leaf-soft); color: var(--leaf); }
.tag.pending { background: var(--cherry-soft); color: var(--cherry-ink); }
.quicklog { display: flex; gap: 8px; margin-top: auto; padding-top: 6px; }
.quicklog input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; background: var(--paper); }
.quicklog input::placeholder { color: var(--muted); }

/* ---------- wishlist ---------- */
.wish-cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; align-items: start; }
.wish-col { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px; }
.wish-col h3 { margin: 0 0 10px; font-size: 15px; font-weight: 600; display: flex; justify-content: space-between; }
.wish-col h3 span { color: var(--muted); font-weight: 400; }
.wish-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.wish-item { all: unset; box-sizing: border-box; width: 100%; display: flex; gap: 10px; align-items: center; cursor: pointer;
  padding: 8px 10px; border-radius: var(--radius); font-size: 15px; line-height: 1.35; }
.wish-item:hover, .wish-item:focus-visible { background: var(--paper); }
.wish-item .ic { font-size: 20px; width: 24px; text-align: center; flex: none; }
.wish-col.unsorted { border-style: dashed; }

/* ---------- achievements & logs ---------- */
.list-card { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); }
.list-card li { display: flex; gap: 12px; align-items: baseline; padding: 12px 18px; border-top: 1px solid var(--line); }
.list-card li:first-child { border-top: 0; }
.list-card .when { color: var(--muted); font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 84px; }
.list-card .txt { flex: 1; }
.list-card .txt small { display: block; color: var(--muted); font-size: 14px; }
.link { all: unset; cursor: pointer; font-weight: 500; }
.link:hover { color: var(--cherry); }
.list-card:empty::before { content: attr(data-empty); display: block; padding: 14px 18px; color: var(--muted); }

.quiet details { color: var(--muted); font-size: 15px; }
.quiet summary { cursor: pointer; }
.quiet code { display: inline-block; margin-top: 4px; padding: 6px 10px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; color: var(--ink); user-select: all; word-break: break-all; }

/* ---------- drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(20, 12, 28, .38); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; height: 100dvh; width: min(560px, 100vw); background: var(--surface); z-index: 21;
  transform: translateX(100%); visibility: hidden; transition: transform .22s ease, visibility 0s .22s; overflow-y: auto; box-shadow: -12px 0 40px rgba(20, 12, 28, .18); }
.drawer.open { transform: none; visibility: visible; transition: transform .22s ease; }
.d-head { position: sticky; top: 0; background: var(--surface); display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--line); z-index: 1; }
.d-head h2 { margin: 0; font-size: 16px; font-weight: 600; color: var(--muted); }
.d-body { padding: 20px; display: flex; flex-direction: column; gap: 22px; }
.d-photo { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius-lg); background: var(--cherry-soft); overflow: hidden;
  display: grid; place-items: center; font-size: 72px; }
.d-photo img { width: 100%; height: 100%; object-fit: cover; }
.d-photo label { position: absolute; right: 10px; bottom: 10px; }
.d-photo input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.title-row { display: flex; gap: 10px; align-items: center; }
.title-row .icon-in { width: 56px; text-align: center; font-size: 26px; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.title-row .name-in { flex: 1; min-width: 0; font-size: 22px; font-weight: 600; border: 0; border-bottom: 1px solid var(--line); padding: 6px 2px; background: transparent; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.field.wide { grid-column: 1 / -1; }
.field input, .field select, .field textarea { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; background: var(--paper);
  font-size: 15px; color: var(--ink); }
.field textarea { resize: vertical; min-height: 64px; }
.d-section h3 { margin: 0 0 10px; font-size: 17px; font-weight: 600; }
.log-new { display: flex; flex-direction: column; gap: 8px; }
.log-new textarea { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: var(--paper); min-height: 70px; resize: vertical; }
.log-new .row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); gap: 8px; }
.logs { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.log { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.log .top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.log p { margin: 6px 0 0; }
.log .ana { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 14px; color: var(--muted); display: grid; gap: 2px; }
.log .ana b { color: var(--ink); font-weight: 500; }
.log .x { all: unset; cursor: pointer; color: var(--muted); padding: 0 4px; }
.log .x:hover { color: var(--cherry); }
.d-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 4px; border-top: 1px solid var(--line); padding: 14px 0 6px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; background: var(--ink); color: var(--paper);
  padding: 10px 18px; border-radius: 999px; font-size: 15px; transition: .2s; z-index: 30; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- sign-in ---------- */
body.auth { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.auth-card h1 { margin: 0; font-size: 24px; }
.auth-card p { margin: 0; }
.auth-card label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.auth-card input { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: var(--paper); font-size: 16px; color: var(--ink); }
.auth-actions { display: flex; justify-content: flex-end; gap: 8px; }
.auth-error { color: var(--cherry); }

/* ---------- page heroes ---------- */
.hero { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.hero-date { margin: 0; font-size: clamp(30px, 4.6vw, 52px); line-height: 1.12; font-weight: 600; letter-spacing: -0.02em; }
.hero-sub { margin: 0; font-size: 19px; color: var(--muted); max-width: 60ch; }
.hero-sub b { color: var(--ink); font-weight: 600; }
.block-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.block-head h2 { margin-bottom: 12px; }
.more { color: var(--muted); font-size: 14px; text-decoration: none; }
.more:hover { color: var(--cherry); }
.hint { color: var(--muted); font-size: 13px; }
.note.warn { background: var(--amber-soft); color: var(--amber-ink); padding: 8px 12px; border-radius: var(--radius); font-size: 14px; }

/* ---------- Today ---------- */
.today-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 0 40px; }
.today-grid .block { margin-top: 36px; }
.agenda { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.agenda h3 { margin: 0 0 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.agenda ul { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.agenda ul li { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); align-items: baseline; }
.agenda ul li:first-child { border-top: 0; }
.ev-time { font-variant-numeric: tabular-nums; color: var(--cherry-ink); font-weight: 500; font-size: 14px; }
.ev-title small { display: block; color: var(--muted); font-size: 13px; }
.ev-cal { font-size: 12px; color: var(--muted); }
.mini-goals, .plain-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.mini-goal { display: grid; grid-template-columns: minmax(0, 1fr) 90px 40px; gap: 10px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); }
.mini-goal:first-child, .plain-list li:first-child { border-top: 0; }
.mini-goal .tag { grid-column: 1 / -1; justify-self: start; }
.meter.sm { height: 6px; }
.plain-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); }
.dots { color: var(--cherry); letter-spacing: 1px; font-size: 12px; white-space: nowrap; }
.dots i { font-style: normal; color: var(--line); }

/* ---------- Task ---------- */
.task-add { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.task-add input, .task-add select { border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; background: var(--surface); min-width: 0; }
.task-add input[name=title] { flex: 1 1 200px; }
.task-add.wide { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 12px; }
.task-add.wide input, .task-add.wide select { background: var(--paper); }
.task-group { margin-bottom: 18px; }
.task-group h3 { margin: 0 0 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.task-group h3 span { font-weight: 400; }
.task-group.overdue h3 { color: var(--cherry-ink); }
.tasks { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.task-row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.task-row:first-child { border-top: 0; }
.task-row input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--cherry); flex: none; margin: 0; cursor: pointer; }
.task-title { all: unset; cursor: pointer; flex: 1 1 160px; min-width: 0; }
.task-title:hover { color: var(--cherry); }
.task-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.task-row.is-done .task-title { color: var(--muted); text-decoration: line-through; }
.tag.hot { background: var(--cherry-soft); color: var(--cherry-ink); }
.done-tasks { margin-top: 12px; }

/* ---------- Journal ---------- */
.moods { display: flex; gap: 6px; }
.mood { all: unset; cursor: pointer; font-size: 24px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%;
  filter: grayscale(1); opacity: .55; transition: .15s; }
.mood:hover { opacity: 1; filter: none; }
.mood[aria-checked=true] { background: var(--cherry-soft); filter: none; opacity: 1; }
.mood:focus-visible { outline: 2px solid var(--cherry); }
.diary-quick, .diary-editor { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.diary-quick textarea, .diary-editor textarea { border: 0; background: transparent; resize: vertical; font-size: 16px; line-height: 1.7; padding: 0; }
.diary-quick textarea:focus, .diary-editor textarea:focus { outline: none; }
.diary-quick .row, .diary-editor .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-left { display: flex; gap: 8px; align-items: center; }
.diary-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 28px; margin-top: 32px; align-items: start; }
.diary-list { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 80px; max-height: calc(100dvh - 100px); overflow-y: auto; }
.diary-list ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.search input { width: 100%; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; background: var(--surface); }
.diary-item { all: unset; box-sizing: border-box; width: 100%; cursor: pointer; padding: 10px 12px; border-radius: var(--radius); display: flex; flex-direction: column; gap: 2px; }
.diary-item:hover { background: var(--surface); }
.diary-item.current { background: var(--surface); box-shadow: inset 3px 0 0 var(--cherry); }
.d-date { font-weight: 500; font-size: 15px; }
.d-ex { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.diary-editor { padding: 24px 28px; min-height: 60vh; }
.diary-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.diary-top input { border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 10px; background: var(--paper); }
.diary-day { margin: 4px 0 0; font-size: 26px; font-weight: 600; letter-spacing: -0.01em; }
.diary-img { width: 100%; max-height: 360px; object-fit: cover; border-radius: var(--radius); }
.diary-editor textarea { flex: 1; min-height: 320px; max-width: 70ch; }

/* ---------- Lessons ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters.topics { margin-top: 10px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 14px; cursor: pointer; font-size: 14px; }
.chip[aria-pressed=true] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.search.inline { margin-left: auto; width: min(240px, 100%); }
.lesson-grid { margin-top: 24px; columns: 3 300px; column-gap: 18px; }
.lesson { break-inside: avoid; margin-bottom: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px;
  display: flex; flex-direction: column; gap: 8px; }
.lesson.is-pressure { border-left: 4px solid var(--cherry); border-radius: 0 var(--radius-lg) var(--radius-lg) 0; }
.lesson.is-resolved { opacity: .7; }
.lesson.is-resolved.is-pressure { border-left-color: var(--leaf); }
.lesson-top { display: flex; gap: 8px; align-items: center; }
.lesson-top .hint { margin-left: auto; }
.lesson h3 { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.35; }
.lesson h3 button { all: unset; cursor: pointer; }
.lesson h3 button:hover { color: var(--cherry); }
.lesson p { margin: 0; font-size: 15px; }
.lbl { color: var(--muted); }
.takeaway { background: var(--leaf-soft); color: var(--ink); padding: 10px 12px; border-radius: var(--radius); }
.lesson-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.check { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); cursor: pointer; }
.check input { accent-color: var(--leaf); width: 18px; height: 18px; }
.d-section { padding-top: 0; }

@media (max-width: 900px) {
  .today-grid { grid-template-columns: minmax(0, 1fr); }
  .diary-layout { grid-template-columns: minmax(0, 1fr); }
  .diary-list { position: static; max-height: 280px; }
  .wish-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .topbar { padding: 10px 16px; gap: 12px; flex-wrap: wrap; }
  .brand { flex: 1; }
  .tabs { order: 3; flex-basis: 100%; gap: 0; }
  .tabs a { padding: 6px 9px; font-size: 14px; }
  .recent li { flex-wrap: wrap; row-gap: 2px; }
  .recent .when { min-width: 0; order: 0; }
  .recent .tag { order: 1; }
  .recent .txt { order: 2; flex-basis: 100%; }
  main { padding: 0 16px 64px; }
  .hero { padding-top: 32px; }
  .wish-cols { grid-template-columns: 1fr; }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .active-grid { grid-template-columns: 1fr; }
  .diary-editor { padding: 16px; }
  .search.inline { margin-left: 0; width: 100%; }
  .agenda ul li { grid-template-columns: 56px minmax(0, 1fr); }
  .ev-cal { grid-column: 2; }
}
