:root {
  color-scheme: dark;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #223047;
  background: #f7f4ec;
  --ink: #223047;
  --muted: #718096;
  --navy: #294c68;
  --blue: #5d87a4;
  --cream: #fffdf8;
  --line: #dfe5e8;
  --gold: #d9a441;
  --green: #4d8b72;
  --shadow: 0 18px 55px rgba(41, 76, 104, .12);
}

/* 星际探索主题：装饰不接收点击，业务内容保持清晰。 */

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at top left, #e7f0f1 0, transparent 36%), #f7f4ec; }
button, input, select { font: inherit; }
button { min-height: 44px; cursor: pointer; }
.hidden { display: none !important; }
.mobile-only { display: none; }
.mobile-nav-label { display: none; }
.muted { color: var(--muted); }
.error { color: #b42318; min-height: 1.4em; }
.eyebrow { margin: 0 0 .35rem; color: var(--blue); font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: .45rem; font-size: clamp(1.45rem, 3vw, 2.25rem); }
h2 { margin-bottom: 0; font-size: 1.08rem; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(440px, 100%); padding: 34px; border: 1px solid rgba(41, 76, 104, .12); border-radius: 26px; background: rgba(255, 253, 248, .94); box-shadow: var(--shadow); }
.stack { display: grid; gap: 16px; margin-top: 24px; }
label { display: grid; gap: 7px; color: #526174; font-size: .88rem; font-weight: 700; }
input, select { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #cbd5dc; border-radius: 12px; background: white; color: var(--ink); }
input:focus, select:focus { outline: 3px solid rgba(93, 135, 164, .18); border-color: var(--blue); }
.primary { border: 0; border-radius: 13px; padding: 11px 18px; background: var(--navy); color: white; font-weight: 800; }
.primary:hover { background: #1e3d57; }
.ghost { border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px; background: rgba(255,255,255,.7); color: var(--ink); font-weight: 700; }
.demo-switch { display: flex; gap: 8px; margin-top: 12px; }
.demo-switch button { flex: 1; border: 0; border-radius: 10px; background: #eef2f3; color: #526174; }

.app-shell { min-height: 100vh; padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); }
.topbar { max-width: 1180px; margin: 0 auto 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.page-nav { position: fixed; left: 16px; top: 116px; width: 112px; display: grid; gap: 8px; z-index: 10; }
.page-nav button { display: flex; align-items: center; justify-content: center; width: 100%; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.78); color: #657383; font-weight: 800; text-align: center; }
.page-nav button.active { border-color: var(--navy); background: var(--navy); color: white; }
.page-nav button:disabled { opacity: .6; cursor: default; }
.nav-note { display: block; font-size: .65rem; font-weight: 500; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.balance { min-width: 78px; padding: 8px 12px; border: 1px solid rgba(41, 76, 104, .1); border-radius: 14px; background: rgba(255,255,255,.7); text-align: center; }
.balance strong { display: block; color: var(--navy); font-size: 1.1rem; }
.balance span { color: var(--muted); font-size: .72rem; }
.workspace { max-width: 1180px; margin: auto; display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .85fr); gap: 18px; align-items: start; }
.daily-column, .panel, .page-shell { border: 1px solid rgba(41, 76, 104, .11); border-radius: 22px; background: rgba(255, 253, 248, .94); box-shadow: var(--shadow); }
.daily-column { padding: 18px; }
.overview-column { display: grid; gap: 18px; }
.panel { padding: 18px; }
.page-shell { max-width: 1180px; margin: 0 auto; padding: 20px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.manage-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 18px; align-items: start; }
.manage-left-stack { display: grid; gap: 18px; }
.parent-approval-panel { padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: var(--cream); }
.parent-approval-panel > .panel { padding: 0; border: 0; box-shadow: none; background: transparent; }
.parent-approval-heading { margin: 0 0 4px; }
.manage-grid > .weekly-panel { grid-column: 2; grid-row: 1; }
.config-grid { display: grid; grid-template-columns: minmax(280px, .72fr) minmax(0, 1.28fr); gap: 18px; align-items: start; }
.reward-settings-panel { margin-bottom: 18px; }
.growth-management-section { margin-top: 18px; }
.section-heading { margin: 0 0 14px; padding: 0 4px; }
.project-list-panel, .project-editor { box-shadow: none; }
.desktop-parent { display: inline-flex; align-items: center; }
.date-row { position: relative; display: flex; justify-content: center; align-items: center; min-height: 54px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.form-actions { display: flex; align-items: center; gap: 10px; }
.form-actions .primary, .form-actions .ghost { min-width: 112px; }
.date-control { display: inline-flex; align-items: center; gap: 3px; padding: 5px; border: 1px solid #d8e0e4; border-radius: 18px; background: linear-gradient(180deg, #f8faf9, #eef2f1); box-shadow: inset 0 1px 0 white, 0 8px 22px rgba(41, 76, 104, .08); }
.date-step { width: 42px; min-height: 42px; padding: 0; border: 0; border-radius: 13px; background: transparent; color: var(--navy); font-size: 1.65rem; line-height: 1; }
.date-step:hover { background: white; box-shadow: 0 3px 10px rgba(41, 76, 104, .1); }
.date-picker-wrap { position: relative; min-width: 142px; min-height: 42px; display: grid; place-items: center; padding: 0 18px; border-left: 1px solid #dfe5e8; border-right: 1px solid #dfe5e8; color: var(--navy); font-size: 1rem; font-weight: 900; cursor: pointer; }
.date-picker-wrap input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.date-actions { position: absolute; right: 0; display: flex; align-items: center; }
.date-return { min-height: 38px; padding: 7px 13px; border: 1px solid #d8e0e4; border-radius: 99px; background: white; color: var(--blue); font-size: .8rem; font-weight: 800; }
.icon-button { width: 44px; min-width: 44px; padding: 0; border: 1px solid var(--line); border-radius: 13px; background: white; color: var(--navy); font-size: 1.45rem; }
.mobile-date-bar { display: none; }
.category-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0; }
.category-tabs button { border: 1px solid var(--line); border-radius: 14px; background: #f4f6f5; color: #657383; font-weight: 800; }
.category-tabs button.active { border-color: var(--navy); background: var(--navy); color: white; box-shadow: 0 8px 18px rgba(41, 76, 104, .18); }
.summary-line { margin-bottom: 12px; color: var(--muted); font-size: .9rem; }
.group-title { display: flex; align-items: center; justify-content: space-between; margin: 18px 2px 8px; color: #526174; font-size: .85rem; font-weight: 800; }
.task-card { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: white; margin-bottom: 9px; }
.task-card.confirmed { opacity: .68; background: #f2f5f3; }
.task-title { margin-bottom: 5px; font-weight: 800; }
.task-meta { color: var(--muted); font-size: .78rem; }
.task-card button { border: 0; border-radius: 12px; padding: 8px 15px; background: #e5eef2; color: var(--navy); font-weight: 800; }
.task-card button.checkin { background: var(--green); color: white; }
.danger { border: 1px solid #d66b70; border-radius: 12px; background: #fff0f0; color: #a52f3b; font-weight: 800; }
.danger:hover, .danger:focus-visible { background: #d95762; border-color: #d95762; color: white; box-shadow: 0 6px 16px rgba(181, 47, 59, .22); }
.danger:active { transform: translateY(1px); }
.empty { padding: 30px 14px; border: 1px dashed #cbd5dc; border-radius: 16px; color: var(--muted); text-align: center; }
.count-badge { min-width: 30px; padding: 5px 9px; border-radius: 99px; background: #f3e1b7; color: #7d5713; text-align: center; font-weight: 900; }
.overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.overview-grid div { padding: 13px; border-radius: 14px; background: #f3f6f5; }
.overview-grid span { display: block; color: var(--muted); font-size: .78rem; }
.overview-grid strong { display: block; margin-top: 3px; color: var(--navy); font-size: 1.2rem; }
.overview-grid .overview-points { background: linear-gradient(135deg, #eef7f1, #e4f2e9); }
.overview-grid .overview-points strong { color: var(--green); font-size: 1.05rem; }
.overview-grid .overview-points.cap-reached, .mobile-overview .earned.cap-reached { border-color: rgba(217, 164, 65, .55); background: linear-gradient(135deg, #fff4cf, #ffe4a3); box-shadow: inset 0 0 0 1px rgba(217, 164, 65, .2), 0 7px 18px rgba(217, 164, 65, .16); }
.overview-grid .overview-points.cap-reached strong, .mobile-overview .earned.cap-reached strong { color: #9a5c13; }
.overview-note { margin: 14px 0 0; color: var(--muted); font-size: .82rem; }
.mobile-overview { display: none; }
.streak-panel { position: relative; overflow: hidden; background: linear-gradient(135deg, #fffaf0, #fff3d4); }
.streak-panel::after { content: ""; position: absolute; right: -35px; bottom: -55px; width: 130px; height: 130px; border-radius: 50%; background: rgba(238, 142, 43, .09); }
.streak-panel-head { position: relative; z-index: 1; display: flex; align-items: center; gap: 14px; }
.streak-flame { align-self: start; display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: linear-gradient(145deg, #ffe3a3, #ffc85b); font-size: 2.35rem; box-shadow: 0 10px 25px rgba(224, 128, 34, .24); animation: flame-pulse 1.8s ease-in-out infinite; }
.streak-flame.large { margin: -50px auto 12px; width: 88px; height: 88px; font-size: 2.8rem; }
.streak-panel.idle .streak-flame { filter: grayscale(.75); opacity: .55; animation: none; }
.streak-items { position: relative; z-index: 1; display: grid; gap: 9px; margin-top: 14px; }
.streak-item { padding: 11px 12px; border: 1px solid rgba(217, 164, 65, .22); border-radius: 14px; background: rgba(255,255,255,.66); }
.streak-item-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.streak-item-title strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; }
.streak-item-title span { flex: none; color: #9a5c13; font-size: .78rem; font-weight: 900; }
.streak-item .streak-track { margin-top: 8px; }
.streak-item p { margin: 6px 0 0; color: #9a5c13; font-size: .72rem; font-weight: 700; }
.streak-track { height: 9px; overflow: hidden; border-radius: 99px; background: rgba(217, 164, 65, .19); }
.streak-track span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #ffad33, #f06a32); transition: width .35s ease; }
.streak-next { margin: 7px 0 0; color: #9a5c13; font-size: .78rem; font-weight: 800; }
.mobile-streak-button { display: none; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; display: grid; align-items: end; min-height: 100dvh; padding: 18px 12px max(18px, env(safe-area-inset-bottom)); background: rgba(34, 48, 71, .42); }
.streak-sheet-card { position: relative; width: min(430px, 100%); margin: 0 auto; padding: 24px 22px 22px; border-radius: 26px; background: linear-gradient(145deg, #fffdf8, #fff2ce); box-shadow: 0 24px 70px rgba(34, 48, 71, .28); text-align: center; }
.streak-sheet-card .muted { margin: 8px 0 14px; }
.streak-sheet-card .sheet-items { max-height: min(48vh, 420px); overflow-y: auto; text-align: left; }
.sheet-close { position: absolute; right: 12px; top: 10px; width: 40px; border: 0; background: transparent; color: var(--muted); font-size: 1.65rem; }
.calendar-sheet-card { position: relative; width: min(430px, 100%); margin: 0 auto; padding: 24px 20px 20px; border-radius: 24px; background: var(--cream); box-shadow: 0 24px 70px rgba(34, 48, 71, .28); }
.calendar-sheet-card input { margin-top: 18px; }
.calendar-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
@keyframes flame-pulse { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-2px) scale(1.06); } }
.weekly-progress-list { display: grid; gap: 8px; margin-top: 14px; }
.weekly-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; border-radius: 13px; background: #f3f6f5; }
.weekly-row.today { outline: 2px solid rgba(93, 135, 164, .28); background: #edf4f6; }
.weekly-row strong, .weekly-row span { display: block; }
.weekly-row span { margin-top: 3px; color: var(--muted); font-size: .76rem; }
.weekly-remaining { flex: none; color: #9a6516; font-size: .8rem; font-weight: 800; }
.weekly-remaining.done { color: var(--green); }
.family-settings-panel { margin-bottom: 18px; box-shadow: none; }
.settings-form { display: grid; grid-template-columns: minmax(170px, .8fr) auto minmax(220px, 1fr) auto; gap: 12px; align-items: end; margin-top: 14px; }
.settings-form .check-label { display: flex; align-items: center; gap: 8px; min-height: 46px; white-space: nowrap; }
.settings-form .check-label input { width: 20px; min-height: 20px; accent-color: var(--navy); }
.settings-form #settings-message { grid-column: 1 / -1; min-height: 1em; margin: 0; }
.import-entry { width: 100%; min-height: 58px; margin: 14px 0; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; border: 1px dashed #b9c8d1; border-radius: 13px; background: #f6f8f7; color: var(--ink); text-align: left; }
.import-entry small { color: var(--muted); }
.project-row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 13px; background: white; color: var(--ink); text-align: left; }
.project-row:hover { border-color: var(--blue); background: #f6fafb; }
.project-row strong { display: block; }
.project-row span { color: var(--muted); font-size: .78rem; }
.history-filters { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 10px; align-items: end; }
.history-list { display: grid; gap: 10px; margin-top: 18px; }
.history-card { display: grid; grid-template-columns: 100px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.history-card .history-date { color: var(--muted); font-size: .82rem; }
.history-card h3 { margin: 0 0 5px; font-size: 1rem; }
.history-card p { margin: 3px 0 0; color: var(--muted); font-size: .8rem; }
.history-points { color: var(--green); font-weight: 900; }
.compact-list { display: grid; gap: 9px; margin-top: 14px; }
.pending-card { padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.pending-card .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pending-card p { margin: 5px 0 0; color: var(--muted); font-size: .8rem; }
.pending-card button { border: 0; border-radius: 10px; background: var(--navy); color: white; padding: 7px 12px; font-weight: 800; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.wide { grid-column: 1 / -1; }

@media (min-width: 768px) {
  .app-shell { padding-left: 144px; }
}

@media (max-width: 767px) {
  .app-shell { padding: max(14px, env(safe-area-inset-top)) 12px calc(112px + env(safe-area-inset-bottom)); }
  .topbar { position: relative; align-items: flex-start; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
  .topbar > div:first-child { padding-right: 104px; }
  .topbar h1 { margin-bottom: 0; font-size: 1.7rem; }
  .top-actions { width: 100%; flex-wrap: wrap; justify-content: stretch; }
  .top-actions #mobile-history { position: absolute; top: 0; right: 52px; }
  .top-actions #logout { position: absolute; top: 0; right: 0; width: 44px; padding: 0; font-size: .78rem; }
  .balance { min-width: 64px; padding: 4px 8px; flex: 1; }
  .mobile-only { display: inline-flex; align-items: center; justify-content: center; }
  .mobile-nav-label { display: inline; }
  .desktop-nav-label { display: none; }
  .desktop-parent { display: none !important; }
  .page-nav { top: auto; bottom: 0; left: 0; width: 100%; grid-template-columns: repeat(2, 1fr); gap: 6px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: rgba(247,244,236,.96); border-top: 1px solid var(--line); }
  .page-nav button { min-height: 48px; }
  .page-nav #nav-history { display: none; }
  .mobile-date-bar { position: fixed; left: 0; right: 0; bottom: calc(65px + env(safe-area-inset-bottom)); z-index: 19; width: 100%; min-height: 56px; margin: 0; padding: 3px 6px; display: flex; justify-content: center; align-items: center; gap: 6px; border-top: 1px solid rgba(41, 76, 104, .09); background: rgba(247, 244, 236, .96); backdrop-filter: blur(12px); }
  .mobile-date-control { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid #d8e0e4; border-radius: 16px; background: linear-gradient(180deg, #f8faf9, #eef2f1); box-shadow: inset 0 1px 0 white, 0 5px 14px rgba(41, 76, 104, .08); }
  .mobile-date-step { width: 32px; min-height: 36px; padding: 0; border: 0; border-radius: 11px; background: transparent; color: var(--navy); font-size: 1.5rem; line-height: 1; }
  .mobile-date-step:active, .mobile-date-step:hover { background: white; }
  .mobile-date-trigger { min-width: 128px; min-height: 36px; padding: 0 8px; border: 0; background: transparent; color: var(--navy); font-size: .95rem; font-weight: 900; }
  .mobile-date-trigger::after { content: " ▾"; color: var(--blue); }
  .workspace { grid-template-columns: 1fr; }
  .overview-column { display: none; }
  .page-shell { padding: 13px; border-radius: 18px; }
  .page-heading { align-items: flex-start; }
  .manage-grid, .config-grid { grid-template-columns: 1fr; }
  .manage-grid > .weekly-panel { grid-column: auto; grid-row: auto; }
  .project-view:not(.mobile-editor-open) .project-editor { display: none; }
  .project-view.mobile-editor-open .project-list-panel { display: none; }
  .project-view.mobile-editor-open .family-settings-panel { display: none; }
  .settings-form { grid-template-columns: 1fr; }
  .settings-form #settings-message { grid-column: auto; }
  .history-filters { grid-template-columns: 1fr 1fr; }
  .history-filters button { grid-column: 1 / -1; }
  .history-card { grid-template-columns: 1fr auto; }
  .history-card .history-date { grid-column: 1 / -1; }
  .daily-column, .panel { border-radius: 18px; padding: 6px; }
  .category-tabs { position: sticky; top: 0; z-index: 5; padding: 6px 0; background: rgba(255,253,248,.96); }
  .daily-column > .date-row { display: none; }
  .category-tabs { margin-top: 0; margin-bottom: 8px; }
  .summary-line { display: none; }
  .mobile-overview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: -5px 0 10px; width: 100%; }
  .mobile-overview div { min-width: 0; padding: 10px 7px; border: 1px solid rgba(41, 76, 104, .08); border-radius: 13px; background: #f3f6f5; text-align: center; }
  .mobile-overview div.earned { background: #eaf4ed; }
  .mobile-overview span, .mobile-overview strong { display: block; }
  .mobile-overview span { color: var(--muted); font-size: .68rem; }
  .mobile-overview strong { margin-top: 4px; color: var(--navy); font-size: .92rem; white-space: nowrap; }
  .mobile-overview .earned strong { color: var(--green); font-size: .78rem; }
  .mobile-streak-button { position: static; flex: 0 0 auto; z-index: auto; display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 92px; height: 42px; padding: 5px 7px; border: 1px solid rgba(217, 164, 65, .55); border-radius: 13px; background: linear-gradient(180deg, #fff4cf, #ffe2a0); color: #9a5c13; box-shadow: 0 4px 10px rgba(194, 92, 28, .14); }
  .mobile-streak-button span { font-size: 1.4rem; }
  .mobile-streak-button strong { font-size: 1rem; }
  .category-tabs button { padding: 7px 4px; }
  .form-grid { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .task-card { grid-template-columns: 1fr; }
  .task-card button { width: 100%; }
}
