:root {
  color-scheme: light;
  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface-soft: #f9f9fb;
  --ink: #111111;
  --muted: #6e6e73;
  --tertiary: #9a9aa0;
  --line: rgba(60, 60, 67, 0.14);
  --line-strong: rgba(60, 60, 67, 0.22);
  --accent: #007aff;
  --accent-soft: #e8f2ff;
  --green: #34c759;
  --orange: #ff9f0a;
  --red: #ff3b30;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI",
    "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

button,
textarea,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px calc(94px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 8px 0 14px;
}

.top-date-wrap {
  display: inline-grid;
  grid-template-columns: 30px auto 30px;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.top-date {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0;
  white-space: nowrap;
}

.date-nav-button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: rgba(118, 118, 128, 0.1);
  color: var(--accent);
  font-size: 22px;
  line-height: 1;
  font-weight: 600;
}

.date-nav-button:disabled {
  color: var(--tertiary);
  opacity: 0.42;
  cursor: default;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.brand-mark {
  color: var(--tertiary);
  font-size: 12px;
  font-weight: 650;
}

.eyebrow,
.section-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
}

.section-kicker {
  color: var(--tertiary);
  font-size: 12px;
}

.app-main {
  display: grid;
  gap: 16px;
}

.progress-panel,
.section-block,
.input-hero {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.progress-panel {
  display: grid;
  grid-template-columns: 1fr 94px;
  align-items: center;
  gap: 14px;
  padding: 18px;
}

.progress-number {
  display: block;
  margin-top: 2px;
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}

.progress-ring {
  width: 88px;
  aspect-ratio: 1;
}

.progress-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.progress-ring circle {
  fill: none;
  stroke-width: 9;
}

.ring-bg {
  stroke: #e5e5ea;
}

.ring-value {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 264;
  stroke-dashoffset: 264;
  transition: stroke-dashoffset 180ms ease;
}

.section-block,
.input-hero {
  padding: 16px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-head h2,
.input-hero h2 {
  margin: 3px 0 0;
  font-size: 20px;
  font-weight: 750;
  line-height: 1.25;
  letter-spacing: 0;
}

.muted {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.text-button,
.icon-button,
.primary-button,
.secondary-button,
.danger-button {
  border: 0;
  border-radius: 999px;
  min-height: 36px;
  padding: 0 14px;
  font-weight: 700;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  min-height: 38px;
  padding: 0;
  background: rgba(118, 118, 128, 0.12);
  color: var(--accent);
  font-size: 16px;
}

.text-button {
  background: rgba(0, 122, 255, 0.1);
  color: var(--accent);
  flex: 0 0 auto;
  min-width: 58px;
  white-space: nowrap;
}

.primary-button {
  width: 100%;
  min-height: 50px;
  background: var(--accent);
  color: #ffffff;
  font-size: 17px;
}

.primary-button:disabled,
.secondary-button:disabled,
.text-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.secondary-button {
  background: var(--surface-soft);
  color: var(--accent);
  border: 1px solid var(--line);
}

.danger-button {
  min-height: 32px;
  background: rgba(255, 59, 48, 0.1);
  color: var(--red);
  font-size: 13px;
}

.delete-icon-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: rgba(118, 118, 128, 0.08);
  color: var(--tertiary);
  padding: 0;
}

.delete-icon-button svg,
.report-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.delete-icon-button:active {
  background: rgba(118, 118, 128, 0.16);
  color: var(--muted);
}

.task-list,
.focus-list {
  display: grid;
  gap: 10px;
}

.task-card,
.focus-card,
.report-box,
.note-box {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.task-card,
.focus-card {
  padding: 13px;
}

.focus-card {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.28);
  color: #ffffff;
  min-width: 0;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.focus-section {
  overflow: hidden;
  border: 0;
  background:
    radial-gradient(circle at 18% 8%, rgba(255, 255, 255, 0.45), transparent 34%),
    linear-gradient(135deg, #0a84ff 0%, #007aff 48%, #5e5ce6 100%);
  color: #ffffff;
  box-shadow: 0 18px 42px rgba(0, 122, 255, 0.24);
}

.focus-section .section-kicker,
.focus-section .muted {
  color: rgba(255, 255, 255, 0.78);
}

.focus-section .section-head h2 {
  color: #ffffff;
}

.focus-section .text-button {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.focus-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.focus-card h3 {
  margin: 8px 0 0;
  font-size: 15px;
  font-weight: 780;
  line-height: 1.28;
  letter-spacing: 0;
}

.focus-card p {
  margin: 7px 0 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.focus-label {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  font-size: 12px;
  font-weight: 750;
}

.task-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.task-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 9px 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  border-radius: 999px;
  padding: 0 9px;
  background: rgba(118, 118, 128, 0.12);
  color: #4b4b50;
  font-size: 12px;
  font-weight: 650;
}

.tag-button {
  border: 0;
  cursor: pointer;
  gap: 4px;
  padding-right: 8px;
}

.tag-button::after {
  content: "⌄";
  font-size: 12px;
  line-height: 1;
  opacity: 0.7;
}

.tag.priority {
  background: rgba(0, 122, 255, 0.12);
  color: #005ecb;
}

.tag.status-complete {
  background: var(--accent);
  color: #ffffff;
}

.tag.priority-urgent {
  background: rgba(255, 59, 48, 0.1);
  color: var(--red);
}

.tag.emotion {
  background: rgba(255, 159, 10, 0.16);
  color: #9a5a00;
}

.task-compact-edit {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.task-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.compact-action {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.task-compact-edit label,
.field-grid label,
.review-form > label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.task-compact-edit input,
.review-form input,
.review-form textarea,
.review-form select,
.input-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

.review-form select {
  min-height: 42px;
}

.task-compact-edit input:focus,
.review-form input:focus,
.review-form textarea:focus,
.review-form select:focus,
.input-form textarea:focus {
  border-color: rgba(0, 122, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.12);
}

.review-form textarea,
.input-form textarea {
  resize: vertical;
  line-height: 1.5;
}

.input-form textarea {
  min-height: 260px;
  font-size: 17px;
}

.steps {
  display: grid;
  gap: 7px;
  margin: 11px 0 0;
}

.step-item {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: start;
  gap: 9px;
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  padding: 9px 10px;
  text-align: left;
  font-size: 14px;
  line-height: 1.45;
}

.step-check {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.step-item.is-done {
  color: var(--muted);
}

.step-item.is-done .step-check {
  border-color: var(--green);
  background: var(--green);
}

.step-item.is-done span:last-child {
  text-decoration: line-through;
}

.step-empty {
  margin-top: 11px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  padding: 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
  font-size: 14px;
  line-height: 1.45;
}

.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  align-items: end;
  background: rgba(0, 0, 0, 0.18);
}

.sheet-panel {
  width: min(100%, 520px);
  margin: 0 auto;
  border-radius: 22px 22px 0 0;
  background: rgba(248, 248, 248, 0.96);
  border: 1px solid var(--line);
  box-shadow: 0 -18px 38px rgba(0, 0, 0, 0.16);
  padding: 8px 14px calc(14px + env(safe-area-inset-bottom));
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.decompose-sheet {
  max-height: min(86vh, 760px);
  overflow-y: auto;
}

.sheet-grabber {
  width: 36px;
  height: 5px;
  margin: 0 auto 10px;
  border-radius: 999px;
  background: rgba(60, 60, 67, 0.22);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px 10px;
}

.sheet-head strong {
  font-size: 17px;
  line-height: 1.3;
}

.sheet-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.sheet-close {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
}

.sheet-options {
  overflow: hidden;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.sheet-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  padding: 0 14px;
  text-align: left;
  font-size: 16px;
}

.sheet-option:last-child {
  border-bottom: 0;
}

.sheet-option.is-selected {
  color: var(--accent);
  font-weight: 700;
}

.decompose-content {
  display: grid;
  gap: 12px;
}

.decompose-section {
  display: grid;
  gap: 10px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #ffffff;
  padding: 12px;
}

.decompose-label {
  margin: 0;
  color: var(--tertiary);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.2;
}

.sheet-step-list {
  display: grid;
  gap: 7px;
}

.sheet-step-row {
  display: grid;
  grid-template-columns: 1fr 34px;
  gap: 7px;
  align-items: stretch;
}

.sheet-step-main {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 9px;
  align-items: start;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--ink);
  padding: 9px 10px;
  text-align: left;
  font-size: 14px;
  line-height: 1.45;
}

.sheet-step-row.is-selected .sheet-step-main {
  border-color: rgba(0, 122, 255, 0.45);
  background: var(--accent-soft);
}

.sheet-step-index {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(0, 122, 255, 0.1);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.sheet-step-delete {
  display: grid;
  place-items: center;
  width: 34px;
  min-height: 34px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 59, 48, 0.1);
  color: var(--red);
}

.sheet-step-delete svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.decompose-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.decompose-field select,
.decompose-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

.decompose-field textarea {
  resize: vertical;
  line-height: 1.5;
}

.decompose-field select:focus,
.decompose-field textarea:focus {
  border-color: rgba(0, 122, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.12);
}

.decompose-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.decompose-buttons .primary-button {
  grid-column: 1 / -1;
}

.decompose-buttons .danger-button:disabled {
  opacity: 0.5;
  cursor: default;
}

.note-box {
  padding: 13px;
  color: #2c2c2e;
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.report-box {
  display: grid;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #2c2c2e;
  font-size: 15px;
  line-height: 1.55;
}

.report-summary,
.report-card,
.report-meta-card {
  border-radius: 16px;
  border: 1px solid var(--line);
}

.report-summary {
  padding: 13px;
  background: #ffffff;
  color: var(--muted);
}

.report-grid {
  display: grid;
  gap: 10px;
}

.report-card {
  padding: 14px;
}

.report-card h3,
.report-meta-card h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 15px;
  font-weight: 780;
  line-height: 1.35;
  letter-spacing: 0;
}

.report-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  color: currentColor;
}

.report-meta-card .report-icon {
  background: rgba(0, 122, 255, 0.1);
  color: var(--accent);
}

.report-card ul {
  display: grid;
  gap: 7px;
  margin: 11px 0 0;
  padding: 0;
  list-style: none;
}

.report-card li {
  position: relative;
  padding-left: 16px;
  font-size: 14px;
  line-height: 1.45;
}

.report-card li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: currentColor;
  transform: translateY(-50%);
  opacity: 0.7;
}

.report-card.done {
  background: linear-gradient(135deg, #0a84ff, #007aff);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

.report-card.progress {
  background: #eaf4ff;
  color: #064a8f;
  border-color: rgba(0, 122, 255, 0.14);
}

.report-card.stalled {
  background: #ffffff;
  color: #3a3a3c;
}

.report-card.stalled h3 {
  color: #8a6d1d;
}

.report-meta-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.report-meta-card {
  padding: 13px;
  background: #ffffff;
}

.report-meta-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-line;
}

.note-box + .note-box {
  margin-top: 10px;
}

.note-box.soft {
  background: #fff9ed;
}

.log-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.log-card {
  min-width: 0;
  border-radius: 16px;
  border: 1px solid var(--line);
  padding: 13px;
  color: #2c2c2e;
  font-size: 14px;
  line-height: 1.5;
}

.log-card.zh {
  background: #ffffff;
}

.log-card.en {
  background: #eef6ff;
  color: #153d66;
  border-color: rgba(0, 122, 255, 0.12);
}

.log-label {
  margin: 0 0 8px;
  color: var(--tertiary);
  font-size: 12px;
  line-height: 1.2;
  font-weight: 750;
}

.input-form,
.review-form {
  display: grid;
  gap: 12px;
}

.review-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px;
  background: var(--surface-soft);
}

.review-card h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 750;
  line-height: 1.3;
  letter-spacing: 0;
}

.field-grid {
  display: grid;
  gap: 10px;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.backup-actions {
  margin-top: 14px;
}

.backup-note {
  margin: 10px 0 0;
  color: var(--tertiary);
  font-size: 13px;
  line-height: 1.45;
}

.form-message {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.form-message.error {
  color: var(--red);
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.65);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  width: min(100%, 520px);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(248, 248, 248, 0.84);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.nav-button {
  display: grid;
  place-items: center;
  gap: 2px;
  min-height: 54px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 22px;
  font-size: 20px;
  line-height: 1;
}

.nav-button.is-active {
  color: var(--accent);
}

.primary-nav {
  color: var(--accent);
}

.primary-nav .nav-icon {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 24px;
  font-weight: 500;
}

.primary-nav.is-active .nav-icon {
  background: #005ecb;
}

@media (max-width: 360px) {
  .app-shell {
    padding-inline: 12px;
  }

  .topbar h1 {
    font-size: 31px;
  }

  .progress-panel {
    grid-template-columns: 1fr 78px;
  }

  .progress-number {
    font-size: 38px;
  }

  .progress-ring {
    width: 74px;
  }

  .button-row {
    grid-template-columns: 1fr;
  }

  .top-date-wrap {
    grid-template-columns: 28px auto 28px;
  }

  .top-date {
    font-size: 15px;
  }

  .focus-grid {
    gap: 8px;
  }

  .focus-card {
    padding: 11px;
  }

  .focus-card h3 {
    font-size: 14px;
  }

  .focus-card p {
    font-size: 12px;
    -webkit-line-clamp: 2;
  }
}

@media (min-width: 720px) {
  body {
    background: #e5e5ea;
  }
}
