/* ============================================================
   微夹 · 微信信息收纳
   Mobile-first / no external assets / offline friendly
   ============================================================ */

:root {
  --blue: #4A90E2;
  --blue-deep: #357ABD;
  --blue-ink: #205E9E;
  --bg: #F3F8FE;
  --card: #FFFFFF;
  --ink: #15243C;
  --muted: #7589A4;
  --line: #E4EDF8;
  --amber: #E39A1B;
  --red: #DC4B4F;
  --teal: #189C8D;
  --violet: #6C5DD3;
  --shadow-sm: 0 2px 10px rgba(28, 72, 124, .05);
  --shadow-md: 0 16px 34px -20px rgba(28, 72, 124, .35);
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: stretch;
  background:
    radial-gradient(900px 480px at 50% -8%, #DCEBFB 0%, rgba(220, 235, 251, 0) 62%),
    #EDF3FA;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}

button, input, textarea {
  font-family: inherit;
  color: inherit;
}

button { cursor: pointer; }

::selection { background: rgba(74, 144, 226, .22); }

.sprite { display: none; }

.i {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hidden, [hidden] { display: none !important; }

/* ---------- App shell ---------- */

#app {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

#views {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.view {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}

.view.is-active {
  display: flex;
  animation: viewIn .32s cubic-bezier(.22, .9, .3, 1) both;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  flex: none;
  overflow: hidden;
  padding: calc(13px + env(safe-area-inset-top)) 18px 15px;
  color: #fff;
  background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
  border-radius: 0 0 26px 26px;
  box-shadow: 0 18px 34px -22px rgba(43, 107, 173, .75);
  z-index: 2;
}

.hero-glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(2px);
}

.hero-glow.g1 {
  width: 220px;
  height: 220px;
  right: -70px;
  top: -120px;
  background: radial-gradient(circle, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0) 68%);
}

.hero-glow.g2 {
  width: 190px;
  height: 190px;
  left: -80px;
  bottom: -130px;
  background: radial-gradient(circle, rgba(150, 210, 255, .35), rgba(150, 210, 255, 0) 70%);
}

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

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

.logo {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .26);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18);
}

.logo .i { width: 20px; height: 20px; stroke-width: 1.7; }

.brand-text h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: .4px;
}

.brand-text p {
  margin: 2px 0 0;
  font-size: 10.5px;
  letter-spacing: 1.4px;
  opacity: .82;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #5C7692;
  background: #F0F6FD;
  transition: transform .18s ease, background .18s ease;
}

.icon-btn:active { transform: scale(.94); }
.icon-btn .i { width: 19px; height: 19px; }

.icon-btn.on-hero {
  color: #fff;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .18);
}

.hero-stats {
  position: relative;
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 9px 4px;
  border-radius: 15px;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(8px);
}

.stat {
  text-align: center;
  position: relative;
}

.stat + .stat::before {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  bottom: 5px;
  width: 1px;
  background: rgba(255, 255, 255, .16);
}

.stat b {
  display: block;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.stat span {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  opacity: .8;
  letter-spacing: .2px;
}

/* ---------- Chat ---------- */

.chat-card {
  flex: 1;
  min-height: 0;
  margin: 12px 12px 6px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #FFFFFF 0%, #FBFDFF 100%);
  border: 1px solid rgba(228, 237, 248, .9);
  border-radius: var(--r-lg);
  box-shadow: 0 16px 40px -30px rgba(25, 70, 125, .5);
  overflow: hidden;
}

.chat-head {
  flex: none;
  height: 36px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  gap: 7px;
  border-bottom: 1px solid #EEF5FC;
  background: rgba(255, 255, 255, .7);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3CCB9B;
  box-shadow: 0 0 0 3px rgba(60, 203, 155, .14);
  animation: livePulse 2.4s ease-in-out infinite;
}

.chat-title {
  font-size: 12px;
  font-weight: 700;
  color: #38526E;
}

.chat-hint {
  margin-left: 0;
  padding-left: 4px;
  font-size: 10px;
  color: #93A7BD;
}

.chat-bulk {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  padding: 4px 8px;
  border: 1px solid #D8E8F9;
  border-radius: 999px;
  background: #F2F8FF;
  color: #3C7DBB;
  font-size: 10px;
  font-weight: 700;
}

.chat-bulk .i { width: 12px; height: 12px; }
.chat-bulk:active { transform: scale(.96); }

@media (max-width: 360px) {
  .chat-hint { display: none; }
}

.chat {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  scroll-behavior: smooth;
}

.chat::-webkit-scrollbar { width: 3px; }
.chat::-webkit-scrollbar-thumb { background: #D8E6F5; border-radius: 3px; }

.msg {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  animation: msgIn .3s cubic-bezier(.2, .9, .3, 1) both;
}

.msg.no-anim { animation: none; }

.avatar {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #69A8EE, #357ABD);
  box-shadow: 0 6px 12px -7px rgba(53, 122, 189, .9);
}

.avatar .i { width: 15px; height: 15px; stroke-width: 2; }

.ai-avatar { background: linear-gradient(135deg, #6FB3F2, #2E6FAD); }

.msg.user { flex-direction: row-reverse; }

.msg.user .bubble {
  max-width: 82%;
  padding: 9px 12px;
  border-radius: 14px 4px 14px 14px;
  background: linear-gradient(135deg, #4A90E2, #357ABD);
  color: #fff;
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  text-wrap: pretty;
  box-shadow: 0 10px 20px -14px rgba(53, 122, 189, .9);
}

.msg.ai .bubble {
  flex: 1;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid #E7EFFA;
  border-radius: 4px 14px 14px 14px;
  background: linear-gradient(180deg, #FFFFFF 0%, #FBFDFF 100%);
  box-shadow: 0 8px 22px -22px rgba(24, 62, 108, .6);
  font-size: 13px;
}

.ai-lead {
  margin: 0 0 9px;
  color: #5A7089;
  font-size: 12.5px;
  line-height: 1.6;
}

.ai-lead b { font-weight: 700; }

/* segmented control */

.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 3px;
  border-radius: 11px;
  background: #EFF5FC;
}

.seg button {
  border: 0;
  border-radius: 8px;
  padding: 7px 2px;
  font-size: 11.5px;
  font-weight: 600;
  color: #6B819B;
  background: transparent;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}

.seg button[aria-pressed="true"] {
  color: var(--blue-ink);
  background: #fff;
  box-shadow: 0 2px 7px rgba(28, 72, 124, .1);
}

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

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 27px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #637992;
  font-size: 11.5px;
  font-weight: 600;
  transition: all .16s ease;
}

.chip .i { width: 13px; height: 13px; }
.chip:active { transform: scale(.96); }

.chip.important[aria-pressed="true"] {
  color: #A9700E;
  border-color: #F3CE8A;
  background: #FFF6E6;
}

.chip.urgent[aria-pressed="true"] {
  color: #BE3539;
  border-color: #F3B7B7;
  background: #FDECEC;
}

.chip.custom[aria-pressed="true"] {
  color: #2E74BC;
  border-color: #B9D7F5;
  background: #EAF4FF;
}

.tag-empty {
  color: #93A7BD;
  font-size: 10.5px;
  line-height: 1.6;
}

.preview {
  margin-top: 2px;
  padding: 8px 10px;
  border: 1px dashed #DCE9F8;
  border-radius: 11px;
  background: #F8FBFF;
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 10.5px;
  color: #93A7BD;
}

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0;
  border: 0;
  background: none;
  color: #3D80C4;
  font-size: 11px;
  font-weight: 600;
}

.text-btn .i { width: 12px; height: 12px; }

.preview-text {
  margin: 5px 0 0;
  color: #23374F;
  font-size: 12.5px;
  line-height: 1.6;
  word-break: break-word;
}

.due-edit {
  margin-top: 8px;
  padding: 3px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 10px;
  background: #F3F8FD;
  color: #5E7896;
  font-size: 11.5px;
}

.due-edit > span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: none;
  color: #7B91A9;
}

.due-edit .i { width: 13px; height: 13px; }

.due-edit input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: #33506F;
  font-size: 16px;
  padding: 4px 0;
}

.due-edit input::-webkit-calendar-picker-indicator {
  opacity: .5;
  width: 15px;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.btn {
  border: 0;
  border-radius: 11px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  color: #47617D;
  background: #EFF4FB;
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}

.btn:active { transform: scale(.97); }

.btn.primary {
  flex: 1;
  color: #fff;
  background: linear-gradient(135deg, #4A90E2, #357ABD);
  box-shadow: 0 12px 22px -14px rgba(53, 122, 189, 1);
}

.btn.ghost { flex: none; background: #F2F6FB; color: #7A8FA7; }

.btn.small { padding: 7px 12px; font-size: 12px; border-radius: 9px; flex: none; }

.btn.soft {
  width: 100%;
  margin-top: 8px;
  background: #F2F7FD;
  color: #3D78B5;
}

.btn.wide { width: 100%; }

.btn.danger-text { color: #C44549; background: #FDF0F0; }

/* saved / typing / welcome */

.success-card {
  border-color: #D5EEE4 !important;
  background: linear-gradient(150deg, #F2FCF8, #FBFFFE) !important;
}

.success-title {
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 5px;
  color: #177F6E;
  font-size: 12.5px;
  font-weight: 700;
}

.success-title .i { width: 15px; height: 15px; }

.success-card .card-actions { margin-top: 8px; }

.muted-bubble {
  color: #8598AD !important;
  font-size: 12px !important;
  background: #F7FAFE !important;
  border-style: dashed !important;
}

.typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 12px 14px !important;
  width: auto !important;
  flex: none !important;
}

.typing-bubble span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9DB5CE;
  animation: typingDot 1.1s ease-in-out infinite;
}

.typing-bubble span:nth-child(2) { animation-delay: .15s; }
.typing-bubble span:nth-child(3) { animation-delay: .3s; }

.welcome {
  padding: 14px;
  border: 1px solid #E2EEFC;
  border-radius: var(--r-md);
  background:
    radial-gradient(220px 120px at 100% 0%, #EAF4FF 0%, rgba(234, 244, 255, 0) 70%),
    linear-gradient(160deg, #F5FAFF, #FFFFFF);
}

.welcome-ico {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #6EB1F0, #357ABD);
  box-shadow: 0 8px 16px -10px rgba(53, 122, 189, .9);
}

.welcome-ico .i { width: 17px; height: 17px; }

.welcome h2 {
  margin: 9px 0 4px;
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: .2px;
}

.welcome p {
  margin: 0;
  color: #71869F;
  font-size: 12px;
  line-height: 1.65;
}

.steps {
  margin: 10px 0;
  padding: 9px 10px;
  list-style: none;
  counter-reset: step;
  border-radius: 10px;
  background: rgba(255, 255, 255, .7);
  border: 1px solid #E9F2FC;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 22px;
  color: #5E7691;
  font-size: 11.5px;
  line-height: 1.9;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 700;
  color: #3E7FBF;
  background: #E7F2FD;
}

.samples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.samples > span {
  font-size: 10.5px;
  color: #9AAEC4;
}

.sample {
  border: 1px solid #D9E8FA;
  border-radius: 9px;
  background: #fff;
  color: #3377B9;
  font-size: 11px;
  padding: 6px 8px;
  text-align: left;
  line-height: 1.3;
}

.sample:active { background: #F1F7FE; }

/* ---------- Composer ---------- */

.composer {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 6px 12px calc(10px + env(safe-area-inset-bottom));
}

.composer-btn {
  flex: none;
  width: 42px;
  height: 42px;
  border: 1px solid #E0EBF8;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #5F86AA;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.composer-btn .i { width: 18px; height: 18px; }

.composer textarea {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  max-height: 118px;
  padding: 10px 13px;
  border: 1px solid #DEEAF7;
  border-radius: 15px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  font-size: 16px;
  line-height: 1.5;
  resize: none;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.composer textarea:focus {
  border-color: #AFD0F2;
  box-shadow: 0 6px 18px -12px rgba(53, 122, 189, .5);
}

.composer textarea::placeholder { color: #A7B8CA; }

.send-btn {
  flex: none;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #4A90E2, #357ABD);
  box-shadow: 0 10px 20px -10px rgba(53, 122, 189, .85);
  transition: transform .18s ease, opacity .18s ease;
}

.send-btn .i { width: 19px; height: 19px; margin-left: -1px; }
.send-btn:active { transform: scale(.94); }
.send-btn:disabled { opacity: .4; box-shadow: none; }

/* ---------- List view ---------- */

.page-head {
  flex: none;
  padding: calc(18px + env(safe-area-inset-top)) 18px 8px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.page-head h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.3px;
}

.page-head p {
  margin: 3px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

.head-badge {
  margin-top: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #E8F2FD;
  color: #4C7FAF;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .3px;
}

.tabs {
  flex: none;
  margin: 4px 14px 0;
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  border-radius: 14px;
  background: #E8F0F9;
}

.tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #667E98;
  font-size: 12px;
  font-weight: 600;
  transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}

.tab[aria-selected="true"] {
  color: #2669A9;
  background: #fff;
  box-shadow: 0 2px 8px rgba(28, 72, 124, .1);
}

.tab-count {
  min-width: 15px;
  padding: 1px 4px;
  border-radius: 999px;
  background: rgba(53, 122, 189, .1);
  color: inherit;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}

.tab[aria-selected="true"] .tab-count {
  background: #E9F2FD;
}

.filters {
  flex: none;
  display: flex;
  gap: 6px;
  padding: 10px 14px 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar { display: none; }

.filter-chip {
  flex: none;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #EAF2FB;
  color: #5D7691;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: all .18s ease;
}

.filter-chip[aria-pressed="true"] {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #4A90E2, #357ABD);
  box-shadow: 0 8px 16px -10px rgba(53, 122, 189, .9);
}

.list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 4px 14px calc(18px + env(safe-area-inset-bottom));
}

.list::-webkit-scrollbar { width: 3px; }
.list::-webkit-scrollbar-thumb { background: #D8E6F5; border-radius: 3px; }

.card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
  padding: 10px 8px 10px 13px;
  border: 1px solid #EAF2FB;
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  animation: cardIn .3s cubic-bezier(.2, .9, .3, 1) both;
}

.card.no-anim { animation: none; }

.card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--c, var(--blue));
  opacity: .85;
}

.card:nth-child(2) { animation-delay: .03s; }
.card:nth-child(3) { animation-delay: .06s; }
.card:nth-child(4) { animation-delay: .09s; }
.card:nth-child(5) { animation-delay: .12s; }

.card.type-memo { --c: var(--teal); }
.card.type-notice { --c: var(--violet); }
.card.type-todo { --c: var(--blue); }

.card.is-complete { background: #FBFDFF; }

.check {
  flex: none;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 2px solid #C9DAEB;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: transparent;
  background: #fff;
  transition: all .2s cubic-bezier(.2, .9, .3, 1.2);
}

.check .i { width: 13px; height: 13px; stroke-width: 2.6; }

.check.is-done {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #4A90E2, #357ABD);
  box-shadow: 0 6px 12px -8px rgba(53, 122, 189, .9);
}

.check:active { transform: scale(.88); }

.type-badge {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--c, var(--blue));
  background: var(--soft, #EDF4FD);
}

.type-badge .i { width: 16px; height: 16px; }

.card-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 2px 0;
  border: 0;
  background: none;
  text-align: left;
  touch-action: manipulation;
}

.card-title {
  color: var(--ink);
  font-size: 13.8px;
  font-weight: 600;
  line-height: 1.45;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-title.expanded {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
}

.card.is-expanded { align-items: flex-start; }

.card-expand {
  align-self: flex-start;
  color: #4C86C3;
  font-size: 9.5px;
  font-weight: 600;
  line-height: 1.4;
}

.card-expand::after {
  content: " ›";
  font-size: 11px;
}

.card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 6px;
  color: #8699AF;
  font-size: 10.5px;
  line-height: 1.4;
}

.card-title.done {
  color: #96A7BB;
  text-decoration: line-through;
  text-decoration-color: #C4D2E2;
}

.card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 6px;
  color: #8699AF;
  font-size: 10.5px;
  line-height: 1.4;
}

.meta-time {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-variant-numeric: tabular-nums;
}

.meta-time .i { width: 12px; height: 12px; }
.meta-time.overdue { color: var(--red); font-weight: 600; }

.pill {
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .2px;
}

.pill.amber { color: #A9700E; background: #FFF4E0; }
.pill.red { color: #C0393D; background: #FDECEC; }
.pill.blue { color: #2E74BC; background: #EAF4FF; }
.pill.done { color: #6C8AA6; background: #EDF4FB; }

.drag-handle {
  flex: none;
  width: 32px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #B9C9DB;
  touch-action: none;
  cursor: grab;
}

.drag-handle .i { width: 18px; height: 18px; }
.drag-handle:active { background: #F1F7FE; color: #4A8ACB; }

.more {
  flex: none;
  width: 22px;
  height: 34px;
  border: 0;
  padding: 0;
  background: none;
  color: #C3D3E5;
  display: grid;
  place-items: center;
}

.more .i { width: 15px; height: 15px; }

.card.dragging {
  z-index: 20;
  border-color: #B9D7F5;
  background: #fff;
  box-shadow: 0 22px 40px -16px rgba(25, 70, 130, .4);
  cursor: grabbing;
  animation: none;
  pointer-events: none;
}

.card.dragging .drag-handle { color: #3F82C6; }

body.is-dragging { user-select: none; -webkit-user-select: none; }
body.is-dragging .list { overflow-y: hidden; }

.empty {
  padding: 46px 26px;
  text-align: center;
}

.empty-art {
  width: 76px;
  height: 76px;
  margin: 0 auto 14px;
  border-radius: 26px;
  display: grid;
  place-items: center;
  color: #8DB6DF;
  background: linear-gradient(140deg, #EAF3FE, #F8FCFF);
  border: 1px solid #E1EDFA;
}

.empty-art .i { width: 30px; height: 30px; stroke-width: 1.5; }

.empty h3 {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 700;
  color: #3D556E;
}

.empty p {
  margin: 0;
  color: #8498AE;
  font-size: 12px;
  line-height: 1.7;
}

.ghost-line {
  width: 100%;
  margin-top: 8px;
  padding: 9px;
  border: 1px dashed #CDE2F7;
  border-radius: 10px;
  background: #F8FBFF;
  color: #3978B5;
  font-size: 12px;
  font-weight: 600;
}

/* ---------- Bottom nav ---------- */

.bottom-nav {
  flex: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 5px 10px calc(5px + env(safe-area-inset-bottom));
  background: rgba(252, 254, 255, .94);
  border-top: 1px solid rgba(221, 234, 248, .9);
  backdrop-filter: blur(16px);
  z-index: 30;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px 0;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: #8598AE;
  font-size: 10px;
  transition: color .18s ease, background .18s ease;
}

.nav-btn .i { width: 21px; height: 21px; transition: transform .2s ease; }

.nav-btn.is-active {
  color: #2E74BC;
  background: #EEF5FE;
}

.nav-btn.is-active .i { transform: translateY(-1px); }

/* ---------- Settings ---------- */

.scroll-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 2px 14px calc(24px + env(safe-area-inset-bottom));
}

.scroll-area::-webkit-scrollbar { width: 3px; }
.scroll-area::-webkit-scrollbar-thumb { background: #D8E6F5; border-radius: 3px; }

.panel {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid #EAF2FB;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.panel-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .3px;
  color: #28425E;
}

.badge {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.soft { color: #5E829F; background: #EFF6FE; }
.badge.progress { color: #A56E12; background: #FFF3DF; }
.badge.ok { color: #177F6E; background: #E4F8F1; }

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
}

.row + .row, .as-btn + .as-btn { border-top: 1px solid #EFF5FC; }

.row-main {
  flex: 1;
  min-width: 0;
  display: block;
  text-align: left;
}

.row-main b {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: #243B56;
}

.row-main small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.row-icon {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #4F86C6;
  background: #F1F7FE;
}

.row-icon .i { width: 16px; height: 16px; }

.as-btn {
  width: 100%;
  padding: 12px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: none;
  text-align: left;
}

.as-btn:active .row-main b { color: #2E74BC; }

.chev {
  flex: none;
  color: #C3D3E5;
  display: grid;
  place-items: center;
}

.chev .i { width: 15px; height: 15px; }

.switch {
  position: relative;
  flex: none;
  width: 46px;
  height: 28px;
}

.switch input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  z-index: 2;
  cursor: pointer;
}

.switch .track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #DCE6F2;
  transition: background .22s ease;
}

.switch .track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(20, 50, 90, .28);
  transition: transform .24s cubic-bezier(.2, .9, .3, 1.2);
}

.switch input:checked + .track {
  background: linear-gradient(135deg, #4A90E2, #357ABD);
}

.switch input:checked + .track::after { transform: translateX(18px); }

.switch input:focus-visible + .track {
  outline: 2px solid #9CC6F2;
  outline-offset: 2px;
}

.hint {
  margin: 2px 0 0;
  padding: 8px 10px;
  border-left: 2px solid #CFE4F9;
  border-radius: 0 8px 8px 0;
  background: #F7FAFF;
  color: #7C90A9;
  font-size: 10.8px;
  line-height: 1.65;
}

.service-time {
  flex: none;
  color: #357ABD;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .4px;
  font-variant-numeric: tabular-nums;
}

.service-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.service-actions .ghost-line { margin-top: 8px; }

a.ghost-line {
  display: block;
  text-align: center;
  text-decoration: none;
  line-height: 1.5;
}

.digest-preview {
  margin: 10px 0 0;
  padding: 9px 10px;
  border-radius: 9px;
  background: #F5FAFF;
  color: #5D7C9C;
  font-size: 10.8px;
  line-height: 1.7;
}

.digest-preview b { color: #2E74BC; }

#tag-type-tabs { margin: 10px 0 8px; }

.tag-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 4px 0 10px;
}

.tag-list-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid #EDF4FB;
  border-radius: 10px;
  background: #FBFDFF;
}

.tag-list-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: #35506C;
  font-size: 12.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-list-count {
  flex: none;
  padding: 2px 6px;
  border-radius: 999px;
  background: #F0F6FD;
  color: #8FA5BB;
  font-size: 9.5px;
}

.tag-list-actions {
  flex: none;
  display: flex;
  gap: 2px;
}

.tag-action {
  border: 0;
  padding: 3px 4px;
  border-radius: 5px;
  background: none;
  color: #5A86AF;
  font-size: 10.5px;
}

.tag-action.danger { color: #B86A6D; }

.tag-empty-line {
  padding: 10px 2px;
  color: #93A7BD;
  font-size: 11px;
  line-height: 1.6;
}

.tag-add {
  display: flex;
  gap: 6px;
}

.tag-add input {
  flex: 1;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #DEEAF7;
  border-radius: 9px;
  background: #FBFDFF;
  font-size: 16px;
  outline: none;
}

.tag-add input:focus { border-color: #A9CCF1; }

.tag-add button {
  flex: none;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: #E8F2FE;
  color: #2E74BC;
  font-size: 12px;
  font-weight: 700;
}

.dialog-input {
  width: 100%;
  margin-bottom: 14px;
  padding: 11px 12px;
  border: 1px solid #DEEAF7;
  border-radius: 11px;
  background: #FBFDFF;
  font-size: 16px;
  outline: none;
}

.dialog-input:focus { border-color: #A9CCF1; }

button, .card-main, .tab, .filter-chip, .nav-btn, .chip {
  touch-action: manipulation;
}

.cloud-panel {
  background:
    radial-gradient(240px 120px at 100% 0%, #EAF4FF 0%, rgba(234, 244, 255, 0) 70%),
    #fff;
}

.cloud-panel .panel-head h2 {
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-text {
  margin: 8px 0 0;
  color: #627A94;
  font-size: 11.5px;
  line-height: 1.7;
}

.panel-text.muted { color: #92A5BA; }

/* ---------- Sheet ---------- */

.sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 30, 51, .45);
  backdrop-filter: blur(3px);
  animation: fadeIn .2s ease both;
}

.sheet {
  position: relative;
  width: min(480px, 100%);
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
  border-radius: 24px 24px 0 0;
  background: #fff;
  box-shadow: 0 -24px 60px -24px rgba(9, 30, 60, .5);
  animation: slideUp .32s cubic-bezier(.2, .9, .3, 1) both;
}

.sheet-grab {
  width: 38px;
  height: 4px;
  margin: 8px auto 2px;
  border-radius: 4px;
  background: #E2EBF5;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 16px 6px;
}

.sheet-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}

.sheet-body {
  overflow-y: auto;
  padding: 4px 16px 18px;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field > span {
  display: block;
  margin-bottom: 6px;
  color: #6C8199;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
}

.field textarea,
.field input[type="datetime-local"] {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #DEEAF7;
  border-radius: 12px;
  background: #FBFDFF;
  font-size: 16px;
  line-height: 1.55;
  outline: none;
  resize: vertical;
}

.field textarea:focus,
.field input:focus { border-color: #A9CCF1; background: #fff; }

.raw-box {
  margin: 2px 0 12px;
  padding: 9px 11px;
  border: 1px dashed #DCE9F8;
  border-radius: 11px;
  background: #F8FBFF;
}

.raw-box summary {
  color: #5B81A6;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.raw-box p {
  margin: 8px 0 0;
  color: #5E748C;
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.sheet-meta {
  margin: 0 0 12px;
  color: #9AADC2;
  font-size: 10.5px;
}

.sheet-actions {
  display: flex;
  gap: 8px;
}

.sheet-actions .btn.primary { flex: 1; }

/* 批量导入 */

.bulk-sheet { max-height: 92dvh; }

.bulk-body {
  padding: 4px 16px 18px;
  overflow-y: auto;
}

.bulk-tip {
  margin: 0 0 10px;
  color: #71869F;
  font-size: 11.5px;
  line-height: 1.7;
}

.bulk-input {
  width: 100%;
  min-height: 180px;
  padding: 11px 12px;
  border: 1px solid #DEEAF7;
  border-radius: 12px;
  background: #FBFDFF;
  font-size: 16px;
  line-height: 1.6;
  outline: none;
  resize: vertical;
}

.bulk-input:focus { border-color: #A9CCF1; background: #fff; }

.bulk-toolbar {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.bulk-toolbar .btn { flex: 1; }
.bulk-toolbar .btn.primary { flex: 1.4; }

.bulk-error {
  min-height: 17px;
  margin: 7px 0 0;
  color: #C44549;
  font-size: 10.5px;
  line-height: 1.6;
}

.bulk-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 9px 10px;
  margin-bottom: 6px;
  border-radius: 10px;
  background: #F4F9FF;
  color: #5D7C9C;
  font-size: 11px;
}

.bulk-summary b { color: #2E74BC; }

.bulk-list {
  max-height: 48dvh;
  margin: 6px 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-top: 1px solid #EEF5FC;
}

.bulk-row {
  display: flex;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid #EFF5FC;
}

.bulk-check {
  flex: none;
  width: 19px;
  height: 19px;
  margin-top: 7px;
  accent-color: #4A90E2;
}

.bulk-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bulk-title-input {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid #E3EEFA;
  border-radius: 8px;
  background: #FBFDFF;
  color: #2B425A;
  font-size: 16px;
  line-height: 1.45;
  outline: none;
}

.bulk-title-input:focus { border-color: #A9CCF1; background: #fff; }

.bulk-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.bulk-select {
  padding: 4px 6px;
  border: 1px solid #E3EEFA;
  border-radius: 7px;
  background: #fff;
  color: #4E6A86;
  font-size: 16px;
  outline: none;
}

.bulk-date {
  color: #8FA5BB;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.bulk-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.bulk-actions .btn {
  flex: 1;
  padding: 10px 8px;
  font-size: 12px;
}

.bulk-actions .btn.primary { flex: 1.4; }

/* ---------- Dialog ---------- */

.dialog-wrap {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 30, 51, .45);
  backdrop-filter: blur(3px);
  animation: fadeIn .18s ease both;
}

.dialog-card {
  position: relative;
  width: min(330px, 100%);
  padding: 20px 18px 16px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 30px 70px -24px rgba(9, 30, 60, .55);
  animation: popIn .24s cubic-bezier(.2, .9, .3, 1.2) both;
}

.dialog-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
}

.dialog-card p {
  margin: 0 0 16px;
  color: #6B8199;
  font-size: 12.5px;
  line-height: 1.7;
  text-align: center;
  white-space: pre-wrap;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.dialog-actions .btn { width: 100%; padding: 11px; }

.dialog-actions .btn.primary { flex: none; }

.dialog-actions .btn.danger {
  color: #fff;
  background: linear-gradient(135deg, #E46468, #CF3B40);
  box-shadow: 0 10px 20px -14px rgba(207, 59, 64, .9);
}

.dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
}

/* ---------- Toast ---------- */

.toast-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(128px + env(safe-area-inset-bottom));
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  padding: 0 18px;
}

.toast {
  max-width: 420px;
  padding: 9px 14px;
  border-radius: 12px;
  background: rgba(21, 42, 68, .92);
  color: #fff;
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
  box-shadow: 0 16px 34px -18px rgba(9, 30, 60, .8);
  animation: toastIn .24s ease both;
  backdrop-filter: blur(8px);
}

.toast.remind {
  background: linear-gradient(135deg, rgba(45, 105, 170, .97), rgba(29, 76, 128, .97));
  border: 1px solid rgba(255, 255, 255, .16);
  font-size: 12.5px;
}

.toast.out { animation: toastOut .2s ease both; }

.noscript {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 14px 18px;
  border-radius: 12px;
  background: #fff;
  color: #334;
  font-size: 13px;
  box-shadow: 0 20px 50px -20px rgba(9, 30, 60, .5);
}

/* ---------- Animations ---------- */

@keyframes viewIn {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: none; }
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(7px) scale(.995); }
  to { opacity: 1; transform: none; }
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

@keyframes slideUp {
  from { transform: translateY(28px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popIn {
  from { opacity: 0; transform: scale(.94); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: none; }
}

@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(4px); }
}

@keyframes typingDot {
  0%, 60%, 100% { opacity: .35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(60, 203, 155, .14); }
  50% { box-shadow: 0 0 0 5px rgba(60, 203, 155, .05); }
}

/* ---------- Desktop / tablet ---------- */

@media (min-width: 560px) {
  body {
    align-items: center;
    padding: 22px 0;
  }

  #app {
    height: min(900px, calc(100dvh - 44px));
    border-radius: 30px;
    box-shadow: 0 40px 90px -40px rgba(21, 58, 102, .45);
    border: 1px solid rgba(255, 255, 255, .8);
  }

  .toast-wrap { bottom: calc(132px + env(safe-area-inset-bottom)); }
}

@media (max-width: 360px) {
  .hero { padding-left: 14px; padding-right: 14px; }
  .hero-stats .stat b { font-size: 17px; }
  .brand-text h1 { font-size: 18px; }
  .chat-card { margin-left: 9px; margin-right: 9px; }
  .composer { padding-left: 9px; padding-right: 9px; }
  .card-title { font-size: 13.2px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
