:root {
  color-scheme: light;
  --blue: #1268f3;
  --blue-soft: #eaf2ff;
  --ink: #111827;
  --muted: #748097;
  --line: #e8ecf2;
  --surface: #f7f9fc;
  --red: #ff343d;
  --orange: #ff8a16;
  --green: #38b648;
  --radius: 16px;
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

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

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #fff;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  width: min(100%, 680px);
  margin: 0 auto;
  padding: 28px 24px 150px;
}

.app-header { display: flex; align-items: flex-start; justify-content: space-between; }
.app-header h1 { margin: 0 0 7px; font-size: 30px; line-height: 1.2; letter-spacing: -0.03em; }
.today-label { margin: 0; color: var(--muted); font-size: 15px; }
.avatar { width: 48px; height: 48px; border: 0; border-radius: 50%; background: var(--blue); color: #fff; font-size: 18px; cursor: pointer; }
.sync-status { display: inline-flex; align-items: center; gap: 7px; min-height: 30px; margin-top: 14px; padding: 0 11px; border: 1px solid var(--line); border-radius: 16px; background: #fff; color: var(--muted); font-size: 12px; cursor: pointer; }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: #aeb7c7; }
.sync-status.is-online .sync-dot { background: var(--green); }
.sync-status.is-syncing .sync-dot { background: var(--orange); animation: pulse 1s infinite; }
.sync-status.is-error .sync-dot { background: var(--red); }
@keyframes pulse { 50% { opacity: .35; } }

.progress-section { padding: 42px 0 26px; }
.progress-copy { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 16px; }
.progress-copy strong { color: var(--blue); font-size: 20px; }
.add-button { min-height: 48px; padding: 0 18px; border: 0; border-radius: 13px; background: var(--blue); color: #fff; font-weight: 650; cursor: pointer; box-shadow: 0 8px 22px rgba(18,104,243,.16); }
.add-button span { margin-right: 4px; font-size: 22px; font-weight: 400; }
.progress-track { height: 7px; margin-top: 16px; overflow: hidden; border-radius: 20px; background: #e9edf3; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--blue); transition: width .25s ease; }

.domain-tabs { display: flex; gap: 8px; padding-bottom: 18px; }
.domain-tab { min-width: 68px; min-height: 38px; padding: 0 18px; border: 1px solid var(--line); border-radius: 20px; background: #fff; color: var(--muted); cursor: pointer; }
.domain-tab.is-active { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); font-weight: 650; }

.time-tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.time-tab { position: relative; min-height: 60px; border: 0; background: transparent; color: var(--muted); font-size: 17px; cursor: pointer; }
.time-tab.is-active { color: var(--blue); font-weight: 650; }
.time-tab.is-active::after { content: ""; position: absolute; bottom: -1px; left: 50%; width: 44px; height: 3px; border-radius: 3px 3px 0 0; background: var(--blue); transform: translateX(-50%); }

.task-group { padding-top: 34px; }
.task-group-title { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-size: 19px; }
.group-dot { width: 10px; height: 10px; border-radius: 50%; background: #aeb7c7; }
.task-group.important .group-dot { background: var(--red); }
.task-row { position: relative; display: grid; grid-template-columns: 46px minmax(0, 1fr) auto 30px; align-items: center; min-height: 92px; border-bottom: 1px solid var(--line); }
.task-check { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 2px solid #95a1b5; border-radius: 8px; background: #fff; color: transparent; cursor: pointer; }
.task-check:hover { border-color: var(--blue); }
.task-row.is-completed .task-check { border-color: var(--blue); background: var(--blue); color: #fff; }
.task-main { min-width: 0; padding: 12px 14px 12px 0; }
.task-title { display: block; overflow: hidden; color: var(--ink); font-size: 16px; font-weight: 590; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
.task-domain { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; }
.task-row.is-completed .task-title { color: #9aa4b5; text-decoration: line-through; }
.task-meta { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 14px; white-space: nowrap; }
.task-row.important:not(.is-completed) .task-meta { color: var(--red); }
.priority-dot { width: 8px; height: 8px; border-radius: 50%; background: #aeb7c7; }
.task-row.important .priority-dot { background: var(--red); }
.more-button { width: 30px; height: 44px; border: 0; background: transparent; color: var(--muted); cursor: pointer; letter-spacing: 2px; }

.empty-state { padding: 76px 20px; text-align: center; }
.empty-check { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 18px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-size: 24px; }
.empty-state h2 { margin: 0 0 8px; font-size: 19px; }
.empty-state p { margin: 0; color: var(--muted); font-size: 14px; }

.floating-add { position: fixed; right: max(24px, calc((100vw - 680px) / 2 + 24px)); bottom: 100px; width: 58px; height: 58px; border: 0; border-radius: 50%; background: var(--blue); color: #fff; font-size: 32px; font-weight: 300; box-shadow: 0 10px 28px rgba(18,104,243,.28); cursor: pointer; }
.bottom-nav { position: fixed; z-index: 5; bottom: 0; left: 50%; display: grid; grid-template-columns: repeat(3, 1fr); width: min(100%, 680px); height: calc(76px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); transform: translateX(-50%); backdrop-filter: blur(12px); }
.bottom-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border: 0; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.bottom-item.is-active { color: var(--blue); }
.bottom-icon { display: grid; place-items: center; width: 24px; height: 24px; border: 2px solid currentColor; border-radius: 5px; font-size: 14px; }
.check-icon { border-color: var(--blue); background: var(--blue); color: #fff; }
.person-icon { position: relative; border: 0; border-radius: 0; }
.person-icon::before { content: ""; position: absolute; top: 0; width: 8px; height: 8px; border: 2px solid currentColor; border-radius: 50%; }
.person-icon::after { content: ""; position: absolute; bottom: 0; width: 20px; height: 10px; border: 2px solid currentColor; border-bottom: 0; border-radius: 12px 12px 0 0; }

.sheet-backdrop { position: fixed; z-index: 10; inset: 0; background: rgba(15,23,42,.34); }
.add-sheet { position: fixed; z-index: 11; bottom: 0; left: 50%; width: min(100%, 680px); padding: 10px 24px calc(24px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; background: #fff; transform: translateX(-50%); box-shadow: 0 -20px 50px rgba(15,23,42,.12); }
.sheet-handle { width: 42px; height: 4px; margin: 0 auto 14px; border-radius: 4px; background: #d5dae3; }
.sheet-header { display: flex; align-items: center; justify-content: space-between; }
.sheet-header h2 { margin: 0; font-size: 22px; }
.icon-button { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--surface); color: var(--muted); font-size: 26px; cursor: pointer; }
.field-label, legend { display: block; margin-bottom: 9px; color: #596579; font-size: 13px; font-weight: 650; }
#task-form > .field-label { margin-top: 18px; }
input, select { width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid #dce2ea; border-radius: 12px; outline: none; color: var(--ink); background: #fff; }
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
fieldset { margin: 20px 0 0; padding: 0; border: 0; }
.choice-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.choice-row.three { grid-template-columns: repeat(3, 1fr); }
.choice { display: flex; align-items: center; justify-content: center; min-height: 44px; border: 1px solid #dce2ea; border-radius: 12px; color: #596579; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); font-weight: 650; }
.choice input { position: absolute; width: 1px; min-height: 1px; opacity: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; }
.submit-button { flex: 1; min-height: 52px; border: 0; border-radius: 13px; background: var(--blue); color: #fff; font-weight: 700; cursor: pointer; }
.delete-button { min-width: 96px; border: 1px solid #ffd4d7; border-radius: 13px; background: #fff5f5; color: #e52630; font-weight: 700; cursor: pointer; }
.sheet-subtitle { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.profile-view { position: fixed; z-index: 4; inset: 0 0 calc(76px + env(safe-area-inset-bottom)); overflow-y: auto; background: #f7f9fc; }
.profile-inner { width: min(100%, 680px); min-height: 100%; margin: 0 auto; padding: 24px 20px 48px; background: #f7f9fc; }
.profile-header { display: flex; align-items: center; gap: 14px; padding-bottom: 28px; }
.profile-header h2 { margin: 0 0 4px; font-size: 28px; letter-spacing: -.03em; }
.profile-header p { margin: 0; color: var(--muted); font-size: 13px; }
.back-button { display: grid; place-items: center; width: 42px; height: 42px; padding: 0 0 4px; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--ink); font-size: 32px; font-weight: 300; cursor: pointer; }
.profile-account { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 20px; border-radius: 18px; background: var(--blue); color: #fff; box-shadow: 0 12px 32px rgba(18,104,243,.16); }
.profile-avatar { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: rgba(255,255,255,.18); font-size: 20px; font-weight: 700; }
.profile-account-copy { display: flex; min-width: 0; flex-direction: column; }
.profile-account-copy strong { font-size: 17px; }
.profile-account-copy span { overflow: hidden; margin-top: 5px; color: rgba(255,255,255,.76); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.profile-link { min-height: 38px; padding: 0 14px; border: 1px solid rgba(255,255,255,.4); border-radius: 20px; background: rgba(255,255,255,.13); color: #fff; font-size: 13px; font-weight: 700; cursor: pointer; }
.profile-section { margin-top: 28px; }
.profile-section h3 { margin: 0 0 10px 4px; color: var(--muted); font-size: 13px; font-weight: 650; }
.profile-list { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.profile-row { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 72px; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--line); background: #fff; color: var(--ink); text-align: left; cursor: pointer; }
.profile-row:last-child { border-bottom: 0; }
.profile-row > span { display: flex; flex-direction: column; }
.profile-row strong { font-size: 15px; font-weight: 650; }
.profile-row small { margin-top: 5px; color: var(--muted); font-size: 12px; }
.profile-row b { color: #a6afbf; font-size: 25px; font-weight: 300; }
.profile-row:active { background: #f7f9fc; }
.profile-footnote { margin: 20px 8px 0; color: #98a2b3; font-size: 12px; line-height: 1.7; }
.import-label { position: relative; }
.import-label input { position: absolute; width: 1px; height: 1px; min-height: 1px; opacity: 0; }
.auth-form { display: grid; gap: 18px; margin-top: 24px; }
.auth-form .submit-button { width: 100%; }
.secondary-button { min-height: 50px; border: 1px solid #cbd8ec; border-radius: 13px; background: #fff; color: var(--blue); font-weight: 700; cursor: pointer; }
.toast { position: fixed; z-index: 20; bottom: 94px; left: 50%; padding: 10px 16px; border-radius: 10px; background: #1f2937; color: #fff; font-size: 13px; opacity: 0; pointer-events: none; transform: translate(-50%, 10px); transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 760px) {
  body { background: #f3f5f8; }
  .app-shell { min-height: 100vh; background: #fff; box-shadow: 0 0 40px rgba(15,23,42,.06); }
}

@media (max-width: 460px) {
  .app-shell { padding: 24px 20px 140px; }
  .progress-section { padding-top: 34px; }
  .add-button { padding: 0 14px; }
  .task-row { grid-template-columns: 44px minmax(0, 1fr) auto 24px; min-height: 88px; }
  .task-meta { flex-direction: column; align-items: flex-end; gap: 5px; }
  .form-grid { grid-template-columns: 1fr 1fr; }
}

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