:root {
  --ink: #20203c;
  --muted: #777793;
  --line: #e5e4f0;
  --paper: #ffffff;
  --canvas: #f6f6fc;
  --coral: #7773c7;
  --coral-dark: #5d58ad;
  --coral-soft: #efeffc;
  --green: #4d8a72;
  --green-soft: #e9f4ef;
  --amber: #c99751;
  --amber-soft: #fff6e7;
  --blue: #656cb0;
  --blue-soft: #ededfa;
  --shadow: 0 18px 55px rgba(57, 55, 111, .09);
  --sidebar: 236px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); font-family: "DM Sans", "Noto Sans SC", sans-serif; letter-spacing: 0; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: var(--sidebar); padding: 30px 20px 24px; display: flex; flex-direction: column; color: #fff; background: #29294f; }
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px 32px; }
.sidebar-close { display: none; }
.sidebar-overlay { display: none; }
.brand-mark { width: 42px; height: 42px; overflow: hidden; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.42); border-radius: 10px; background: #aaa5ce; box-shadow: 0 7px 16px rgba(0,0,0,.14); }
.brand-mark img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.04); }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 18px; }
.brand span { margin-top: 2px; color: #aeb7c5; font-size: 11px; }
.nav { display: grid; gap: 7px; }
.nav-item { position: relative; width: 100%; height: 50px; padding: 0 13px; display: flex; gap: 12px; align-items: center; border: 0; border-radius: 7px; color: #bac3cf; background: transparent; cursor: pointer; text-align: left; transition: .2s ease; }
.nav-item svg { width: 19px; }
.nav-item b { margin-left: auto; min-width: 22px; padding: 3px 6px; border-radius: 10px; font-size: 10px; text-align: center; background: rgba(255,255,255,.1); }
.nav-item:hover { color: white; background: rgba(255,255,255,.06); }
.nav-item.active { color: var(--ink); background: #fff; box-shadow: 0 9px 22px rgba(0,0,0,.12); }
.nav-item.active::before { content: ""; position: absolute; left: 0; width: 3px; height: 20px; border-radius: 0 2px 2px 0; background: var(--coral); }
.nav-item.active svg { color: var(--coral); }
.sidebar-add { margin-top: 9px; color: #fff; border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.06); }
.sidebar-add svg { color: #d8d5ff; }
.side-space { flex: 1; }
.side-card { width: 100%; margin: 20px 0; padding: 16px; border: 1px solid rgba(255,255,255,.1); border-radius: 8px; color: inherit; background: rgba(255,255,255,.055); text-align: left; cursor: pointer; transition: border-color .2s, background .2s; }
.side-card:hover, .side-card:focus-visible { border-color: rgba(216,213,255,.42); background: rgba(255,255,255,.09); outline: none; }
.side-card-title { display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.side-card-title strong { color: #d8d5ff; font-size: 16px; }
.side-card p { margin: 10px 0 0; color: #b9c2ce; font-size: 11px; line-height: 1.7; }
.progress { height: 5px; margin-top: 10px; overflow: hidden; border-radius: 5px; background: rgba(255,255,255,.12); }
.progress i { display: block; height: 100%; width: 68%; border-radius: inherit; background: #aaa6ec; transition: width .35s ease; }
.profile { display: flex; gap: 10px; align-items: center; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.1); }
.avatar { width: 38px; height: 38px; flex: 0 0 auto; display: grid; place-items: center; border: 0; border-radius: 50%; color: #fff; background: var(--coral); font-size: 13px; font-style: normal; }
.profile strong, .profile span { display: block; font-size: 12px; }
.profile span { margin-top: 3px; color: #aab4c2; font-size: 10px; }
.profile .icon-btn { margin-left: auto; color: #9ba7b6; background: transparent; border-color: transparent; }
.topbar { position: fixed; top: 0; right: 0; left: var(--sidebar); z-index: 15; height: 74px; padding: 0 5vw; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(246,246,252,.94); backdrop-filter: blur(14px); }
.mobile-brand { display: none; }
.mobile-logo { width: 30px; height: 30px; overflow: hidden; display: grid; place-items: center; border-radius: 7px; background: #aaa5ce; }
.mobile-logo img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.04); }
.date-block { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }
.date-block strong { color: var(--ink); font-size: 15px; }
.date-block em { margin-left: 4px; padding: 4px 8px; border: 1px solid #ddd9d1; border-radius: 12px; color: var(--green); background: white; font-size: 10px; font-style: normal; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid #e0ded8; border-radius: 50%; background: #fff; cursor: pointer; }
.icon-btn svg { width: 17px; }
.notification-btn { position: relative; }
.notification-btn i { position: absolute; right: -4px; top: -5px; min-width: 18px; height: 18px; padding: 0 4px; display: grid; place-items: center; border: 2px solid #fff; border-radius: 10px; color: white; background: var(--coral); font-size: 8px; font-style: normal; font-weight: 700; }
.notification-btn i[hidden] { display: none; }
.notification-btn.enabled { color: #4d8a72; border-color: #bad8cc; }
.notification-btn.blocked { color: #bd5369; }
.avatar.small { width: 34px; height: 34px; cursor: pointer; }
main { margin-left: var(--sidebar); padding: 100px 5vw 42px; }
.view { display: none; max-width: 1240px; margin: auto; animation: fade .3s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } }
.page-heading { margin-bottom: 16px; display: flex; align-items: flex-end; justify-content: space-between; }
.page-heading.compact { margin-bottom: 34px; }
.eyebrow { display: block; margin-bottom: 8px; color: var(--coral); font-size: 10px; font-weight: 700; letter-spacing: 1.8px; }
h1 { margin: 0; font-size: 34px; line-height: 1.2; letter-spacing: 0; }
.page-heading p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.primary-btn, .light-btn, .ghost-btn, .nudge-btn { height: 42px; padding: 0 17px; display: inline-flex; flex-shrink: 0; gap: 8px; align-items: center; justify-content: center; border: 0; border-radius: 7px; font-weight: 600; white-space: nowrap; cursor: pointer; transition: transform .18s ease, background .18s ease, box-shadow .18s ease; }
.primary-btn { color: #fff; background: var(--coral); box-shadow: 0 8px 20px rgba(93,88,173,.22); }
.primary-btn:hover, .nudge-btn:hover { transform: translateY(-1px); background: var(--coral-dark); }
.primary-btn svg, .light-btn svg, .ghost-btn svg, .nudge-btn svg { width: 17px; }
.icon-only-primary-btn { width: 42px; padding: 0; flex: 0 0 auto; justify-content: center; }
.icon-only-primary-btn svg { width: 20px; }
.hero { position: relative; height: 270px; overflow: hidden; display: block; border-radius: 8px; color: #fff; background: #343461 url("assets/clocktower-hero.webp") center 52% / cover no-repeat; box-shadow: var(--shadow); isolation: isolate; }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(34,31,75,.76) 0%, rgba(53,49,107,.55) 38%, rgba(70,67,139,.16) 72%, rgba(56,51,116,.02) 100%); }
.hero-content { position: relative; z-index: 1; min-height: 100%; padding: 37px 45px; background: transparent; }
.hero-content::after { display: none; }
.hero-kicker { display: flex; gap: 7px; align-items: center; color: #f2e9ff; font-size: 10px; font-weight: 700; letter-spacing: .8px; }
.hero-kicker i { width: 6px; height: 6px; border-radius: 50%; background: #d4c7ff; box-shadow: 0 0 0 4px rgba(212,199,255,.15); }
.hero h2 { max-width: 500px; margin: 14px 0 8px; font-size: clamp(25px, 3vw, 35px); line-height: 1.2; }
.hero p { margin: 0; color: #d3ded9; font-size: 13px; }
.hero-actions { margin-top: 20px; display: flex; gap: 10px; }
.light-btn { color: #4c478c; background: #fff; }
.ghost-btn { color: #fff; border: 1px solid rgba(255,255,255,.3); background: transparent; }
.light-btn:hover { background: #f0effd; }
.ghost-btn:hover { background: rgba(255,255,255,.09); }
.hero-photo { display: none; }
.metric-grid { margin: 12px 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.metric-card { position: relative; min-height: 70px; padding: 12px 28px 12px 15px; display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-top: 2px solid #e9d8d0; border-radius: 7px; color: var(--ink); background: var(--paper); text-align: left; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease; }
.metric-card:nth-child(2) { border-top-color: #acd0c1; }
.metric-card:nth-child(3) { border-top-color: #ebc987; }
.metric-card:nth-child(4) { border-top-color: #acbbd7; }
.metric-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(57,55,111,.08); }
.metric-arrow { position: absolute; right: 12px; color: #aaa9bd; font-size: 20px; }
.metric-icon, .panel-icon { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 7px; background: var(--coral-soft); color: var(--coral); }
.metric-icon svg { width: 18px; }
.metric-icon.green { color: var(--green); background: var(--green-soft); }
.metric-icon.amber { color: var(--amber); background: var(--amber-soft); }
.metric-icon.blue { color: var(--blue); background: var(--blue-soft); }
.metric-grid strong { display: block; font-size: 25px; line-height: 1; }
.metric-grid p { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(270px, .8fr); gap: 14px; }
.panel { border: 1px solid var(--line); border-radius: 8px; background: var(--paper); box-shadow: 0 8px 30px rgba(40,43,50,.035); }
.panel-header { min-height: 66px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #eeece7; }
.panel-header > div { display: flex; gap: 9px; align-items: center; }
.panel-icon { width: 28px; height: 28px; color: var(--green); background: var(--green-soft); }
.panel-icon svg { width: 15px; }
.panel-header h3 { margin: 0; font-size: 15px; }
.muted { color: var(--muted); font-size: 11px; }
.text-btn { padding: 7px; display: flex; gap: 3px; align-items: center; border: 0; color: var(--coral); background: transparent; font-size: 12px; cursor: pointer; }
.text-btn svg { width: 14px; }
.icon-only-text-btn { width: 34px; height: 34px; padding: 0; justify-content: center; border-radius: 50%; }
.icon-only-text-btn:hover, .icon-only-text-btn:focus-visible { background: var(--coral-soft); outline: none; }
.icon-only-text-btn svg { width: 18px; }
.task-list { padding: 4px 20px 8px; }
.task-item { position: relative; min-height: 72px; overflow: hidden; border-bottom: 1px solid #efede8; background: #d85f72; cursor: pointer; touch-action: pan-y; -webkit-touch-callout: none; user-select: none; }
.task-item:last-child { border-bottom: 0; }
.task-row { position: relative; z-index: 1; min-height: 72px; padding: 0; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 12px; align-items: center; background: var(--paper); transition: transform .2s ease; will-change: transform; }
.task-row:focus-visible { outline: 2px solid #8b84d8; outline-offset: -2px; }
.task-item.swiped .task-row { transform: translateX(-76px); }
.swipe-delete-btn { position: absolute; z-index: 0; top: 0; right: 0; bottom: 0; width: 76px; display: grid; place-content: center; gap: 4px; border: 0; color: white; background: #d85f72; font-size: 11px; cursor: pointer; }
.swipe-delete-btn svg { width: 17px; margin: auto; }
.task-symbol { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 7px; color: var(--blue); background: var(--blue-soft); }
.task-symbol svg { width: 16px; }
.task-symbol.生活 { color: var(--green); background: var(--green-soft); }
.task-symbol.采购 { color: var(--amber); background: var(--amber-soft); }
.task-symbol.重要 { color: var(--coral); background: var(--coral-soft); }
.task-copy { min-width: 0; }
.task-copy strong { display: flex; gap: 7px; align-items: center; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.task-copy p { margin: 5px 0 0; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.task-copy p b { color: var(--coral); font-weight: 600; }
.task-item.done .task-copy strong { color: #a3a5ab; text-decoration: line-through; }
.task-item.done .task-copy p { opacity: .65; }
.task-item.overdue:not(.done) .task-copy p b, .overdue-label { color: #d55c73; }
.repeat-label, .overdue-label { padding: 2px 5px; border-radius: 4px; background: var(--coral-soft); font-size: 9px; font-style: normal; font-weight: 600; }
.overdue-label { background: #fff0f3; }
.important-dot { width: 5px; height: 5px; flex: 0 0 auto; border-radius: 50%; background: var(--coral); }
.task-actions { display: flex; gap: 7px; align-items: center; }
.complete-btn { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid #dcdad4; border-radius: 50%; color: transparent; background: white; cursor: pointer; }
.complete-btn svg { width: 15px; }
.complete-btn:hover { border-color: var(--green); color: var(--green); }
.task-item.done .complete-btn { color: white; border-color: var(--green); background: var(--green); }
.task-item.notification-target .task-row { animation: notification-target 1.6s ease; }
@keyframes notification-target { 0%, 100% { background: #fff; } 35% { background: #fff4d9; } }
.task-context-menu { position: fixed; z-index: 300; min-width: 146px; padding: 6px; display: grid; gap: 3px; border: 1px solid var(--line); border-radius: 7px; background: white; box-shadow: 0 14px 38px rgba(25,25,55,.18); }
.task-context-menu[hidden] { display: none; }
.task-context-menu button { height: 36px; padding: 0 11px; display: flex; gap: 9px; align-items: center; border: 0; border-radius: 5px; color: var(--ink); background: transparent; font-size: 12px; cursor: pointer; }
.task-context-menu button:hover { background: #f4f3f9; }
.task-context-menu button.danger { color: #c85167; }
.task-context-menu button.danger:hover { background: #fff0f3; }
.task-context-menu svg { width: 15px; }
.right-column { display: grid; gap: 18px; }
.nudge-panel { padding: 21px; color: #fff; background: #6d68b8; border-color: #6d68b8; }
.nudge-top { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 600; }
.nudge-top .panel-icon { color: white; background: rgba(255,255,255,.17); }
.nudge-top i { margin-left: auto; color: #e8e5ff; font-size: 9px; font-style: normal; font-weight: 400; white-space: nowrap; }
.nudge-panel h3 { margin: 22px 0 7px; font-size: 22px; }
.nudge-panel p { margin: 0; color: #eceaff; font-size: 11px; line-height: 1.65; }
.nudge-btn { width: 100%; margin-top: 18px; color: var(--coral-dark); background: white; }
.nudge-btn:hover { color: white; }
.reward-panel { overflow: hidden; text-align: center; padding-bottom: 18px; }
.reward-panel .panel-header { min-height: 53px; text-align: left; }
.reward-panel-tools { display: flex; gap: 5px; align-items: center; }
.mini-icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 5px; color: var(--coral-dark); background: white; cursor: pointer; }
.mini-icon-btn:disabled { opacity: .3; cursor: default; }
.mini-icon-btn svg { width: 14px; }
.reward-carousel { width: 100%; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-inline: contain; }
.reward-carousel::-webkit-scrollbar { display: none; }
.reward-slide { min-width: 100%; padding: 0 12px 3px; scroll-snap-align: start; text-align: center; }
.reward-slide > strong { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.reward-slide > p { margin: 5px 0 2px; color: var(--muted); font-size: 10px; }
.reward-slide > p b { color: var(--coral); }
.reward-slide > small { min-height: 26px; display: block; padding: 0 12px; color: #8b83a5; font-size: 9px; line-height: 1.45; }
.carousel-dots { min-height: 8px; margin-top: 8px; display: flex; gap: 5px; justify-content: center; }
.carousel-dots i { width: 5px; height: 5px; border-radius: 50%; background: #d7d5df; transition: width .2s ease, background .2s ease; }
.carousel-dots i.active { width: 15px; border-radius: 4px; background: var(--coral); }
.reward-visual { position: relative; width: 82px; height: 66px; margin: 14px auto 4px; display: grid; place-items: center; border-radius: 50%; font-size: 39px; background: var(--amber-soft); }
.reward-visual i { position: absolute; right: -5px; bottom: 1px; padding: 3px 6px; border-radius: 9px; color: white; background: var(--amber); font-size: 9px; font-style: normal; }
.reward-panel > strong { font-size: 13px; }
.reward-panel > p { margin: 5px 0 9px; color: var(--muted); font-size: 10px; }
.reward-panel > p b { color: var(--coral); }
.progress.large { width: calc(100% - 42px); height: 6px; margin: auto; background: #eeeae3; }
.progress.large i { background: var(--coral); }
.week-panel { margin-top: 18px; }
.week-pill { padding: 4px 8px; border-radius: 10px; color: var(--green); background: var(--green-soft); font-size: 9px; }
.week-content { min-height: 195px; padding: 20px 24px 24px; display: grid; grid-template-columns: 1fr 190px; gap: 28px; }
.chart { min-height: 145px; display: flex; align-items: flex-end; justify-content: space-around; gap: 9px; padding-top: 15px; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to top, transparent 0, transparent 39px, #f0eee9 40px); }
.bar-col { position: relative; width: 40px; height: 100%; display: flex; align-items: flex-end; }
.bar-col i { width: 100%; min-height: 2px; border-radius: 5px 5px 0 0; background: #9fb2aa; transition: height .4s ease; }
.bar-col:nth-child(5) i, .bar-col:nth-child(6) i { background: var(--coral); }
.bar-col b { position: absolute; bottom: -20px; width: 100%; color: var(--muted); font-size: 9px; font-weight: 500; text-align: center; }
.bar-col span { position: absolute; bottom: calc(var(--bar) + 5px); width: 100%; color: var(--muted); font-size: 8px; text-align: center; }
.week-summary { padding: 20px 0 10px 22px; border-left: 1px solid var(--line); }
.week-summary span { color: var(--muted); font-size: 10px; }
.week-summary strong { display: block; margin: 4px 0; color: var(--green); font-size: 34px; }
.week-summary p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.all-tasks-panel { min-height: 470px; }
.filter-row { min-height: 74px; padding: 13px 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.segmented { display: flex; padding: 3px; border-radius: 7px; background: #f0eee9; }
.segmented button { height: 31px; padding: 0 14px; border: 0; border-radius: 5px; color: var(--muted); background: transparent; font-size: 11px; cursor: pointer; }
.segmented button.active { color: var(--ink); background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.search-box { width: 220px; height: 36px; padding: 0 11px; display: flex; gap: 7px; align-items: center; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.search-box svg { width: 15px; color: var(--muted); }
.search-box input { width: 100%; border: 0; outline: none; color: var(--ink); background: transparent; font-size: 11px; }
.empty-state { padding: 70px 20px; color: var(--muted); text-align: center; font-size: 13px; }
.reward-banner { min-height: 180px; padding: 35px 42px; display: flex; align-items: center; justify-content: space-between; border-radius: 8px; color: #fff; background: linear-gradient(110deg, #45437e, #706cb5); box-shadow: var(--shadow); }
.reward-banner span { color: #e3e1fa; font-size: 12px; }
.reward-banner strong { margin: 5px 0; display: flex; align-items: center; gap: 10px; font-size: 38px; }
.reward-banner strong svg { width: 27px; color: #d9d3ff; fill: #d9d3ff; }
.reward-banner p { margin: 0; color: #e5e3f7; font-size: 11px; }
.reward-banner-actions { display: grid; gap: 10px; justify-items: center; }
.reward-history-btn { height: 30px; padding: 0 9px; display: flex; gap: 6px; align-items: center; border: 1px solid rgba(255,255,255,.28); border-radius: 6px; color: white; background: rgba(255,255,255,.1); font-size: 10px; cursor: pointer; }
.reward-history-btn:hover { background: rgba(255,255,255,.18); }
.reward-history-btn svg { width: 13px; }
.reward-ring { width: 110px; height: 110px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(#d9d3ff 68%, rgba(255,255,255,.13) 0); }
.reward-ring::before { content: ""; position: absolute; width: 85px; height: 85px; border-radius: 50%; background: #615da4; }
.reward-ring span { position: relative; z-index: 1; color: white; font-size: 18px; font-weight: 700; }
.reward-grid { margin-top: 18px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.reward-card { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #d85f72; touch-action: pan-y; -webkit-touch-callout: none; user-select: none; }
.reward-card-row { position: relative; z-index: 1; min-height: 100%; padding: 24px; background: #fff; transition: transform .2s ease; will-change: transform; }
.reward-card-row:focus-visible { outline: 2px solid #8b84d8; outline-offset: -2px; }
.reward-card.swiped .reward-card-row { transform: translateX(-76px); }
.wish-swipe-delete { position: absolute; z-index: 0; top: 0; right: 0; bottom: 0; width: 76px; display: grid; place-content: center; gap: 5px; border: 0; color: white; background: #d85f72; font-size: 11px; cursor: pointer; }
.wish-swipe-delete svg { width: 17px; margin: auto; }
.reward-card .emoji { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 7px; background: var(--amber-soft); font-size: 32px; }
.reward-card h3 { margin: 17px 0 5px; font-size: 16px; }
.reward-card p { min-height: 34px; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.reward-card footer { margin-top: 19px; display: flex; align-items: center; justify-content: space-between; }
.reward-cost { color: var(--coral); font-size: 12px; font-weight: 700; }
.redeem-btn { height: 34px; padding: 0 12px; border: 1px solid var(--coral); border-radius: 6px; color: var(--coral); background: white; font-size: 11px; cursor: pointer; }
.redeem-btn:disabled { color: #aaa; border-color: #ddd; cursor: not-allowed; }
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; visibility: hidden; opacity: 0; background: rgba(21,27,35,.45); backdrop-filter: blur(3px); transition: .2s ease; }
.modal-backdrop.open { visibility: visible; opacity: 1; }
.modal { width: min(500px, 100%); max-height: calc(100dvh - 40px); padding: 28px; overflow-y: auto; border-radius: 8px; background: white; box-shadow: 0 24px 80px rgba(0,0,0,.2); transform: translateY(10px); transition: .2s ease; }
.modal-backdrop.open .modal { transform: translateY(0); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; }
.modal h2 { margin: 0 0 22px; font-size: 25px; }
.modal form { display: grid; gap: 16px; }
.modal label { display: grid; gap: 7px; color: #4f5663; font-size: 11px; font-weight: 600; }
.modal input, .modal select, .modal textarea { width: 100%; padding: 0 12px; border: 1px solid #dedbd5; border-radius: 6px; outline: none; background: #fff; font-size: 13px; }
.modal input, .modal select { height: 42px; }
.modal textarea { height: 76px; padding-top: 11px; resize: none; }
.modal input:focus, .modal select:focus, .modal textarea:focus { border-color: var(--coral); box-shadow: 0 0 0 3px var(--coral-soft); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.emoji-picker-field { margin-top: -3px; }
.emoji-picker-field > span { display: block; margin-bottom: 7px; color: var(--ink); font-size: 11px; font-weight: 600; }
.emoji-picker { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.emoji-picker button { aspect-ratio: 1; min-width: 0; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 19px; cursor: pointer; }
.emoji-picker button:hover, .emoji-picker button:focus-visible, .emoji-picker button.selected { border-color: var(--coral); background: var(--coral-soft); outline: none; }
.priority-toggle { min-height: 44px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; border-radius: 6px; background: #f7f5f1; font-size: 11px; font-weight: 600; }
.switch { width: 38px; height: 22px; position: relative; }
.switch input { display: none; }
.switch i { position: absolute; inset: 0; border-radius: 15px; background: #ccc; transition: .2s; }
.switch i::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + i { background: var(--coral); }
.switch input:checked + i::after { transform: translateX(16px); }
.submit-btn { width: 100%; margin-top: 3px; }
.account-modal { max-width: 450px; }
.auth-tabs { margin-bottom: 16px; display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 7px; background: #f0eee9; }
.auth-tabs[hidden] { display: none; }
.auth-tabs button { height: 34px; border: 0; border-radius: 5px; color: var(--muted); background: transparent; cursor: pointer; font-size: 12px; }
.auth-tabs button.active { color: var(--ink); background: white; box-shadow: 0 2px 8px rgba(0,0,0,.06); font-weight: 600; }
#displayNameField[hidden] { display: none; }
.sync-status { min-height: 64px; margin-bottom: 18px; padding: 13px 15px; display: flex; gap: 11px; align-items: center; border: 1px solid var(--line); border-radius: 7px; background: #f7f7fc; }
.sync-status > i { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: #a1a2ad; box-shadow: 0 0 0 5px rgba(161,162,173,.12); }
.sync-status.cloud > i { background: var(--green); box-shadow: 0 0 0 5px rgba(77,138,114,.12); }
.sync-status strong, .sync-status span { display: block; }
.sync-status strong { font-size: 13px; }
.sync-status span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.account-actions { margin-top: 14px; display: flex; gap: 10px; align-items: center; }
.account-actions[hidden] { display: none; }
.space-switcher { margin-top: 14px; }
.space-switcher[hidden] { display: none; }
.secondary-btn { min-height: 38px; padding: 0 13px; display: inline-flex; gap: 7px; align-items: center; border: 1px solid var(--line); border-radius: 6px; color: var(--coral-dark); background: white; cursor: pointer; }
.secondary-btn svg { width: 15px; }
.text-danger-btn { margin-left: auto; border: 0; color: #bd5369; background: transparent; font-size: 11px; cursor: pointer; }
.account-note { margin: 15px 0 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.app-version { margin: 12px 0 0; padding-top: 11px; border-top: 1px solid var(--line); color: #92909a; font-size: 9px; line-height: 1.4; text-align: center; }
.sound-setting { margin-top: 16px; }
.sound-setting > span { display: grid; gap: 3px; }
.sound-setting small { color: var(--muted); font-size: 9px; font-weight: 400; }
.points-modal { max-width: 520px; }
.points-modal .modal-header h2 { max-width: 390px; overflow-wrap: anywhere; }
.points-balance { margin-bottom: 12px; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; border-radius: 7px; color: white; background: #625da5; }
.points-balance span { font-size: 11px; }
.points-balance strong { font-size: 25px; }
.points-list { max-height: min(430px, 55vh); overflow-y: auto; border: 1px solid var(--line); border-radius: 7px; }
.point-entry { min-height: 64px; padding: 10px 13px; display: grid; grid-template-columns: 34px minmax(0,1fr) auto; gap: 11px; align-items: center; border-bottom: 1px solid var(--line); }
.point-entry:last-child { border-bottom: 0; }
.point-entry-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 7px; }
.point-entry-icon svg { width: 15px; }
.point-entry-icon.positive { color: #4d8a72; background: var(--green-soft); }
.point-entry-icon.negative { color: #bd5369; background: var(--coral-soft); }
.point-entry div { min-width: 0; }
.point-entry strong { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.point-entry p { margin: 4px 0 0; color: var(--muted); font-size: 9px; }
.point-entry > b { font-size: 14px; }
.point-entry > b.positive { color: #4d8a72; }
.point-entry > b.negative { color: #bd5369; }
.week-switcher { display: flex; gap: 7px; align-items: center; }
.week-switcher button { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; color: var(--coral-dark); background: #fff; cursor: pointer; font-size: 18px; }
.week-switcher button:disabled { opacity: .35; cursor: not-allowed; }
.report-panel { margin-top: 0; }
.toast { position: fixed; right: 26px; bottom: 26px; z-index: 200; min-width: 260px; padding: 13px 17px; display: flex; gap: 10px; align-items: center; border-radius: 7px; color: white; background: #3f3d72; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(15px); transition: .25s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast svg { width: 18px; }
.toast p { margin: 0; font-size: 12px; }

@media (max-width: 1000px) {
  :root { --sidebar: 205px; }
  main { padding-inline: 3.5vw; }
  .topbar { padding-inline: 3.5vw; }
  .hero { grid-template-columns: 60% 40%; }
  .hero-content { padding: 45px 38px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .right-column { grid-template-columns: 1fr 1fr; }
  .reward-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  body { padding-bottom: 0; }
  body.sidebar-open { overflow: hidden; }
  .sidebar { display: flex; width: min(286px, 84vw); height: 100dvh; z-index: 80; padding: 24px 20px 22px; box-shadow: 18px 0 50px rgba(17,24,35,.22); transform: translateX(-105%); transition: transform .25s ease; overflow-y: auto; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-overlay { position: fixed; inset: 0; z-index: 70; display: block; visibility: hidden; opacity: 0; border: 0; background: rgba(19,25,34,.46); backdrop-filter: blur(2px); transition: opacity .25s ease, visibility .25s ease; }
  body.sidebar-open .sidebar-overlay { visibility: visible; opacity: 1; }
  .sidebar-close { width: 32px; height: 32px; margin-left: auto; display: grid; place-items: center; border: 0; border-radius: 50%; color: #bbc4d0; background: rgba(255,255,255,.07); cursor: pointer; }
  .sidebar-close svg { width: 16px; }
  .topbar { left: 0; height: 62px; padding: 0 18px; }
  .mobile-brand { display: flex; gap: 8px; align-items: center; }
  .mobile-brand button { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: #fff; cursor: pointer; }
  .mobile-brand button span, .mobile-brand button svg { width: 19px; height: 19px; }
  .mobile-brand strong { font-size: 15px; }
  .date-block { display: none; }
  .top-actions .icon-btn:first-child { display: none; }
  main { margin: 0; padding: 78px 16px 24px; }
  .page-heading { align-items: flex-start; }
  #todayView .page-heading > .primary-btn, #allView .page-heading > .primary-btn { display: none; }
  h1 { font-size: 28px; }
  .page-heading p { max-width: 270px; font-size: 12px; line-height: 1.6; }
  .hero { height: 326px; background-position: 62% center; }
  .hero-content { padding: 23px 21px; }
  .hero-content::after { display: none; }
  .hero h2 { margin-top: 11px; font-size: 25px; }
  .hero-actions { margin-top: 15px; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric-card { min-height: 67px; padding: 10px 25px 10px 10px; }
  .dashboard-grid, .right-column { grid-template-columns: 1fr; }
  .task-list { padding-inline: 14px; }
  .task-row { grid-template-columns: 34px minmax(0,1fr) auto; gap: 9px; }
  .week-content { grid-template-columns: 1fr; }
  .week-summary { padding: 15px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .filter-row { align-items: stretch; flex-direction: column; gap: 10px; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; }
  .search-box { width: 100%; }
  .reward-banner { padding: 27px 23px; }
  .reward-ring { width: 90px; height: 90px; }
  .reward-ring::before { width: 69px; height: 69px; }
  .reward-history-btn { height: 28px; }
  .reward-grid { grid-template-columns: 1fr; }
  .emoji-picker { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .toast { right: 16px; bottom: 18px; left: 16px; min-width: auto; }
}
@media (max-width: 400px) {
  .hero-content { padding: 25px 20px; }
  .hero-actions { gap: 7px; }
  .light-btn, .ghost-btn { padding-inline: 12px; font-size: 12px; }
  .metric-card { gap: 9px; }
  .metric-icon { width: 32px; height: 32px; }
  .metric-grid strong { font-size: 21px; }
  .panel-header { padding-inline: 14px; }
  .reward-banner { gap: 15px; }
  .reward-banner strong { font-size: 30px; }
  .emoji-picker { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
