:root {
  --ink: #29433b;
  --muted: #6f8176;
  --paper: #fffdf7;
  --cream: #f7f3e8;
  --mint: #d9eee2;
  --mint-deep: #4e9b78;
  --yellow: #f8d36b;
  --coral: #ee8f75;
  --sky: #a8d9df;
  --line: #d8e2d8;
  --shadow: 0 7px 0 rgba(44, 75, 59, 0.1);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--cream);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background-color: var(--cream);
  background-image: radial-gradient(rgba(78, 155, 120, 0.13) 1px, transparent 1px);
  background-size: 18px 18px;
}

button, input { font: inherit; }
button { cursor: pointer; }

.page-shell { max-width: 1480px; margin: 0 auto; padding: 34px 34px 28px; }

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 30px 34px 28px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #e6f3e5;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "✦  ♡  ✿";
  position: absolute;
  right: 28px;
  top: 18px;
  color: rgba(238, 143, 117, 0.7);
  font-size: 25px;
  letter-spacing: 8px;
  transform: rotate(7deg);
}

.eyebrow, .section-kicker {
  margin: 0 0 8px;
  color: var(--mint-deep);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(28px, 4vw, 48px); line-height: 1.1; letter-spacing: 0; }
h1 span { color: var(--coral); font-size: 0.7em; vertical-align: top; }
.hero-note-wrap { display: inline-flex; align-items: center; gap: 4px; max-width: min(700px, 100%); }
.hero-note { margin: 0; color: #4f6b5c; font-size: 15px; }
.note-edit-button { opacity: 0; color: var(--mint-deep); transition: opacity 140ms ease, background 140ms ease; }
.hero-note-wrap:hover .note-edit-button, .hero-note-wrap:focus-within .note-edit-button { opacity: 1; }
.note-edit-button:hover { background: var(--mint); }

.memo-panel { margin-top: 22px; padding: 12px 16px 13px; border: 1px dashed #b6cdb8; border-radius: 7px; background: rgba(255, 253, 247, 0.82); }
.memo-heading { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; }
.memo-icon { color: #d17d62; font-size: 15px; }
.memo-heading label { color: var(--ink); font-size: 12px; font-weight: 800; }
.memo-save-status { margin-left: auto; color: #84978a; font-size: 10px; }
.memo-panel textarea { display: block; width: 100%; min-height: 70px; max-height: 120px; padding: 7px 9px; resize: vertical; border: 1px solid #d6e2d6; border-radius: 5px; outline: 0; color: var(--ink); background: rgba(255,255,255,0.74); font: inherit; font-size: 13px; line-height: 1.45; }
.memo-panel textarea:focus { border-color: var(--mint-deep); box-shadow: 0 0 0 2px rgba(78, 155, 120, 0.12); }
.memo-panel textarea::placeholder { color: #a0afa3; }

.hero-status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  padding: 9px 13px;
  border: 1px solid #acd1bb;
  border-radius: 20px;
  color: #466b56;
  background: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  font-weight: 700;
  z-index: 1;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint-deep); box-shadow: 0 0 0 4px rgba(78, 155, 120, 0.14); }

.overview {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin: 28px 0 34px;
  padding: 16px 22px;
  border-bottom: 2px dashed #b8cebc;
}
.overview-main { display: flex; align-items: center; gap: 14px; }
.overview-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--yellow); font-size: 25px; transform: rotate(-6deg); }
.overview-label { margin: 0 0 3px; color: var(--muted); font-size: 12px; font-weight: 700; }
.overview-count { margin: 0; font-size: 17px; font-weight: 700; }
.overview-count strong { color: var(--mint-deep); font-size: 28px; line-height: 1; }
.overview-count span { margin: 0 4px; color: var(--muted); }
.progress-message { max-width: 580px; margin: 6px 0 0; color: #b66d52; font-size: 12px; line-height: 1.4; font-weight: 700; }
.period-notes { display: flex; flex-wrap: wrap; justify-content: end; gap: 10px 18px; color: var(--muted); font-size: 12px; font-weight: 700; }
.period-note { display: inline-flex; align-items: center; gap: 6px; }
.period-dot { width: 8px; height: 8px; border-radius: 50%; }
.daily-dot { background: var(--coral); }
.weekly-dot { background: #e7ae39; }

.account-section { margin-bottom: 38px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 15px; }
.section-heading h2 { margin: 0; font-size: 22px; }
.section-heading-actions { display: flex; align-items: center; gap: 12px; }
.section-hint { margin: 0 4px 3px 0; color: var(--muted); font-size: 12px; }
.section-add-button { display: inline-flex; align-items: center; gap: 4px; padding: 7px 10px; border: 1px solid #b7d0be; border-radius: 6px; color: var(--mint-deep); background: #f5fbf2; font-size: 12px; font-weight: 800; }
.section-add-button span { font-size: 17px; line-height: 12px; }
.section-add-button:hover { background: var(--mint); transform: translateY(-1px); }
.account-grid { display: grid; gap: 18px; }
.primary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.secondary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 980px; }

.account-card {
  min-width: 0;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.account-card.tone-sun { --accent: #e4ac3c; --accent-soft: #fff2bd; }
.account-card.tone-leaf { --accent: #559c70; --accent-soft: #dcefe0; }
.account-card.tone-water { --accent: #4f94a1; --accent-soft: #d9eef0; }
.account-card.tone-coral { --accent: #d97c62; --accent-soft: #ffe1d8; }
.account-card.tone-lilac { --accent: #8f7bb0; --accent-soft: #ebe4f3; }
.account-card.tone-rose { --accent: #c97891; --accent-soft: #f8e0e7; }
.account-card.tone-sky { --accent: #668ab3; --accent-soft: #e0eaf5; }
.account-card.tone-lime { --accent: #879f47; --accent-soft: #edf3d7; }

.account-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 18px 14px; background: var(--accent-soft); border-bottom: 1px dashed rgba(41, 67, 59, 0.28); }
.account-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.account-badge { display: grid; place-items: center; width: 32px; height: 32px; border: 2px solid var(--ink); border-radius: 50%; background: var(--paper); color: var(--accent); font-size: 17px; font-weight: 900; transform: rotate(-5deg); }
.account-name h3 { margin: 0; font-size: 20px; }
.account-name p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.account-header-actions { display: inline-flex; align-items: center; gap: 5px; }
.account-progress { white-space: nowrap; color: var(--accent); font-size: 12px; font-weight: 800; }
.account-color-button, .account-delete-button { display: inline-grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 1px solid transparent; border-radius: 50%; color: var(--accent); background: rgba(255, 255, 255, 0.65); font-size: 14px; }
.account-color-button:hover { border-color: var(--accent); background: #fff; }
.account-delete-button { color: #bd6b5d; font-size: 20px; line-height: 1; }
.account-delete-button:hover { border-color: #d98b7c; color: #a94f40; background: #ffe8e1; }

.guarantee-panel { margin: 12px 15px 0; padding: 0 12px; border: 1px solid #e1d4a7; border-radius: 6px; background: #fffaf0; }
.guarantee-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 42px; margin: 0; cursor: pointer; list-style: none; }
.guarantee-heading::-webkit-details-marker { display: none; }
.guarantee-heading::before { content: "›"; flex: 0 0 15px; color: #a98339; font-size: 23px; line-height: 1; transform: rotate(0deg); transition: transform 140ms ease; }
.guarantee-panel[open] .guarantee-heading::before { transform: rotate(90deg); }
.guarantee-title { flex: 1; color: #795e27; font-size: 15px; font-weight: 900; }
.guarantee-header-summary { color: #8c8775; font-size: 12px; }
.guarantee-header-next { display: inline-flex; align-items: baseline; gap: 3px; color: #a66327; font-size: 14px; font-weight: 800; white-space: nowrap; }
.guarantee-header-next b { color: #9a4f1d; font-size: 26px; line-height: 1; }
.guarantee-body { padding: 0 0 12px 23px; }
.guarantee-setup-hint { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.guarantee-stats { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 0.8fr); align-items: center; gap: 8px; }
.guarantee-next, .guarantee-total, .guarantee-remaining { display: flex; flex-direction: column; min-width: 0; }
.guarantee-next small { color: #8b7b52; font-size: 12px; }
.guarantee-next strong { color: #a66327; font-size: 21px; line-height: 1.3; }
.guarantee-total { padding-left: 8px; border-left: 1px solid #e9dfc3; }
.guarantee-total strong, .guarantee-remaining strong { color: var(--ink); font-size: 19px; line-height: 1.25; }
.guarantee-total span, .guarantee-remaining span, .guarantee-total small { color: var(--muted); font-size: 11px; }
.guarantee-remaining { align-items: end; padding-left: 6px; border-left: 1px solid #e9dfc3; text-align: right; }
.guarantee-remaining span { max-width: 100px; text-align: right; }
.guarantee-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.guarantee-button { min-height: 32px; padding: 6px 10px; border: 1px solid #d9c98e; border-radius: 5px; color: #74591f; background: #fffdf7; font-size: 12px; font-weight: 800; }
.guarantee-button:hover:not(:disabled) { background: #fff0bd; }
.guarantee-button:disabled { cursor: not-allowed; opacity: .55; }
.guarantee-record-button { color: #fff; border-color: #a98339; background: #a98339; }
.guarantee-record-button:hover:not(:disabled) { background: #92702f; }
.guarantee-timeline { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 7px; max-height: 158px; margin: 9px 0 0; padding: 8px 0 0; overflow-y: auto; border-top: 1px dashed #e5d9b7; list-style: none; }
.guarantee-record, .guarantee-upcoming { display: flex; align-items: center; justify-content: space-between; gap: 3px; min-width: 0; padding: 5px 7px; border-radius: 4px; color: #77857a; font-size: 12px; line-height: 1.35; }
.guarantee-record { color: #42684f; background: #e8f2e6; }
.guarantee-record.is-early { color: #9d6547; background: #fff0e4; }
.guarantee-record b, .guarantee-upcoming b { color: var(--ink); }
.guarantee-remove { flex: 0 0 17px; width: 17px; height: 17px; padding: 0; border: 0; border-radius: 50%; color: #8b958b; background: transparent; font-size: 14px; line-height: 1; }
.guarantee-remove:hover { color: #a94f40; background: #ffe2d8; }
.guarantee-upcoming { background: rgba(255,255,255,.68); }
.guarantee-upcoming.is-next { color: #fff; background: #bd7a37; }
.guarantee-upcoming.is-next b { color: #fff; }
.guarantee-empty { grid-column: 1 / -1; color: #8b958b; font-size: 12px; }
.guarantee-sticker { background: #a98339; }
.guarantee-modal input { margin-bottom: 2px; }

.task-section { padding: 15px 17px 18px; }
.task-section + .task-section { padding-top: 0; }
.task-section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.task-section-title h4 { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; }
.section-symbol { display: inline-grid; place-items: center; width: 21px; height: 21px; border-radius: 6px; background: var(--accent); color: #fff; font-size: 12px; }
.task-section-title small { color: var(--muted); font-size: 10px; font-weight: 700; }

.task-group { position: relative; }
.task-group + .task-group { margin-top: 9px; padding-top: 10px; }
.task-group + .task-group::before { content: ""; position: absolute; top: 0; left: 0; right: 0; border-top: 1px dashed var(--line); }
.group-add { position: absolute; right: -1px; top: -1px; width: 22px; height: 22px; padding: 0; border: 1px solid #b7d0be; border-radius: 50%; color: var(--mint-deep); background: #f5fbf2; font-size: 17px; line-height: 17px; transition: transform 140ms ease, background 140ms ease; }
.task-group + .task-group .group-add { top: 9px; }
.group-add:hover { background: var(--mint); transform: rotate(90deg); }
.task-list { display: grid; gap: 2px; padding-right: 26px; }
.task-row { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 34px; padding: 4px 0; border-bottom: 1px solid #edf1e8; cursor: pointer; }
.task-row:last-child { border-bottom: 0; }
.task-check { appearance: none; width: 17px; height: 17px; margin: 0; border: 2px solid var(--accent); border-radius: 4px; background: #fff; cursor: pointer; position: relative; }
.task-check:checked { border-color: var(--accent); background: var(--accent); }
.task-check:checked::after { content: "✓"; position: absolute; left: 2px; top: -4px; color: #fff; font-size: 14px; font-weight: 900; }
.task-text { min-width: 0; color: var(--ink); font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; transition: color 140ms ease; }
.task-row.is-done .task-text { color: #9aa9a0; text-decoration: line-through; text-decoration-thickness: 2px; }
.task-actions { display: inline-flex; gap: 1px; opacity: 0; transition: opacity 140ms ease; }
.task-row:hover .task-actions, .task-row:focus-within .task-actions { opacity: 1; }
.mini-action, .icon-button { display: inline-grid; place-items: center; width: 25px; height: 25px; padding: 0; border: 0; border-radius: 5px; color: #769083; background: transparent; font-size: 15px; }
.mini-action:hover { color: var(--accent); background: var(--accent-soft); }
.mini-action.delete:hover { color: #ca644f; background: #ffe7df; }
.empty-group { color: #9baaa0; font-size: 12px; font-style: italic; padding: 6px 0; }
.empty-accounts { padding: 27px 24px; border: 2px dashed #c0d4c2; border-radius: 8px; color: var(--muted); background: rgba(255, 253, 247, 0.65); text-align: center; font-size: 14px; font-weight: 700; }

.page-footer { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 12px; color: var(--muted); font-size: 11px; }
.footer-mark { color: var(--coral); font-size: 18px; }
.data-tools { display: inline-flex; align-items: center; gap: 6px; margin-left: 4px; }
.data-tool-button { padding: 4px 8px; border: 1px solid #b7d0be; border-radius: 5px; color: var(--mint-deep); background: #f5fbf2; font-size: 11px; font-weight: 800; }
.data-tool-button:hover { background: var(--mint); transform: translateY(-1px); }

.modal-backdrop { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(41, 67, 59, 0.34); z-index: 10; }
.modal-backdrop[hidden] { display: none; }
.task-modal { width: min(420px, 100%); padding: 22px; border: 2px solid var(--ink); border-radius: 8px; background: var(--paper); box-shadow: 0 12px 0 rgba(41, 67, 59, 0.2); }
.modal-topline { display: flex; justify-content: space-between; align-items: center; }
.modal-sticker { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 50%; color: #fff; background: var(--coral); font-size: 18px; transform: rotate(-8deg); }
.close-button { width: 30px; height: 30px; font-size: 24px; }
.close-button:hover { color: var(--coral); background: #ffe7df; }
.task-modal h2 { margin: 15px 0 4px; font-size: 22px; }
.modal-context { margin: 0 0 16px; color: var(--muted); font-size: 12px; }
.task-modal label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 800; }
.task-modal input { width: 100%; padding: 11px 12px; border: 2px solid #c9dccd; border-radius: 6px; outline: 0; color: var(--ink); background: #fbfdf8; }
.task-modal input:focus { border-color: var(--mint-deep); box-shadow: 0 0 0 3px rgba(78, 155, 120, 0.14); }
.task-modal select { width: 100%; padding: 11px 12px; border: 2px solid #c9dccd; border-radius: 6px; outline: 0; color: var(--ink); background: #fbfdf8; }
.task-modal select:focus { border-color: var(--mint-deep); box-shadow: 0 0 0 3px rgba(78, 155, 120, 0.14); }
.account-type-field { margin-top: 12px; }
.account-type-field[hidden] { display: none; }
.modal-actions { display: flex; justify-content: end; gap: 8px; margin-top: 17px; }
.button { padding: 9px 14px; border: 1px solid #c5d7c8; border-radius: 6px; font-size: 12px; font-weight: 800; }
.button-quiet { color: var(--muted); background: #f7faf4; }
.button-primary { color: #fff; border-color: var(--mint-deep); background: var(--mint-deep); }
.button-danger { color: #fff; border-color: #c96c59; background: #c96c59; }
.button:hover { filter: brightness(0.97); transform: translateY(-1px); }
.warning-sticker { background: var(--coral); }
.color-sticker { background: var(--mint-deep); }
.color-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.color-choice { display: flex; align-items: center; gap: 8px; padding: 9px 8px; border: 1px solid #d4e2d4; border-radius: 6px; color: var(--ink); background: #fbfdf8; font-size: 11px; font-weight: 800; }
.color-choice:hover, .color-choice.is-selected { border-color: var(--choice-accent); background: var(--choice-soft); }
.color-swatch { width: 20px; height: 20px; border: 2px solid rgba(41, 67, 59, 0.4); border-radius: 50%; background: var(--choice-accent); }
.toast { position: fixed; left: 50%; bottom: 25px; max-width: calc(100vw - 30px); padding: 10px 15px; border: 1px solid #a8cbb1; border-radius: 6px; color: #315c45; background: #eff9ef; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translate(-50%, 10px); transition: opacity 180ms ease, transform 180ms ease; z-index: 20; font-size: 12px; font-weight: 700; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 980px) {
  .page-shell { padding: 22px 18px; }
  .primary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .primary-grid .account-card:last-child { grid-column: 1 / -1; }
  .secondary-grid { max-width: none; }
}

@media (max-width: 650px) {
  .hero { align-items: start; flex-direction: column; }
  .hero::after { right: 15px; top: 12px; font-size: 20px; }
  .overview { align-items: start; flex-direction: column; }
  .section-heading { align-items: start; flex-direction: column; gap: 7px; }
  .section-heading-actions { align-items: start; flex-direction: column; gap: 8px; }
  .primary-grid, .secondary-grid { grid-template-columns: 1fr; }
  .primary-grid .account-card:last-child { grid-column: auto; }
  .account-card { box-shadow: 0 5px 0 rgba(44, 75, 59, 0.1); }
  .task-actions, .note-edit-button { opacity: 1; }
  .memo-panel { margin-top: 16px; }
}

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