:root {
  --bg: #f7f6f3;
  --card: #ffffff;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #e6e3dd;
  --accent: #0a84ff;
  --accent-ink: #ffffff;
  --warn: #b26a00;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 "PingFang SC", "Microsoft YaHei UI", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 18px 40px;
}

.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.head h1 {
  font-size: 22px;
  letter-spacing: .02em;
  margin: 0;
}

.compose {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}

textarea {
  width: 100%;
  border: 0;
  resize: vertical;
  min-height: 96px;
  font: inherit;
  line-height: 1.6;
  color: var(--ink);
  background: transparent;
  outline: none;
}

textarea::placeholder { color: #a1a1a6; }

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

.hint { flex: 1; font-size: 13px; color: var(--muted); }
.hint.ok { color: #2e7d32; }
.hint.err { color: #c62828; }

button {
  font: inherit;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 8px 18px;
  cursor: pointer;
}

button:disabled { opacity: .5; cursor: default; }

.primary {
  background: var(--accent);
  color: var(--accent-ink);
  min-width: 88px;
}

.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
  padding: 6px 14px;
}

.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 24px 2px 10px;
}

.count { font-weight: 600; }
.tip { font-size: 12px; color: var(--muted); }

.list { list-style: none; margin: 0; padding: 0; }

.item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  gap: 12px;
}

.item time {
  flex: none;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
}

.item .body { flex: 1; min-width: 0; }
.item .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.item .meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  align-items: center;
}

.badge {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #eef4ff;
  color: #0a58c4;
}

.badge.done { background: #eef7ee; color: #2e7d32; }
.badge.synced { background: #fff5e6; color: var(--warn); }

.empty { text-align: center; color: var(--muted); margin-top: 40px; }

.gate {
  position: fixed;
  inset: 0;
  background: rgba(247,246,243,.92);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.gate-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  width: min(380px, 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gate-card h2 { margin: 0; font-size: 18px; }
.gate-card p { margin: 0; font-size: 13px; color: var(--muted); }
.gate-card input {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}
.gate-card input:focus { border-color: var(--accent); }
.error { color: #c62828; min-height: 18px; }

.hidden { display: none !important; }
