:root {
  --page: #f4f1e9;
  --page-deep: #ebe6da;
  --surface: #fffdf8;
  --surface-soft: #f8f5ed;
  --ink: #1f2923;
  --ink-soft: #4f5b53;
  --muted: #778078;
  --line: #dedbd1;
  --line-strong: #cbc7bc;
  --green: #275c45;
  --green-bright: #3c8060;
  --green-soft: #dcebe2;
  --green-pale: #eef6f1;
  --terracotta: #a95736;
  --terracotta-soft: #f3e1d8;
  --terracotta-pale: #fbf2ed;
  --gold: #c99a43;
  --sidebar: #17392c;
  --sidebar-soft: #214b3b;
  --sidebar-text: #f6f1e7;
  --danger: #a54238;
  --shadow-sm: 0 8px 24px rgba(35, 47, 39, 0.06);
  --shadow-md: 0 18px 50px rgba(35, 47, 39, 0.09);
  --shadow-lg: 0 28px 80px rgba(20, 35, 27, 0.18);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --radius-xl: 34px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-height: 100%; background: var(--page); scroll-behavior: smooth; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 78% -10%, rgba(208, 225, 212, 0.62), transparent 34rem),
    radial-gradient(circle at 2% 100%, rgba(235, 213, 195, 0.45), transparent 28rem),
    var(--page);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, textarea { font: inherit; }
button { color: inherit; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(60, 128, 96, 0.28);
  outline-offset: 2px;
}
button:disabled { cursor: not-allowed; opacity: 0.42; }
svg { display: block; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  width: min(1500px, 100%);
  min-height: 100vh;
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 28px 20px 22px;
  color: var(--sidebar-text);
  background:
    radial-gradient(circle at 24% 8%, rgba(127, 184, 151, 0.23), transparent 16rem),
    linear-gradient(180deg, #173a2c 0%, #123125 100%);
  border-radius: 0 26px 26px 0;
  overflow: hidden;
}

.sidebar::after {
  content: ""; position: absolute; right: -60px; bottom: 10%; width: 180px; height: 180px;
  border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 50%;
  box-shadow: 0 0 0 28px rgba(255, 255, 255, 0.025), 0 0 0 58px rgba(255, 255, 255, 0.018);
  pointer-events: none;
}
.brand, .mobile-brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand { position: relative; z-index: 1; padding: 3px 7px; }
.brand-mark {
  display: grid; flex: 0 0 auto; width: 43px; height: 43px; place-items: center;
  color: #17392c; background: #e8d9b7; border-radius: 14px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42);
}
.brand-mark svg { width: 27px; height: 27px; }
.brand strong {
  display: block; font-family: "STSong", "Songti SC", serif; font-size: 19px;
  font-weight: 700; letter-spacing: 0.04em;
}
.brand small {
  display: block; margin-top: 3px; color: rgba(246, 241, 231, 0.55);
  font-size: 11px; letter-spacing: 0.14em;
}
.main-nav { position: relative; z-index: 1; display: grid; gap: 8px; margin-top: 54px; }
.nav-item {
  display: flex; align-items: center; gap: 13px; width: 100%; padding: 13px 14px;
  color: rgba(246, 241, 231, 0.65); background: transparent; border: 0; border-radius: 14px;
  cursor: pointer; transition: color 180ms ease, background 180ms ease, transform 180ms ease;
}
.nav-item:hover { color: var(--sidebar-text); background: rgba(255, 255, 255, 0.06); transform: translateX(2px); }
.nav-item.is-active { color: #17392c; background: #f3eee2; box-shadow: 0 10px 24px rgba(4, 19, 12, 0.16); }
.nav-item svg { width: 21px; height: 21px; }
.nav-item span { font-size: 14px; font-weight: 650; letter-spacing: 0.04em; }

.sidebar-card {
  position: relative; z-index: 1; margin-top: auto; padding: 19px;
  background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 20px; backdrop-filter: blur(20px);
}
.sidebar-card-icon {
  display: grid; width: 36px; height: 36px; margin-bottom: 16px; place-items: center;
  color: #eed7a6; background: rgba(255, 255, 255, 0.08); border-radius: 12px;
}
.sidebar-card-icon svg { width: 20px; height: 20px; }
.sidebar-card p { margin: 0 0 5px; color: rgba(246, 241, 231, 0.56); font-size: 12px; }
.sidebar-card strong { display: block; margin-bottom: 14px; font-size: 14px; font-weight: 650; }
.mini-progress { height: 5px; overflow: hidden; background: rgba(255, 255, 255, 0.12); border-radius: 999px; }
.mini-progress span {
  display: block; width: 0; height: 100%; background: #e8d9b7; border-radius: inherit;
  transition: width 420ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sidebar-footnote { position: relative; z-index: 1; margin: 18px 4px 0; color: rgba(246, 241, 231, 0.36); font-size: 10px; letter-spacing: 0.06em; }

.main-content { min-width: 0; padding: 0 38px 60px; }
.topbar {
  position: sticky; z-index: 20; top: 0; display: flex; align-items: center; justify-content: space-between;
  min-height: 82px; padding: 16px 0;
  background: linear-gradient(180deg, rgba(244, 241, 233, 0.96) 70%, rgba(244, 241, 233, 0));
  backdrop-filter: blur(14px);
}
.mobile-brand { display: none; }
.date-navigator {
  display: flex; align-items: center; gap: 6px; padding: 5px;
  background: rgba(255, 253, 248, 0.82); border: 1px solid rgba(222, 219, 209, 0.86);
  border-radius: 15px; box-shadow: 0 7px 22px rgba(35, 47, 39, 0.045);
}
.icon-button, .modal-close {
  display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center;
  color: var(--ink-soft); background: transparent; border: 0; border-radius: 10px; cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}
.icon-button:hover, .modal-close:hover { color: var(--ink); background: var(--surface-soft); }
.icon-button svg, .modal-close svg { width: 20px; height: 20px; }
.date-picker-label { position: relative; }
.date-picker-label::after {
  content: "⌄"; position: absolute; top: 50%; right: 7px; color: var(--muted);
  font-size: 12px; transform: translateY(-56%); pointer-events: none;
}
.date-picker-label input {
  width: 154px; height: 34px; padding: 0 27px 0 10px; color: var(--ink); background: transparent;
  border: 0; border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 650;
}
.date-picker-label input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.text-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 11px;
  color: var(--green); background: transparent; border: 0; border-radius: 10px; cursor: pointer;
  font-size: 13px; font-weight: 700; transition: background 160ms ease, color 160ms ease;
}
.text-button:hover { color: var(--green-bright); background: var(--green-pale); }
.text-button.with-icon { padding-inline: 12px; border: 1px solid var(--line); background: var(--surface); }
.text-button.with-icon svg { width: 17px; height: 17px; }
.topbar-status {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.64); border: 1px solid rgba(222, 219, 209, 0.72);
  border-radius: 999px; font-size: 12px;
}
.status-dot { width: 7px; height: 7px; background: var(--green-bright); border-radius: 50%; box-shadow: 0 0 0 4px rgba(60, 128, 96, 0.12); }
.view-container { width: min(1120px, 100%); margin: 10px auto 0; }
.view { animation: view-in 420ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.view:not(.is-active) { display: none; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.hero-card {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  min-height: 282px; padding: 44px 48px; color: #f8f4e9;
  background: radial-gradient(circle at 86% 18%, rgba(232, 217, 183, 0.19), transparent 15rem), linear-gradient(115deg, #173a2c 0%, #24563f 72%, #2f674d 100%);
  border-radius: var(--radius-xl); box-shadow: 0 22px 58px rgba(23, 57, 44, 0.18); overflow: hidden;
}
.hero-card::before, .hero-card::after { content: ""; position: absolute; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 50%; }
.hero-card::before { top: -54px; right: -26px; width: 230px; height: 230px; }
.hero-card::after { right: 72px; bottom: -106px; width: 290px; height: 290px; border-color: rgba(255, 255, 255, 0.065); }
.hero-copy { position: relative; z-index: 1; max-width: 660px; }
.eyebrow {
  margin: 0 0 10px; color: var(--green-bright); font-size: 11px; font-weight: 800;
  letter-spacing: 0.18em; text-transform: uppercase;
}
.hero-card .eyebrow { color: #d8c79e; }
.hero-card h1, .page-heading h1 {
  margin: 0; font-family: "STSong", "Songti SC", "Noto Serif CJK SC", serif;
  font-size: clamp(34px, 4vw, 52px); font-weight: 700; line-height: 1.13; letter-spacing: -0.025em;
}
.hero-card > .hero-copy > p:not(.eyebrow) { max-width: 550px; margin: 17px 0 0; color: rgba(248, 244, 233, 0.68); font-size: 14px; line-height: 1.8; }
.hero-stats { display: flex; align-items: center; gap: 30px; margin-top: 30px; }
.hero-stats > div { position: relative; padding-right: 30px; }
.hero-stats > div:not(:last-child)::after { content: ""; position: absolute; top: 4px; right: 0; width: 1px; height: 36px; background: rgba(255, 255, 255, 0.13); }
.hero-stats strong { display: block; font-size: 23px; line-height: 1; }
.hero-stats span { display: block; margin-top: 7px; color: rgba(248, 244, 233, 0.52); font-size: 11px; }
.progress-orbit {
  --progress: 0deg; position: relative; z-index: 2; display: grid; width: 154px; height: 154px;
  flex: 0 0 auto; place-items: center; margin-left: 38px;
  background: conic-gradient(#e6d4a8 0deg var(--progress), rgba(255, 255, 255, 0.12) var(--progress) 360deg);
  border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04); transition: background 400ms ease;
}
.progress-orbit::before { content: ""; position: absolute; inset: 9px; background: #214d3a; border-radius: 50%; box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.12); }
.progress-orbit-inner { position: relative; z-index: 1; text-align: center; }
.progress-orbit-inner strong { display: block; font-size: 31px; line-height: 1; }
.progress-orbit-inner span { display: block; margin-top: 8px; color: rgba(248, 244, 233, 0.54); font-size: 11px; }

.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.section-heading h2, .tasks-header h2, .settings-card h2, .ledger-card h2 { margin: 0; font-size: 21px; font-weight: 750; letter-spacing: -0.015em; }
.accounts-heading { margin: 42px 4px 18px; }
.accounts-heading > p, .page-heading > div > p:last-child, .tasks-header p, .settings-card-heading p, .ledger-card-header p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.accounts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.account-card {
  position: relative; min-height: 245px; padding: 26px 28px 23px; background: var(--surface);
  border: 1px solid rgba(222, 219, 209, 0.88); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden;
}
.account-card::after { content: ""; position: absolute; top: -64px; right: -56px; width: 170px; height: 170px; border-radius: 50%; pointer-events: none; }
.account-card-completed::after { background: rgba(60, 128, 96, 0.08); }
.account-card-missed::after { background: rgba(169, 87, 54, 0.075); }
.account-card-top { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; }
.account-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 14px; }
.account-card-completed .account-icon { color: var(--green); background: var(--green-soft); }
.account-card-missed .account-icon { color: var(--terracotta); background: var(--terracotta-soft); }
.account-icon svg { width: 22px; height: 22px; }
.account-tag { padding: 6px 9px; color: var(--muted); background: var(--surface-soft); border: 1px solid var(--line); border-radius: 999px; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; }
.account-card h3 { position: relative; z-index: 1; margin: 22px 0 4px; font-size: 15px; font-weight: 700; }
.account-balance { position: relative; z-index: 1; display: flex; align-items: flex-start; min-height: 62px; }
.account-balance span { margin-top: 7px; margin-right: 5px; color: var(--ink-soft); font-size: 18px; font-weight: 700; }
.account-balance strong { font-size: 46px; font-weight: 720; line-height: 1.18; letter-spacing: -0.04em; }
.account-card > p { position: relative; z-index: 1; min-height: 22px; margin: 3px 0 22px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.account-footer { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding-top: 15px; color: var(--muted); border-top: 1px solid var(--line); font-size: 11px; }
.account-footer b { color: var(--ink-soft); font-weight: 700; }

.tasks-card { margin-top: 22px; padding: 28px; background: rgba(255, 253, 248, 0.88); border: 1px solid rgba(222, 219, 209, 0.9); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.tasks-header, .ledger-card-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.tasks-header-actions { display: flex; align-items: center; gap: 14px; }
.tap-hint { color: var(--muted); font-size: 11px; }
.primary-button, .secondary-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 17px;
  border-radius: 13px; cursor: pointer; font-size: 13px; font-weight: 750;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}
.primary-button { color: #fffdf8; background: var(--green); border: 1px solid var(--green); box-shadow: 0 10px 24px rgba(39, 92, 69, 0.18); }
.primary-button:hover { background: #1f4d39; transform: translateY(-1px); box-shadow: 0 13px 28px rgba(39, 92, 69, 0.23); }
.secondary-button { color: var(--ink-soft); background: var(--surface); border: 1px solid var(--line-strong); }
.secondary-button:hover { color: var(--ink); background: var(--surface-soft); border-color: #bab5a8; }
.primary-button svg, .secondary-button svg { width: 18px; height: 18px; }
.task-list { display: grid; gap: 11px; }
.task-card {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 15px;
  min-height: 94px; padding: 17px 17px 17px 15px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 19px; transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}
.task-card:hover { transform: translateY(-1px); border-color: #cfcabd; box-shadow: 0 10px 26px rgba(35, 47, 39, 0.06); }
.task-card.is-completed { background: linear-gradient(90deg, var(--green-pale), var(--surface) 48%); border-color: rgba(60, 128, 96, 0.25); }
.task-card.is-missed { background: linear-gradient(90deg, var(--terracotta-pale), var(--surface) 48%); border-color: rgba(169, 87, 54, 0.22); }
.status-check {
  position: relative; display: grid; width: 45px; height: 45px; flex: 0 0 auto; place-items: center;
  color: #9fa59f; background: var(--surface-soft); border: 1.5px solid var(--line-strong); border-radius: 50%;
  cursor: pointer; transition: transform 160ms ease, color 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.status-check:hover { color: var(--green); border-color: rgba(60, 128, 96, 0.6); transform: scale(1.04); }
.status-check svg { width: 22px; height: 22px; opacity: 0; transform: scale(0.6); transition: opacity 160ms ease, transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.task-card.is-completed .status-check { color: #fff; background: var(--green-bright); border-color: var(--green-bright); box-shadow: 0 8px 20px rgba(60, 128, 96, 0.24); }
.task-card.is-missed .status-check { color: #fff; background: var(--terracotta); border-color: var(--terracotta); box-shadow: 0 8px 20px rgba(169, 87, 54, 0.2); }
.task-card.is-completed .status-check svg, .task-card.is-missed .status-check svg { opacity: 1; transform: scale(1); }
.task-copy { min-width: 0; }
.task-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.task-title { margin: 0; font-size: 15px; font-weight: 720; line-height: 1.45; }
.task-card.is-completed .task-title, .task-card.is-missed .task-title { text-decoration-line: line-through; text-decoration-color: rgba(79, 91, 83, 0.35); text-decoration-thickness: 1px; }
.task-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 999px; font-size: 9px; font-weight: 800; letter-spacing: 0.05em; }
.task-pill.completed { color: var(--green); background: var(--green-soft); }
.task-pill.missed { color: var(--terracotta); background: var(--terracotta-soft); }
.task-pill.temporary { color: #7d6534; background: #f3ead6; }
.task-note { margin: 6px 0 0; overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.55; text-overflow: ellipsis; white-space: nowrap; }
.task-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; margin-top: 10px; color: var(--muted); font-size: 10px; }
.task-meta span { display: inline-flex; align-items: center; gap: 5px; }
.task-meta span::before { content: ""; width: 4px; height: 4px; background: currentColor; border-radius: 50%; opacity: 0.45; }
.task-meta .completed-cost { color: var(--green); }
.task-meta .missed-cost { color: var(--terracotta); }
.task-actions { display: flex; align-items: center; gap: 8px; }
.task-missed-button {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 11px; color: var(--muted);
  background: transparent; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; font-size: 11px; font-weight: 700;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}
.task-missed-button:hover, .task-card.is-missed .task-missed-button { color: var(--terracotta); background: var(--terracotta-pale); border-color: rgba(169, 87, 54, 0.3); }
.task-icon-button { display: grid; width: 36px; height: 36px; place-items: center; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 11px; cursor: pointer; transition: color 160ms ease, background 160ms ease, border-color 160ms ease; }
.task-icon-button:hover { color: var(--ink); background: var(--surface-soft); border-color: var(--line); }
.task-icon-button svg, .task-missed-button svg { width: 17px; height: 17px; }
.empty-tasks, .empty-ledger { padding: 42px 20px; text-align: center; background: var(--surface-soft); border: 1px dashed var(--line-strong); border-radius: 20px; }
.empty-icon { display: grid; width: 52px; height: 52px; margin: 0 auto 14px; place-items: center; color: var(--green); background: var(--green-soft); border-radius: 17px; }
.empty-icon svg { width: 25px; height: 25px; }
.empty-tasks h3, .empty-ledger h3 { margin: 0; font-size: 15px; }
.empty-tasks p, .empty-ledger p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; padding: 42px 4px 28px; }
.page-heading h1 { max-width: 760px; font-size: clamp(32px, 4vw, 46px); }
.page-heading > div > p:last-child { max-width: 690px; margin-top: 14px; font-size: 13px; }
.ledger-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.ledger-summary-grid article { padding: 22px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-sm); }
.ledger-summary-grid span, .ledger-summary-grid small { display: block; color: var(--muted); font-size: 11px; }
.ledger-summary-grid strong { display: block; margin: 11px 0 6px; font-size: 28px; letter-spacing: -0.035em; }
.ledger-summary-grid article:first-child strong { color: var(--green); }
.ledger-summary-grid article:nth-child(2) strong { color: var(--terracotta); }
.ledger-card { padding: 28px; background: rgba(255, 253, 248, 0.9); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.ledger-card-header { margin-bottom: 18px; }
.filter-chips { display: flex; gap: 4px; padding: 4px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 12px; }
.filter-chip { min-height: 31px; padding: 0 12px; color: var(--muted); background: transparent; border: 0; border-radius: 9px; cursor: pointer; font-size: 11px; font-weight: 700; }
.filter-chip.is-active { color: var(--ink); background: var(--surface); box-shadow: 0 3px 9px rgba(35, 47, 39, 0.08); }
.ledger-list { display: grid; }
.ledger-row { display: grid; grid-template-columns: minmax(110px, 0.7fr) minmax(0, 2fr) minmax(120px, 0.9fr) auto; align-items: center; gap: 18px; min-height: 72px; padding: 14px 4px; border-top: 1px solid var(--line); }
.ledger-row:first-child { border-top: 0; }
.ledger-date { color: var(--muted); font-size: 11px; line-height: 1.55; }
.ledger-date strong { display: block; color: var(--ink-soft); font-size: 12px; }
.ledger-task { min-width: 0; }
.ledger-task strong { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.ledger-task span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.ledger-account { color: var(--muted); font-size: 11px; }
.ledger-status-pill { display: inline-flex; align-items: center; gap: 5px; margin-bottom: 5px; padding: 4px 7px; border-radius: 999px; font-size: 9px; font-weight: 800; }
.ledger-status-pill.completed { color: var(--green); background: var(--green-soft); }
.ledger-status-pill.missed { color: var(--terracotta); background: var(--terracotta-soft); }
.ledger-amount { min-width: 82px; text-align: right; font-size: 16px; font-weight: 800; }
.ledger-amount.completed { color: var(--green); }
.ledger-amount.missed { color: var(--terracotta); }
.empty-ledger > span { display: block; margin-bottom: 10px; color: var(--green); font-size: 34px; }
.settings-card { padding: 30px; margin-bottom: 18px; background: rgba(255, 253, 248, 0.9); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.settings-card-heading { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: flex-start; gap: 16px; margin-bottom: 24px; }
.settings-index { display: grid; width: 38px; height: 38px; place-items: center; color: var(--green); background: var(--green-soft); border-radius: 12px; font-size: 11px; font-weight: 800; }
.settings-goals-heading { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; }
.form-grid { display: grid; gap: 18px; }
.form-grid.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: grid; gap: 9px; color: var(--ink-soft); font-size: 12px; font-weight: 650; }
.field em { color: var(--muted); font-size: 10px; font-style: normal; font-weight: 500; }
.field input, .field textarea, .money-input { width: 100%; color: var(--ink); background: var(--surface-soft); border: 1px solid var(--line); border-radius: 13px; transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease; }
.field input { height: 46px; padding: 0 14px; }
.field textarea { min-height: 92px; padding: 12px 14px; resize: vertical; line-height: 1.6; }
.field input:focus, .field textarea:focus, .money-input:focus-within { background: var(--surface); border-color: rgba(60, 128, 96, 0.62); box-shadow: 0 0 0 4px rgba(60, 128, 96, 0.08); outline: 0; }
.money-input { display: flex; align-items: center; height: 46px; }
.money-input b { padding-left: 14px; color: var(--muted); font-size: 14px; }
.money-input input { height: 44px; padding-left: 7px; background: transparent; border: 0; box-shadow: none; }
.account-settings-group { padding: 17px; border: 1px solid var(--line); border-radius: 17px; }
.account-settings-group.completed { background: linear-gradient(135deg, var(--green-pale), rgba(255, 255, 255, 0)); }
.account-settings-group.missed { background: linear-gradient(135deg, var(--terracotta-pale), rgba(255, 255, 255, 0)); }
.account-settings-group .field + .field { margin-top: 14px; }
.settings-goal-list { display: grid; gap: 10px; }
.settings-goal-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 13px; padding: 13px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 16px; }
.goal-drag { display: grid; width: 26px; height: 36px; place-items: center; color: #a5aaa5; }
.goal-drag svg { width: 16px; height: 16px; }
.goal-setting-inputs { display: grid; grid-template-columns: minmax(150px, 0.8fr) minmax(180px, 1.2fr); gap: 9px; }
.goal-setting-inputs input { width: 100%; height: 40px; padding: 0 12px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-size: 12px; }
.goal-setting-inputs input:focus { border-color: rgba(60, 128, 96, 0.62); box-shadow: 0 0 0 3px rgba(60, 128, 96, 0.08); outline: 0; }
.remove-goal-button { display: grid; width: 36px; height: 36px; place-items: center; color: #a0a49f; background: transparent; border: 0; border-radius: 10px; cursor: pointer; transition: color 160ms ease, background 160ms ease; }
.remove-goal-button:hover { color: var(--danger); background: #f8e9e6; }
.remove-goal-button svg { width: 17px; height: 17px; }
.settings-actions { display: flex; align-items: center; justify-content: space-between; padding: 8px 3px 20px; }
.danger-text-button { padding: 9px 0; color: var(--danger); background: transparent; border: 0; cursor: pointer; font-size: 12px; font-weight: 650; }
.danger-text-button:hover { text-decoration: underline; }
.modal { width: 100%; max-width: none; height: 100%; max-height: none; padding: 24px; margin: 0; background: transparent; border: 0; overflow: auto; }
.modal:not([open]) { display: none; }
.modal::backdrop { background: rgba(14, 28, 21, 0.58); backdrop-filter: blur(8px); }
.modal[open] { display: grid; place-items: center; }
.modal-panel { position: relative; width: min(860px, 100%); max-height: calc(100vh - 48px); margin: auto; background: var(--surface); border: 1px solid rgba(255, 255, 255, 0.72); border-radius: 28px; box-shadow: var(--shadow-lg); overflow: auto; animation: modal-in 240ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.task-panel { width: min(560px, 100%); }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(0.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-accent { height: 7px; background: linear-gradient(90deg, var(--green), #7ba58c 55%, #d2aa72); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 30px 32px 22px; }
.modal-header h2 { margin: 0; font-family: "STSong", "Songti SC", serif; font-size: 28px; }
.modal-header > div > p:last-child { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.setup-step { padding: 7px 10px; color: var(--muted); background: var(--surface-soft); border-radius: 999px; font-size: 10px; font-weight: 700; }
.setup-content, .modal-body { padding: 0 32px 28px; }
.setup-section { padding: 24px 0; border-top: 1px solid var(--line); }
.setup-section-title { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 13px; margin-bottom: 18px; }
.setup-section-title > span { display: grid; width: 28px; height: 28px; place-items: center; color: var(--green); background: var(--green-soft); border-radius: 9px; font-size: 11px; font-weight: 800; }
.setup-section-title h3 { margin: 0; font-size: 14px; }
.setup-section-title p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.setup-goals-title { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; }
.modal-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 32px 28px; border-top: 1px solid var(--line); }
.setup-footer { position: sticky; bottom: 0; background: rgba(255, 253, 248, 0.95); backdrop-filter: blur(14px); }
.setup-footer > p { margin: 0; color: var(--muted); font-size: 11px; }
.modal-footer-actions { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.fixed-rule-note { display: flex; gap: 10px; padding: 13px 14px; margin-top: 16px; color: #75603a; background: #f6efdf; border: 1px solid #e8dcc0; border-radius: 13px; }
.fixed-rule-note svg { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 1px; }
.fixed-rule-note p { margin: 0; font-size: 11px; line-height: 1.65; }
.fixed-rule-note strong { color: #5b4828; }

.toast {
  position: fixed; z-index: 100; left: 50%; bottom: 28px; display: flex; align-items: center; gap: 10px;
  max-width: calc(100vw - 36px); padding: 12px 17px 12px 12px; color: #f9f6ed; background: #1d3328;
  border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 14px; box-shadow: 0 16px 40px rgba(14, 28, 21, 0.24);
  opacity: 0; transform: translate(-50%, 20px); pointer-events: none;
  transition: opacity 200ms ease, transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast-icon { display: grid; width: 28px; height: 28px; flex: 0 0 auto; place-items: center; color: #153a2a; background: #d9e9df; border-radius: 9px; }
.toast.is-missed .toast-icon { color: #5e2b1b; background: #f0d3c5; }
.toast.is-neutral .toast-icon { color: #5d513a; background: #eee3c7; }
.toast-icon svg { width: 16px; height: 16px; }
.toast > span:last-child { overflow: hidden; font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.bottom-nav { display: none; }
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 216px minmax(0, 1fr); }
  .sidebar { padding-inline: 16px; }
  .main-content { padding-inline: 26px; }
  .hero-card { padding: 38px; }
  .progress-orbit { width: 138px; height: 138px; }
  .ledger-row { grid-template-columns: 100px minmax(0, 1.6fr) minmax(110px, 0.9fr) auto; gap: 12px; }
}

@media (max-width: 860px) {
  body { padding-bottom: 84px; }
  .app-shell { display: block; }
  .sidebar { display: none; }
  .main-content { padding: 0 18px 30px; }
  .topbar { min-height: 74px; gap: 14px; padding: 12px 0; }
  .mobile-brand { display: inline-flex; }
  .mobile-brand .brand-mark { width: 37px; height: 37px; border-radius: 12px; }
  .mobile-brand .brand-mark svg { width: 23px; height: 23px; }
  .mobile-brand strong { font-family: "STSong", "Songti SC", serif; font-size: 16px; letter-spacing: 0.04em; }
  .topbar-status { display: none; }
  .date-navigator { margin-left: auto; }
  .date-picker-label input { width: 138px; }
  .view-container { margin-top: 0; }
  .page-heading { padding-top: 24px; }
  .bottom-nav {
    position: fixed; z-index: 40; right: 14px; bottom: max(12px, env(safe-area-inset-bottom)); left: 14px;
    display: grid; grid-template-columns: repeat(4, 1fr); padding: 7px;
    background: rgba(255, 253, 248, 0.92); border: 1px solid rgba(203, 199, 188, 0.9);
    border-radius: 19px; box-shadow: 0 16px 45px rgba(35, 47, 39, 0.16); backdrop-filter: blur(18px);
  }
  .bottom-nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 50px; color: var(--muted); background: transparent; border: 0; border-radius: 13px; font-size: 10px; font-weight: 700; }
  .bottom-nav-item.is-active { color: var(--green); background: var(--green-pale); }
  .bottom-nav-item svg { width: 20px; height: 20px; }
  .modal { padding: 12px; }
  .modal-panel { max-height: calc(100vh - 24px); border-radius: 23px; }
}
@media (max-width: 680px) {
  .main-content { padding-inline: 14px; }
  .mobile-brand strong { display: none; }
  .date-navigator { gap: 2px; }
  .date-picker-label input { width: 130px; padding-left: 7px; }
  .hero-card { grid-template-columns: minmax(0, 1fr) auto; min-height: 0; padding: 28px 24px; border-radius: 27px; }
  .hero-card h1 { max-width: 330px; font-size: 32px; }
  .hero-card > .hero-copy > p:not(.eyebrow) { font-size: 12px; }
  .progress-orbit { width: 92px; height: 92px; margin-left: 16px; }
  .progress-orbit::before { inset: 6px; }
  .progress-orbit-inner strong { font-size: 22px; }
  .progress-orbit-inner span { margin-top: 4px; font-size: 9px; }
  .hero-stats { gap: 15px; margin-top: 24px; }
  .hero-stats > div { padding-right: 15px; }
  .hero-stats strong { font-size: 19px; }
  .accounts-heading { align-items: flex-start; margin-top: 32px; }
  .accounts-heading > p { display: none; }
  .accounts-grid { gap: 10px; }
  .account-card { min-height: 220px; padding: 20px 17px; border-radius: 21px; }
  .account-icon { width: 37px; height: 37px; border-radius: 12px; }
  .account-tag { display: none; }
  .account-card h3 { margin-top: 17px; font-size: 13px; }
  .account-balance strong { font-size: 32px; }
  .account-balance span { margin-top: 5px; font-size: 14px; }
  .account-card > p { margin-bottom: 17px; font-size: 10px; }
  .account-footer { display: block; padding-top: 12px; font-size: 9px; }
  .account-footer span:last-child { display: block; margin-top: 5px; }
  .tasks-card, .ledger-card, .settings-card { padding: 20px 15px; border-radius: 22px; }
  .tasks-header { align-items: flex-start; }
  .tasks-header-actions { align-items: flex-end; flex-direction: column-reverse; gap: 4px; }
  .tap-hint { display: none; }
  .tasks-header .secondary-button { min-height: 38px; padding-inline: 12px; font-size: 11px; }
  .task-card { grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 15px 13px; }
  .status-check { width: 40px; height: 40px; }
  .task-actions { grid-column: 2; justify-content: flex-end; margin-top: -6px; }
  .task-missed-button { min-height: 32px; }
  .task-note { white-space: normal; }
  .page-heading { align-items: flex-start; flex-direction: column; padding: 30px 3px 22px; }
  .page-heading h1 { font-size: 32px; }
  .ledger-summary-grid { grid-template-columns: 1fr 1fr; }
  .ledger-summary-grid article:last-child { grid-column: 1 / -1; }
  .ledger-summary-grid article { padding: 18px; }
  .ledger-card-header { align-items: flex-start; flex-direction: column; }
  .ledger-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 15px 2px; }
  .ledger-date, .ledger-account { grid-column: 1; }
  .ledger-task { grid-column: 1; grid-row: 1; }
  .ledger-amount { grid-column: 2; grid-row: 1 / span 2; }
  .ledger-account { display: flex; align-items: center; gap: 7px; }
  .ledger-status-pill { margin-bottom: 0; }
  .settings-card-heading, .settings-goals-heading { grid-template-columns: auto minmax(0, 1fr); }
  .settings-goals-heading .text-button { grid-column: 2; justify-self: start; margin-top: 5px; }
  .form-grid.two-columns { grid-template-columns: 1fr; }
  .settings-goal-row { grid-template-columns: minmax(0, 1fr) auto; }
  .goal-drag { display: none; }
  .goal-setting-inputs { grid-template-columns: 1fr; }
  .settings-actions { align-items: stretch; flex-direction: column-reverse; gap: 12px; }
  .settings-actions .primary-button { width: 100%; }
  .modal { padding: 0; }
  .modal-panel { width: 100%; max-height: 100dvh; min-height: 100dvh; border-radius: 0; }
  .task-panel { min-height: auto; max-height: 84dvh; margin: auto 0 0; border-radius: 24px 24px 0 0; }
  .modal-header, .setup-content, .modal-body, .modal-footer { padding-inline: 20px; }
  .modal-header { padding-top: 25px; }
  .setup-footer { align-items: flex-end; flex-direction: column; }
  .setup-footer .primary-button { width: 100%; }
  .toast { bottom: 92px; }
}
@media (max-width: 430px) {
  .hero-card { display: block; }
  .progress-orbit { position: absolute; top: 24px; right: 20px; width: 78px; height: 78px; margin: 0; }
  .progress-orbit-inner strong { font-size: 18px; }
  .progress-orbit-inner span { display: none; }
  .hero-copy { padding-right: 66px; }
  .hero-card h1 { font-size: 28px; }
  .hero-stats { padding-right: 0; }
  .hero-stats > div { padding-right: 12px; }
  .hero-stats span { font-size: 9px; }
  .date-navigator .icon-button:first-child, .date-navigator .icon-button:nth-child(3) { width: 28px; }
}

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

/* Insights */
.insights-heading { align-items: center; }
.month-navigator {
  display: flex; align-items: center; gap: 6px; padding: 5px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow-sm);
}
.month-navigator strong { min-width: 104px; text-align: center; font-size: 13px; }
.insight-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 18px; }
.insight-summary-grid article { padding: 20px 21px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-sm); }
.insight-summary-grid span, .insight-summary-grid small { display: block; color: var(--muted); font-size: 10px; }
.insight-summary-grid strong { display: block; margin: 10px 0 6px; font-size: 27px; line-height: 1; letter-spacing: -0.04em; }
.insight-summary-grid article:nth-child(1) strong { color: var(--green); }
.insight-summary-grid article:nth-child(3) strong { color: var(--terracotta); }
.insights-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr); gap: 18px; }
.calendar-card, .trend-card, .focus-card {
  padding: 25px; background: rgba(255, 253, 248, 0.92); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.insight-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.insight-card-header h2 { margin: 0; font-size: 18px; }
.insight-card-header p { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.calendar-legend, .trend-legend { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 11px; color: var(--muted); font-size: 9px; }
.legend-dot { display: inline-block; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; }
.legend-dot.completed { background: var(--green-bright); }
.legend-dot.missed { background: var(--terracotta); }
.legend-dot.mixed { background: #d2a95d; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; }
.calendar-weekdays { margin-bottom: 8px; color: var(--muted); text-align: center; font-size: 10px; }
.calendar-day {
  position: relative; display: flex; aspect-ratio: 1 / 1; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; padding: 5px; color: var(--ink-soft); background: var(--surface-soft); border: 1px solid transparent;
  border-radius: 13px; cursor: pointer; transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}
.calendar-day:hover { transform: translateY(-1px); border-color: var(--line-strong); }
.calendar-day.is-empty { visibility: hidden; pointer-events: none; }
.calendar-day.is-future { color: #adb2ae; background: rgba(248, 245, 237, 0.6); cursor: default; }
.calendar-day.is-future:hover { transform: none; border-color: transparent; }
.calendar-day.is-today { box-shadow: inset 0 0 0 1px var(--green); }
.calendar-day.is-selected { border-color: var(--green); background: var(--green-pale); }
.calendar-day.has-completed { background: var(--green-soft); }
.calendar-day.has-missed { background: var(--terracotta-soft); }
.calendar-day.has-completed.has-missed { background: linear-gradient(135deg, var(--green-soft) 0 50%, var(--terracotta-soft) 50% 100%); }
.calendar-day-number { font-size: 12px; font-weight: 750; }
.calendar-day-summary { min-height: 12px; color: var(--muted); font-size: 8px; line-height: 1; }
.calendar-day-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--line-strong); }
.calendar-day.has-completed .calendar-day-dot { background: var(--green-bright); }
.calendar-day.has-missed .calendar-day-dot { background: var(--terracotta); }
.calendar-day.has-completed.has-missed .calendar-day-dot { background: #c38d48; }
.trend-card { min-width: 0; }
.trend-header { align-items: center; }
.trend-chart { display: flex; align-items: flex-end; gap: 5px; min-height: 228px; padding: 16px 4px 0; overflow-x: auto; border-bottom: 1px solid var(--line); }
.trend-column { display: grid; grid-template-rows: 1fr auto; min-width: 18px; height: 210px; flex: 1 0 18px; gap: 7px; }
.trend-bars { display: flex; align-items: flex-end; justify-content: center; gap: 2px; height: 100%; }
.trend-bar { width: 6px; min-height: 2px; border-radius: 5px 5px 2px 2px; transition: height 300ms ease; }
.trend-bar.completed { background: var(--green-bright); }
.trend-bar.missed { background: #cf8060; }
.trend-column-label { color: var(--muted); text-align: center; font-size: 8px; white-space: nowrap; }
.trend-legend { justify-content: flex-start; margin-top: 14px; }
.focus-card { margin-top: 18px; }
.focus-list { display: grid; gap: 9px; }
.focus-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 14px 15px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 15px; }
.focus-row strong { display: block; font-size: 13px; }
.focus-row p { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.focus-row-stats { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 10px; }
.focus-row-stats b { color: var(--terracotta); font-size: 15px; }
.empty-focus { padding: 20px; color: var(--muted); background: var(--surface-soft); border: 1px dashed var(--line-strong); border-radius: 15px; text-align: center; font-size: 11px; }

/* Optional Supabase sync */
.sync-settings-card { overflow: hidden; }
.sync-status-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 13px;
  padding: 15px; margin-bottom: 14px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 16px;
}
.sync-status-icon { display: grid; width: 39px; height: 39px; place-items: center; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.sync-status-icon.connected { color: var(--green); background: var(--green-soft); border-color: transparent; }
.sync-status-icon.syncing { color: #8a6a2d; background: #f3ead6; border-color: transparent; }
.sync-status-icon.error { color: var(--danger); background: #f7e4e0; border-color: transparent; }
.sync-status-icon svg { width: 20px; height: 20px; }
.sync-status-row strong { display: block; font-size: 13px; }
.sync-status-row p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.sync-status-badge { padding: 5px 8px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; font-size: 9px; font-weight: 750; }
.sync-status-badge.connected { color: var(--green); background: var(--green-soft); border-color: transparent; }
.sync-status-badge.syncing { color: #7d6534; background: #f3ead6; border-color: transparent; }
.sync-status-badge.error { color: var(--danger); background: #f7e4e0; border-color: transparent; }
.sync-config-warning { padding: 15px 16px; color: #765f36; background: #f7f0e1; border: 1px solid #e8dcc1; border-radius: 15px; }
.sync-config-warning strong { display: block; font-size: 12px; }
.sync-config-warning p { margin: 5px 0 0; font-size: 10px; line-height: 1.65; }
.sync-config-warning code { padding: 2px 5px; background: rgba(255, 255, 255, 0.55); border-radius: 5px; font-size: 10px; }
.sync-auth-panel { display: grid; gap: 14px; }
.sync-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.sync-auth-actions, .sync-account-buttons { display: flex; align-items: center; gap: 9px; }
.sync-account-panel { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px; background: var(--green-pale); border: 1px solid rgba(60, 128, 96, 0.2); border-radius: 16px; }
.sync-account-panel span { display: block; color: var(--muted); font-size: 9px; }
.sync-account-panel strong { display: block; max-width: 290px; margin-top: 3px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.sync-footnote { margin: 14px 2px 0; color: var(--muted); font-size: 10px; line-height: 1.65; }
.sync-spinner { animation: sync-spin 900ms linear infinite; }
@keyframes sync-spin { to { transform: rotate(360deg); } }

@media (max-width: 1100px) {
  .insights-layout { grid-template-columns: 1fr; }
  .trend-card { min-height: 0; }
}

@media (max-width: 860px) {
  .insight-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calendar-card, .trend-card, .focus-card { padding: 20px; }
  .sync-account-panel { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 680px) {
  .insights-heading { align-items: flex-start; flex-direction: column; }
  .month-navigator { width: 100%; justify-content: space-between; }
  .month-navigator strong { min-width: 0; flex: 1; }
  .insight-summary-grid { gap: 9px; }
  .insight-summary-grid article { padding: 16px 14px; border-radius: 17px; }
  .insight-summary-grid strong { font-size: 23px; }
  .calendar-card, .trend-card, .focus-card { padding: 16px 13px; border-radius: 21px; }
  .insight-card-header { align-items: flex-start; flex-direction: column; gap: 11px; }
  .calendar-legend { justify-content: flex-start; }
  .calendar-weekdays, .calendar-grid { gap: 4px; }
  .calendar-day { border-radius: 10px; gap: 3px; padding: 3px; }
  .calendar-day-number { font-size: 10px; }
  .calendar-day-summary { font-size: 7px; }
  .trend-chart { gap: 3px; min-height: 190px; }
  .trend-column { min-width: 14px; height: 174px; gap: 5px; }
  .trend-bar { width: 4px; }
  .focus-row { align-items: flex-start; flex-direction: column; gap: 9px; }
  .focus-row-stats { width: 100%; justify-content: space-between; }
  .sync-field-grid { grid-template-columns: 1fr; }
  .sync-auth-actions, .sync-account-buttons { align-items: stretch; flex-direction: column; }
  .sync-auth-actions .primary-button, .sync-auth-actions .secondary-button,
  .sync-account-buttons .primary-button, .sync-account-buttons .secondary-button { width: 100%; }
}

@media (max-width: 680px) {
  .setup-footer .modal-footer-actions { width: 100%; flex-direction: column-reverse; }
  .setup-footer .modal-footer-actions .text-button,
  .setup-footer .modal-footer-actions .primary-button { width: 100%; }
}
