:root {
  --accent: #5eead4;
  --bg: #070b12;
  --text: #eef4fc;
  --muted: rgba(226, 236, 250, 0.6);
  --faint: rgba(226, 236, 250, 0.4);
  --line: rgba(255, 255, 255, 0.09);
  --card: rgba(255, 255, 255, 0.055);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
}

body {
  font-family: "PingFang SC", "Microsoft YaHei UI", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.locked {
  overflow: hidden;
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(70% 45% at 8% -5%, rgba(45, 212, 191, 0.22) 0%, transparent 62%),
    radial-gradient(55% 40% at 100% 8%, rgba(59, 130, 246, 0.18) 0%, transparent 60%),
    radial-gradient(60% 45% at 50% 100%, rgba(14, 116, 144, 0.12) 0%, transparent 65%);
  z-index: -1;
}

button {
  font-family: inherit;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}

input,
textarea {
  font-family: inherit;
  color: var(--text);
  font-size: 16px;
}

svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[hidden] {
  display: none !important;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 20px 12px;
  background: linear-gradient(180deg, rgba(7, 11, 18, 0.92), rgba(7, 11, 18, 0.55) 75%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.offline-note {
  margin: 6px 18px 0;
  padding: 9px 12px;
  border-radius: 11px;
  border: 1px solid rgba(251, 191, 36, 0.28);
  background: rgba(251, 191, 36, 0.1);
  color: #fcd34d;
  font-size: 12px;
  line-height: 1.5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  box-shadow: 0 6px 18px rgba(45, 212, 191, 0.22);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.brand-text strong {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-text span {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.12);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.sync-dot.offline {
  background: #fbbf24;
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.12);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}

.icon-btn:active {
  background: rgba(255, 255, 255, 0.12);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* ---------- 内容 ---------- */
.content {
  padding: 4px 18px calc(172px + env(safe-area-inset-bottom, 0px));
  max-width: 620px;
  margin: 0 auto;
}

.hero {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 18px 18px 16px;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(94, 234, 212, 0.16) 0%, transparent 55%),
    linear-gradient(155deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.035));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
}

.hero::after {
  content: "";
  position: absolute;
  right: -46px;
  top: -58px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 1px solid rgba(94, 234, 212, 0.18);
  background: radial-gradient(circle, rgba(94, 234, 212, 0.12), transparent 70%);
  pointer-events: none;
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.hero h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.1;
  font-weight: 750;
  letter-spacing: 0.01em;
}

.hero p {
  margin: 5px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.hero-count {
  display: flex;
  align-items: baseline;
  gap: 1px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 96px;
  font-variant-numeric: tabular-nums;
}

.hero-count strong {
  font-size: 26px;
  line-height: 1;
  color: var(--accent);
  font-weight: 750;
}

.hero-count span {
  font-size: 13px;
  color: var(--faint);
}

.hero-count small {
  flex: 0 0 100%;
  text-align: right;
  font-size: 10px;
  color: var(--faint);
  letter-spacing: 0.08em;
}

.hero-bar {
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  margin: 14px 0 9px;
}

.hero-bar i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, rgba(94, 234, 212, 0.7), var(--accent));
  box-shadow: 0 0 14px rgba(94, 234, 212, 0.55);
  transition: width 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.hero-hint {
  font-size: 11.5px !important;
  color: var(--faint) !important;
  margin: 0 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 列表 ---------- */
.list {
  margin-top: 18px;
}

.group {
  margin-bottom: 18px;
}

.group-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 4px 8px;
}

.group-head .dot {
  width: 5px;
  height: 5px;
  border-radius: 99px;
  background: var(--accent);
}

.group-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.group-head .count {
  font-size: 10px;
  color: var(--faint);
  background: rgba(255, 255, 255, 0.07);
  padding: 1px 7px;
  border-radius: 99px;
}

.group-head .sub {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--faint);
}

.group.overdue .dot {
  background: #f87171;
}

.group.overdue h2 {
  color: #fca5a5;
}

.tasks {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.task {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 13px 13px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  transition: background 0.15s ease, transform 0.12s ease;
}

.task:active {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(0.994);
}

.task.done {
  opacity: 0.6;
}

.check {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 8px;
  border: 1.8px solid rgba(255, 255, 255, 0.4);
  display: grid;
  place-items: center;
  margin-top: 1px;
  color: transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.check svg {
  width: 15px;
  height: 15px;
  stroke-width: 3;
}

.task.done .check {
  background: var(--accent);
  border-color: var(--accent);
  color: #04141a;
}

.task-body {
  flex: 1 1 auto;
  min-width: 0;
}

.task-title {
  font-size: 15px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.cat-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 5px;
  border: 1px solid transparent;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.5;
  vertical-align: 1px;
}

.cat-meeting {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(96, 165, 250, 0.3);
}

.cat-research {
  color: #86efac;
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(74, 222, 128, 0.28);
}

.cat-other {
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.24);
}

.task.done .task-title {
  text-decoration: line-through;
  color: var(--faint);
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--faint);
  min-height: 16px;
  overflow: hidden;
}

.task-meta .time {
  color: rgba(94, 234, 212, 0.85);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

.task.overdue .time {
  color: #fca5a5;
}

.task-meta .note {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-meta .note::before {
  content: "·";
  margin-right: 6px;
  opacity: 0.6;
}

.task .chevron {
  color: var(--faint);
  margin-top: 2px;
  flex: 0 0 auto;
}

.task .chevron svg {
  width: 16px;
  height: 16px;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 44px 24px 20px;
}

.empty-icon {
  width: 58px;
  height: 58px;
  border-radius: 19px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--accent);
}

.empty-icon svg {
  width: 26px;
  height: 26px;
}

.empty strong {
  font-size: 15px;
  font-weight: 600;
}

.empty span {
  font-size: 12px;
  color: var(--faint);
  max-width: 240px;
  line-height: 1.7;
}

.empty .retry {
  margin-top: 6px;
  font-size: 13px;
  color: var(--accent);
  border: 1px solid rgba(94, 234, 212, 0.35);
  background: rgba(94, 234, 212, 0.1);
  border-radius: 10px;
  padding: 8px 16px;
}

.footer-note {
  text-align: center;
  font-size: 10.5px;
  color: rgba(226, 236, 250, 0.28);
  margin: 26px 0 8px;
}

/* ---------- 悬浮按钮 ---------- */
.fab {
  position: fixed;
  right: 20px;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  width: 58px;
  height: 58px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  color: #04141a;
  background: linear-gradient(145deg, #a7f3e4, var(--accent) 55%, #14b8a6);
  box-shadow: 0 14px 30px rgba(20, 184, 166, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  z-index: 15;
  transition: transform 0.15s ease;
}

.fab:active {
  transform: scale(0.94);
}

.fab svg {
  width: 26px;
  height: 26px;
  stroke-width: 2.6;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px));
  background: rgba(7, 11, 18, 0.94);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
}

.nav-item {
  flex: 1;
  max-width: 220px;
  height: 46px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #6f8199;
  font-size: 14px;
  font-weight: 600;
}

.nav-item.active {
  color: #5eead4;
  background: rgba(94, 234, 212, 0.1);
}

/* ---------- 底部表单 ---------- */
.sheet-layer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.sheet {
  position: relative;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 24px 24px 0 0;
  background: linear-gradient(180deg, #131e30, #0b1320);
  border-top: 1px solid rgba(255, 255, 255, 0.13);
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.5);
  transform: translateY(102%);
  transition: transform 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.sheet.open,
.sheet-layer.open .sheet {
  transform: none;
}

.sheet-layer.open .sheet-backdrop {
  opacity: 1;
}

.sheet-grab {
  width: 40px;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.2);
  margin: 0 auto 12px;
}

.sheet h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  min-width: 0;
}

.field > span {
  font-size: 11.5px;
  color: var(--faint);
  letter-spacing: 0.03em;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-width: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 12px;
  padding: 12px 13px;
  font-size: 16px;
  outline: none;
  color-scheme: dark;
}

.field select {
  appearance: none;
  -webkit-appearance: none;
  color: var(--text);
}

.field input:focus,
.field textarea:focus {
  border-color: rgba(94, 234, 212, 0.55);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.1);
}

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

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

.sheet-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 20px;
}

.spacer {
  flex: 1;
}

.btn {
  height: 44px;
  padding: 0 18px;
  border-radius: 13px;
  border: 1px solid transparent;
  font-size: 14.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn.primary {
  color: #04141a;
  background: linear-gradient(145deg, #b8f8ec, var(--accent));
  box-shadow: 0 8px 20px rgba(94, 234, 212, 0.22);
}

.btn.ghost {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
}

.btn.danger {
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.22);
}

/* ---------- 骨架屏 / 提示 ---------- */
.skeleton-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton {
  height: 66px;
  border-radius: 16px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.05));
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}

.skeleton.short {
  height: 48px;
  width: 72%;
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 10px);
  max-width: calc(100% - 40px);
  padding: 11px 16px;
  border-radius: 12px;
  background: rgba(8, 13, 22, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  font-size: 13px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (min-width: 620px) {
  .content {
    padding-left: 24px;
    padding-right: 24px;
  }
}

@media (max-width: 340px) {
  .field-row {
    grid-template-columns: 1fr;
  }
  .content {
    padding-left: 14px;
    padding-right: 14px;
  }
}
