:root {
  /* Design v2 (2026-10): light and airy like Muse, people-first like Dex. Brand blue comes from the app icon. */
  --bg: #f4f5f7;
  --card: #ffffff;
  --card-2: #f1f2f5;
  --card-3: #e9ebef;
  --text: #15171c;
  --text-2: #5b616d;
  --text-3: #8a909b;
  --sep: rgba(17, 24, 39, 0.08);
  --accent: #1769e0;
  --accent-ink: #0b4fb3;
  --accent-soft: rgba(23, 105, 224, 0.10);
  --green: #1f8a4c;
  --green-soft: rgba(31, 138, 76, 0.12);
  --orange: #b85a00;
  --orange-soft: rgba(230, 126, 0, 0.13);
  --red: #c8102e;
  --red-soft: rgba(200, 16, 46, 0.10);
  --purple: #7a3fb0;
  --purple-soft: rgba(122, 63, 176, 0.12);
  --out-bubble: #e4eefc;
  --in-bubble: #f1f2f5;
  --tabbar-bg: rgba(255, 255, 255, 0.86);
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.04), 0 4px 14px rgba(17, 24, 39, 0.04);
  --radius: 18px;
  --radius-sm: 12px;
  --tabbar-h: 54px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0d10;
    --card: #17191e;
    --card-2: #20232a;
    --card-3: #2a2e36;
    --text: #f2f3f5;
    --text-2: #a5abb6;
    --text-3: #7d838e;
    --sep: rgba(255, 255, 255, 0.08);
    --accent: #4b8ff5;
    --accent-ink: #8db8ff;
    --accent-soft: rgba(75, 143, 245, 0.16);
    --green: #3ccf7a;
    --green-soft: rgba(60, 207, 122, 0.15);
    --orange: #ffa53d;
    --orange-soft: rgba(255, 165, 61, 0.15);
    --red: #ff5a6a;
    --red-soft: rgba(255, 90, 106, 0.16);
    --purple: #c08cf5;
    --purple-soft: rgba(192, 140, 245, 0.16);
    --out-bubble: #173257;
    --in-bubble: #20232a;
    --tabbar-bg: rgba(18, 19, 23, 0.86);
    --shadow: none;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Helvetica Neue", sans-serif;
  letter-spacing: 0.01em;
  font-size: 16px;
  line-height: 1.4;
  overflow-x: clip;  /* not hidden: iOS then mis-places sticky headers (the people search jumped mid-screen) */
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: env(safe-area-inset-top) calc(12px + env(safe-area-inset-right)) 0 calc(12px + env(safe-area-inset-left));
  background: var(--tabbar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--sep);
}
.topbar-title {
  flex: 1;
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 44px;
}
.topbar-back, .topbar-spacer {
  flex: 0 0 72px;
  min-height: 44px;
}
.topbar-back {
  border: 0;
  background: none;
  color: var(--accent);
  text-align: left;
  padding: 0;
  font-size: 17px;
  cursor: pointer;
}

/* ---------- main view ---------- */
.view {
  padding: 12px calc(16px + env(safe-area-inset-right)) calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
  max-width: 720px;
  margin: 0 auto;
}

.loading, .empty {
  color: var(--text-3);
  text-align: center;
  padding: 32px 8px;
  font-size: 15px;
}
.empty.small { padding: 10px 4px; text-align: left; font-size: 14px; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: flex;
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: var(--tabbar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--sep);
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: var(--tabbar-h);
  color: var(--text-3);
  font-size: 10px;
  font-weight: 500;
  gap: 2px;
}
.tab svg { width: 26px; height: 26px; }
.tab.active { color: var(--accent); }

/* ---------- metrics ---------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
.metric {
  background: var(--card);
  border-radius: var(--radius);
  padding: 10px 10px 8px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.metric-value { font-size: 24px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.metric-label { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--card);
  color: var(--text-2);
  font-size: 12px;
  line-height: 20px;
  white-space: nowrap;
}
.chip b { color: var(--text); font-weight: 600; }
.meta-line { font-size: 12px; color: var(--text-3); margin: 4px 2px 0; }

/* ---------- sections ---------- */
.section { margin-top: 22px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}
.section-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.count {
  display: inline-block;
  min-width: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 22px;
  text-align: center;
}
.count.zero { background: var(--card-2); color: var(--text-3); }
.chev { color: var(--text-3); font-size: 18px; transition: transform .2s; }
.section.collapsed .chev { transform: rotate(-90deg); }
.section.collapsed .section-body { display: none; }
.section-note { font-size: 13px; color: var(--text-2); margin: 0 4px 8px; }

/* ---------- cards & lists ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  min-width: 0;
  overflow-wrap: anywhere;
}
.card-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-bottom: 6px;
}
.card-sub { font-size: 13px; color: var(--text-2); }
.card-title { font-weight: 600; }
.body-text {
  white-space: pre-wrap;
  font-size: 15px;
  margin: 6px 0;
}
.card:not(.open) .body-text.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.quote {
  border-left: 3px solid var(--sep);
  padding-left: 10px;
  color: var(--text-2);
}
.kv { font-size: 13px; color: var(--text-2); margin: 4px 0; }
.kv strong { color: var(--text); font-weight: 600; }
.warn-list { margin: 6px 0 2px; padding-left: 18px; color: var(--red); font-size: 14px; }
.notice {
  font-size: 13px;
  color: var(--orange);
  background: var(--orange-soft);
  border-radius: 8px;
  padding: 6px 10px;
  margin: 0 0 10px;
}
.sources { margin: 6px 0 0; padding: 0; list-style: none; }
.sources li { font-size: 13px; margin: 6px 0; color: var(--text-2); }
.sources a { word-break: break-all; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.name-link {
  color: var(--text);
  font-weight: 600;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  min-height: 32px;
}
.name-link::after { content: "›"; color: var(--text-3); margin-left: 4px; font-weight: 400; }

.list {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 14px;
  color: var(--text);
  position: relative;
}
.row + .row::before {
  content: "";
  position: absolute;
  top: 0; right: 0; left: 14px;
  border-top: 0.5px solid var(--sep);
}
.row:active { background: var(--card-2); }
.row-main { flex: 1; min-width: 0; }
.row-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-sub {
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-side { text-align: right; font-size: 12px; color: var(--text-3); flex: 0 0 auto; }
.row-side .big { font-size: 13px; color: var(--text-2); }
.row-chev { color: var(--text-3); font-size: 20px; flex: 0 0 auto; }
.row .badges { display: flex; gap: 4px; margin-top: 3px; flex-wrap: wrap; }

.avatar {
  flex: 0 0 40px;
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  color: #fff;
  background: #8e8e93;
}
.avatar.lg { flex-basis: 64px; width: 64px; height: 64px; font-size: 26px; }

/* ---------- badges ---------- */
.badge {
  display: inline-block;
  padding: 0 6px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  background: var(--card-2);
  color: var(--text-2);
  white-space: nowrap;
}
.badge.wechat { background: var(--green-soft); color: var(--green); }
.badge.email { background: var(--accent-soft); color: var(--accent); }
.badge.linkedin { background: var(--accent-soft); color: var(--accent); }
.badge.x { background: var(--card-2); color: var(--text); }
.badge.phone, .badge.sms { background: var(--purple-soft); color: var(--purple); }
.badge.in_person { background: var(--orange-soft); color: var(--orange); }
.badge.warn { background: var(--red-soft); color: var(--red); }
.badge.ok { background: var(--green-soft); color: var(--green); }
.badge.muted { background: transparent; color: var(--text-3); border: 0.5px solid var(--sep); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn.block { display: flex; width: 100%; }
.btn:disabled { opacity: .5; }
.btn:active { opacity: .7; }

/* ---------- search ---------- */
.search {
  position: sticky;
  top: calc(44px + env(safe-area-inset-top));
  z-index: 10;
  margin: -12px -16px 10px;
  padding: 8px 16px;
  background: var(--bg);
}
.search input {
  width: 100%;
  min-height: 40px;
  padding: 0 12px 0 34px;
  border: 0;
  border-radius: 10px;
  background: var(--card) no-repeat 10px center / 16px 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='5' fill='none' stroke='%238e8e93' stroke-width='1.8'/%3E%3Cpath d='M11 11l3.5 3.5' stroke='%238e8e93' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  font-size: 16px; /* >=16px prevents iOS zoom */
  -webkit-appearance: none;
  appearance: none;
}
.search input:focus { outline: 2px solid var(--accent-soft); }
.list-footer { text-align: center; color: var(--text-3); font-size: 13px; padding: 14px 0; }

/* ---------- person ---------- */
.person-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 4px 0 12px;
}
.person-head h2 { margin: 0; font-size: 24px; font-weight: 700; overflow-wrap: anywhere; }
.person-head .card-sub { margin-top: 2px; }
.identities { padding: 0; margin: 0; list-style: none; }
.identities li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 15px;
  overflow-wrap: anywhere;
}
.identities li + li { border-top: 0.5px solid var(--sep); }
.identities .ident-val { flex: 1; min-width: 0; }

.sub-h {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  margin: 22px 4px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.note-main { flex: 1; min-width: 0; }
.note.done .note-text { text-decoration: line-through; color: var(--text-3); }
.note-text { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- timeline ---------- */
.tl-date {
  position: sticky;
  top: calc(44px + env(safe-area-inset-top));
  z-index: 5;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  padding: 6px 0;
  margin: 4px 0;
  background: var(--bg);
}
.tl-item {
  display: flex;
  flex-direction: column;
  margin: 6px 0 10px;
  max-width: 100%;
}
.tl-item.inbound { align-items: flex-start; }
.tl-item.outbound { align-items: flex-end; }
.tl-item.none { align-items: center; }
.bubble {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 16px;
  background: var(--in-bubble);
  box-shadow: var(--shadow);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 15px;
}
.tl-item.inbound .bubble { border-bottom-left-radius: 5px; }
.tl-item.outbound .bubble { background: var(--out-bubble); border-bottom-right-radius: 5px; }
.tl-item.none .bubble { background: var(--card-2); max-width: 92%; text-align: left; }
.tl-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--text-3);
  margin: 3px 6px 0;
}

/* ---------- forms / sheet ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade .2s ease;
}
.sheet {
  width: 100%;
  max-width: 720px;
  max-height: 92vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
  border-radius: 14px 14px 0 0;
  padding: 8px calc(16px + env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
  animation: up .25s ease;
}
.sheet-grip { width: 36px; height: 5px; border-radius: 3px; background: var(--sep); margin: 0 auto 6px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.sheet-head h3 { margin: 0; font-size: 17px; }
.link-btn {
  border: 0; background: none; color: var(--accent);
  min-height: 44px; min-width: 44px; padding: 0 4px; font-size: 17px; cursor: pointer;
}
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.form-group {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 14px;
}
.field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 14px;
  position: relative;
}
.field + .field::before {
  content: ""; position: absolute; top: 0; left: 14px; right: 0;
  border-top: 0.5px solid var(--sep);
}
.field > span { flex: 0 0 64px; color: var(--text); font-size: 15px; }
.field select, .field input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  border: 0;
  background: transparent;
  font-size: 16px;
  text-align: right;
  color: var(--text-2);
  -webkit-appearance: none;
  appearance: none;
}
.field select { direction: rtl; }
.field select option { direction: ltr; }
.field.textarea { align-items: stretch; padding: 10px 14px; }
.field textarea {
  flex: 1;
  width: 100%;
  min-height: 110px;
  border: 0;
  background: transparent;
  font-size: 16px;
  resize: vertical;
}
.field textarea:focus, .field input:focus, .field select:focus { outline: none; }
.seg {
  display: flex;
  flex: 1;
  background: var(--card-2);
  border-radius: 9px;
  padding: 2px;
  margin: 6px 0;
}
.seg label { flex: 1; position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label span {
  display: flex; align-items: center; justify-content: center;
  min-height: 34px;
  border-radius: 7px;
  font-size: 14px;
  color: var(--text-2);
  cursor: pointer;
}
.seg input:checked + span { background: var(--card); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* ---------- toast & overlays ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 80;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(30, 30, 32, 0.94);
  color: #fff;
  font-size: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  overflow-wrap: anywhere;
}
.toast.error { background: rgba(200, 30, 30, 0.95); }

.blocker {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: calc(24px + env(safe-area-inset-top)) 28px calc(24px + env(safe-area-inset-bottom));
}
.blocker h2 { margin: 12px 0 8px; font-size: 22px; }
.blocker p { color: var(--text-2); margin: 0 0 16px; max-width: 340px; }
.blocker code {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 14px;
  background: var(--card);
  padding: 2px 6px;
  border-radius: 6px;
  color: var(--text);
}
.blocker .lock { font-size: 44px; }
.pair-form { width: 100%; max-width: 320px; }
.pair-input {
  width: 100%;
  min-height: 52px;
  margin-bottom: 10px;
  border: 1px solid var(--sep);
  border-radius: 12px;
  background: var(--card);
  text-align: center;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 24px;
  letter-spacing: 6px;
  text-transform: uppercase;
}
.pair-input::placeholder { letter-spacing: normal; font-family: -apple-system, BlinkMacSystemFont, sans-serif; font-size: 17px; color: var(--text-3); }
.blocker code { white-space: nowrap; }
.pair-input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.blocker .pair-error { color: var(--red); font-size: 14px; margin: 0 auto 10px; }
.blocker { overflow-y: auto; justify-content: safe center; }
.invite-input { min-height: 44px; font-size: 17px; letter-spacing: 2px; }
.blocker .blocker-sub { margin: 28px 0 6px; font-size: 15px; font-weight: 600; color: var(--text-2); }
.welcome-step { margin: 18px 4px 6px; font-size: 15px; font-weight: 600; color: var(--text-2); }
.row.card { padding: 8px 14px; margin-bottom: 8px; }
.row.card::before { display: none; }
.mock-banner {
  background: var(--orange-soft);
  color: var(--orange);
  font-size: 12px;
  text-align: center;
  padding: 4px;
  border-radius: 8px;
  margin-bottom: 8px;
}

/* Collapsed draft cards (Today page) */
.card:not(.open) .more { display: none; }
.link-btn { margin-top: 8px; background: transparent; color: var(--accent, #0a84ff); padding-left: 0; }

/* Chat */
.chat-list { display: flex; flex-direction: column; gap: 8px; padding-bottom: 140px; }
.chat-hint { color: var(--text-2); font-size: 14px; padding: 8px 4px; }
.chip { align-self: flex-start; border: 1px solid var(--sep); background: var(--card, transparent); color: var(--accent);
  border-radius: 16px; padding: 8px 14px; font-size: 15px; min-height: 36px; }
.chat-bubble { max-width: 85%; padding: 10px 13px; border-radius: 18px; white-space: pre-wrap; word-break: break-word; font-size: 16px; line-height: 1.4; }
.chat-bubble.mine { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.chat-bubble.theirs { align-self: flex-start; background: var(--card, #e9e9eb); border-bottom-left-radius: 6px; }
.chat-bubble.pending { color: var(--text-2); }
.approve { align-self: flex-start; }
.chat-bar { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); display: flex; gap: 8px;
  padding: 8px 16px; background: var(--bg); border-top: 1px solid var(--sep); }
.chat-input { flex: 1; min-height: 40px; max-height: 120px; resize: none; font-size: 16px; padding: 9px 12px; border-radius: 20px;
  border: 1px solid var(--sep); background: var(--card, #fff); color: inherit; font-family: inherit; }
.chat-send { flex: none; }

/* Connections */
.status-list { list-style: none; margin: 8px 0 0; padding: 0; }
.status-list li { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--sep); }
.status-list .dot { flex: none; width: 22px; height: 22px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff; background: #34c759; }
.status-list li.bad .dot { background: #ff9f0a; }
.fix { color: var(--accent); font-size: 14px; margin-top: 2px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--sep); }
.row-between input { flex: 1; min-width: 0; font-size: 16px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--sep); background: var(--card-2); color: inherit; }
.card select, .card input[type=time], .card .field input[type=text] { font-size: 16px; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--sep); background: var(--card-2); color: inherit; max-width: 60%; }
.steps { margin: 6px 0; padding-left: 20px; font-size: 14px; color: var(--text-2); }
.steps li { margin: 4px 0; }
.code-box { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; padding: 10px; border-radius: 10px; background: var(--card-2); margin-top: 6px; user-select: all; }
.audit { list-style: none; margin: 6px 0 0; padding: 0; font-size: 14px; }
.audit li { padding: 6px 0; border-top: 1px solid var(--sep); }

.chat-bar { flex-wrap: wrap; }
.chat-photos { flex-basis: 100%; font-size: 13px; color: var(--accent); }
.chat-photo { flex: none; min-width: 44px; padding: 0 10px; }

.danger-zone { display: flex; gap: 12px; margin: 4px 0 12px; }
.link-btn.danger { color: #ff3b30; }

.link-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.link-row a { text-decoration: none; display: inline-flex; align-items: center; }
.goals-card .goal { padding: 6px 0; border-top: 1px solid var(--sep); }
.goals-card .goal .row-between { border-top: 0; padding: 2px 0; }

.row-between > .btn { flex: none; white-space: nowrap; }

/* Today: the agent speaks first */
.agent-says { display: flex; flex-direction: column; gap: 8px; }
.say-item { border-bottom: 1px solid rgba(127,127,127,.15); padding-bottom: 6px; }
.say-item:last-child { border-bottom: 0; }
.say-line { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 6px 0; color: inherit; font: inherit; line-height: 1.5; cursor: pointer; }
.say-line::after { content: " ›"; opacity: .5; }
.ask-row { display: flex; gap: 8px; margin: 10px 0 16px; }
.ask-row .chat-input { flex: 1; min-width: 0; }
.stats { margin: 16px 0; }
.stats summary { cursor: pointer; opacity: .7; padding: 6px 0; }

/* 有用 / 没用 under each suggestion; a rated suggestion is greyed out */
.fb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.fb-btn { min-height: 30px; padding: 0 10px; font-size: 13px; }
.fb-why { display: flex; gap: 8px; flex-basis: 100%; }
.fb-why .chat-input { flex: 1; min-width: 0; }
.fb-done > :not(.fb) { opacity: .45; }
.week-card .metrics { margin: 8px 0 4px; }
.week-card .metric { box-shadow: none; background: var(--bg, transparent); }

/* ================================================================ Design v2 components */
.ico { flex: none; display: block; }

/* Today: the assistant introduces the day */
.hero { padding: 6px 2px 14px; }
.hero-agent { display: flex; align-items: center; gap: 10px; }
.hero-mark { width: 36px; height: 36px; border-radius: 11px; box-shadow: 0 1px 3px rgba(17, 24, 39, .12); }
.hero-name { font-size: 14px; font-weight: 600; line-height: 1.2; }
.hero-status { font-size: 12.5px; color: var(--text-2); line-height: 1.3; }
.hero-greeting { margin: 16px 0 0; font-size: 30px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; }
.hero-date { margin-top: 4px; font-size: 14px; color: var(--text-3); }

.stats-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.stat {
  border: 0; background: var(--card); border-radius: 14px; padding: 10px 4px 9px; box-shadow: var(--shadow);
  cursor: pointer; text-align: center; min-width: 0;
}
.stat-n { font-size: 22px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-l { font-size: 11.5px; color: var(--text-2); margin-top: 3px; white-space: nowrap; }
.stat.zero .stat-n { color: var(--text-3); }
.stat:active { transform: scale(.97); }

.ideas { display: flex; flex-direction: column; gap: 10px; }
.idea { background: var(--card); border-radius: var(--radius); padding: 14px 14px 10px; box-shadow: var(--shadow); }
.idea.calm { color: var(--text-2); font-size: 15px; padding-bottom: 14px; }
.idea.skeleton { height: 92px; background: linear-gradient(90deg, var(--card) 25%, var(--card-2) 50%, var(--card) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.idea.fb-done { opacity: .55; }
.idea-top { display: flex; gap: 12px; align-items: flex-start; }
.idea-icon { flex: none; width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.idea-text { font-size: 15.5px; line-height: 1.5; padding-top: 7px; min-width: 0; overflow-wrap: anywhere; }
.idea-actions { display: flex; align-items: center; gap: 8px; margin: 10px 0 0 50px; flex-wrap: wrap; }
.tint-blue { background: var(--accent-soft); color: var(--accent); }
.tint-red { background: var(--red-soft); color: var(--red); }
.tint-violet { background: var(--purple-soft); color: var(--purple); }
.tint-amber { background: var(--orange-soft); color: var(--orange); }
.tint-pink { background: rgba(219, 39, 119, .10); color: #c0266d; }
.tint-green { background: var(--green-soft); color: var(--green); }
.tint-gray { background: var(--card-2); color: var(--text-2); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 999px;
  border: 0.5px solid var(--sep); background: var(--card-2); color: var(--text); font-size: 14px; font-weight: 600; cursor: pointer;
}
.pill.primary { background: var(--accent); border-color: transparent; color: #fff; }
.pill:active { transform: scale(.97); }

/* 有用 / 没用: quiet until used */
.fb { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.fb .kv { margin: 0; }
.fb-btn {
  display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 8px; border: 0; border-radius: 999px;
  background: transparent; color: var(--text-3); font-size: 12.5px; cursor: pointer;
}
.fb-btn:hover, .fb-btn:active { background: var(--card-2); color: var(--text); }
.card .fb { margin-top: 8px; justify-content: flex-end; }
.fb-why { display: flex; gap: 6px; width: 100%; margin-top: 6px; }

/* The composer pill (Today and Chat) */
.composer {
  display: flex; align-items: center; gap: 6px; margin: 14px 0 4px; padding: 5px 5px 5px 16px;
  background: var(--card); border: 0.5px solid var(--sep); border-radius: 999px; box-shadow: var(--shadow);
}
.composer-input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 16px; height: 36px; outline: none; }
.composer-send {
  flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}

/* A person inside a card */
.person-line { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; min-width: 0; }
.person-line-main { min-width: 0; flex: 1; }
.person-line .name-link { min-height: 0; font-size: 15.5px; }
.person-line-meta { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.avatar.sm { flex-basis: 34px; width: 34px; height: 34px; font-size: 14px; }
body.home .topbar { display: none; }
body.home .view { padding-top: calc(14px + env(safe-area-inset-top)); }

/* Sections under the cards: quieter headers, so the suggestions above stay the first thing read */
.section { margin-top: 26px; }
.section-head { min-height: 36px; padding: 0 2px; }
.section-head h2 { font-size: 17px; font-weight: 650; gap: 6px; }
.count { min-width: 20px; padding: 0 6px; background: var(--card-3); color: var(--text-2); font-size: 12px; line-height: 20px; }
.count.zero { background: transparent; color: var(--text-3); }
.section-note { font-size: 12.5px; color: var(--text-3); }
.card { padding: 14px 16px; margin-bottom: 10px; }
.btn { border-radius: 999px; font-weight: 600; }
.btn.small { min-height: 34px; padding: 0 14px; }
.badge { border-radius: 999px; padding: 0 8px; line-height: 19px; }
.tabbar { border-top-color: var(--sep); }
.tab { font-size: 10.5px; }
.tab.active svg { stroke-width: 2.1; }

/* Chat: the agent in soft grey, the user in a blue tint (Muse), the composer as one pill */
.chat-bubble { font-size: 15.5px; line-height: 1.5; padding: 10px 14px; border-radius: 20px; }
.chat-bubble.mine { background: var(--out-bubble); color: var(--text); border-bottom-right-radius: 6px; }
.chat-bubble.theirs { background: var(--card); box-shadow: var(--shadow); border-bottom-left-radius: 6px; }
.chat-bar { background: linear-gradient(to top, var(--bg) 70%, transparent); border-top: 0; padding-top: 14px; }
.chat-composer { flex: 1; margin: 0; padding: 4px 4px 4px 4px; align-items: flex-end; }
.chat-composer .chat-input { border: 0; background: transparent; padding: 8px 6px; min-height: 36px; border-radius: 0; box-shadow: none; outline: none; }
.chat-photo { width: 36px; height: 36px; min-width: 0; padding: 0; border: 0; border-radius: 50%; background: var(--card-2);
  color: var(--text-2); display: flex; align-items: center; justify-content: center; cursor: pointer; }

/* The approval card: who, exactly what, and two clear buttons */
.approve-card { align-self: stretch; background: var(--card); border-radius: var(--radius); padding: 14px 16px 12px;
  box-shadow: var(--shadow); border: 0.5px solid var(--sep); }
.approve-card.expired { color: var(--text-3); font-size: 14px; }
.approve-card.declined { opacity: .6; }
.approve-head { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); font-weight: 600; }
.approve-to { display: flex; align-items: center; gap: 10px; margin: 12px 0 10px; }
.approve-name { font-weight: 600; font-size: 15.5px; }
.approve-sub { font-size: 12.5px; color: var(--text-2); }
.approve-subject { font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.approve-body { background: var(--card-2); border-radius: 14px; padding: 11px 13px; font-size: 15px; line-height: 1.55; white-space: pre-wrap; }
.approve-note { font-size: 11.5px; color: var(--text-3); margin: 8px 2px 0; }
.approve-actions { display: grid; grid-template-columns: 1fr 1.6fr; gap: 8px; margin-top: 12px; }
.approve-actions .pill { justify-content: center; height: 42px; font-size: 15px; }
.approve-done { grid-column: 1 / -1; text-align: center; font-size: 14px; color: var(--text-2); padding: 8px 0 2px; }
.chip { cursor: pointer; border: 0.5px solid var(--sep); padding: 6px 12px; font-size: 14px; color: var(--text); }
.chat-composer .chat-input { overflow-y: auto; scrollbar-width: none; }
.chat-composer .chat-input::-webkit-scrollbar { display: none; }
.chat-agent { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0 14px; }
.chat-agent .hero-mark { width: 40px; height: 40px; border-radius: 13px; margin-bottom: 4px; }

/* Person: who they are, how long since you talked, and one tap to reach them (Dex) */
.person-hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8px 0 6px; }
.person-hero .avatar.lg { width: 76px; height: 76px; flex-basis: 76px; font-size: 30px; }
.person-name { margin: 10px 0 6px; font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.person-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.pchip { font-size: 12.5px; color: var(--text-2); background: var(--card); border: 0.5px solid var(--sep); border-radius: 999px; padding: 3px 10px; }
.reach-row { display: flex; justify-content: center; gap: 14px; margin: 16px 0 6px; flex-wrap: wrap; }
.reach { display: flex; flex-direction: column; align-items: center; gap: 5px; color: var(--accent); min-width: 54px; }
.reach-ico { width: 46px; height: 46px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center; }
.reach-l { font-size: 11.5px; color: var(--text-2); }
.reach:active .reach-ico { transform: scale(.94); }
.sub-h { font-size: 17px; font-weight: 650; margin: 24px 2px 10px; }
.tl-date { font-size: 12px; color: var(--text-3); margin: 14px 2px 6px; font-weight: 600; }

/* Voice input: the mic turns red while listening; a line above the composer says what is happening */
.composer-mic { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--text-2);
  display: flex; align-items: center; justify-content: center; cursor: pointer; }
.composer-mic.rec { background: var(--red); color: #fff; animation: pulse 1.2s ease-in-out infinite; }
.composer-mic.busy { opacity: .5; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(200, 16, 46, .35); } 50% { box-shadow: 0 0 0 7px rgba(200, 16, 46, 0); } }
.chat-voice-note { flex-basis: 100%; text-align: center; font-size: 13px; color: var(--red); font-weight: 600; padding-bottom: 6px; }
/* ---------- first run (welcome page) ---------- */
.onboard .card-head { justify-content: space-between; }
.onboard-pct { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.onboard-bar { height: 8px; margin: 10px 0 6px; border-radius: 999px; background: var(--card-3); overflow: hidden; }
.onboard-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width 0.6s ease; }
.onboard-bar.done span { background: var(--green); }
.onboard-bar.stopped span { background: var(--orange); }
.onboard-counts { display: flex; gap: 8px; list-style: none; margin: 10px 0; padding: 0; }
.onboard-counts li { flex: 1; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--accent-soft); font-size: 13px; color: var(--text-2); }
.onboard-counts strong { display: block; font-size: 20px; color: var(--text); }

/* Draft versions: press and hold the text, slide onto a version, let go */
.approve-card { position: relative; }
.approve-body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none; cursor: grab; }
.approve-card.branching .approve-body { outline: 2px solid var(--accent); outline-offset: 2px; }
.approve-note { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.approve-version { color: var(--accent); font-weight: 600; }
.approve-more { margin-left: auto; border: 0; background: none; color: var(--accent); font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 2px 0; }
.branches { position: absolute; right: 10px; top: 54px; width: 64%; z-index: 5; display: flex; flex-direction: column; gap: 8px;
  animation: fan-in .16s ease-out; }
@keyframes fan-in { from { opacity: 0; transform: translateX(14px) scale(.98); } to { opacity: 1; transform: none; } }
.branch { background: var(--card); border: 0.5px solid var(--sep); border-radius: 14px; padding: 9px 11px; box-shadow: 0 6px 22px rgba(17, 24, 39, .14);
  transition: transform .08s, background .08s, border-color .08s; }
.branch.hot { background: var(--accent); border-color: var(--accent); color: #fff; transform: scale(1.03); }
.branch.hot .branch-label { color: rgba(255, 255, 255, .85); }
.branch.loading { opacity: .6; }
.branch-label { font-size: 11.5px; font-weight: 700; color: var(--accent); margin-bottom: 3px; }
.branch-text { font-size: 13.5px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.branches.tap .branch { cursor: pointer; }
/* Settings page (#/settings) and its entry on the Connections page */
.settings-entry { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: inherit; text-decoration: none; }
.settings .field { padding: 0; }
.settings .field + .field::before { left: 0; }
.settings .field.stacked { flex-direction: column; align-items: stretch; gap: 4px; padding: 10px 0; }
.settings .field.stacked > span { flex: none; font-size: 14px; color: var(--text-2); }
.settings .field.stacked textarea { min-height: 64px; padding: 8px 10px; border-radius: 10px; background: var(--card-2); }
.settings .field input[type=email] { font-size: 16px; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--sep); background: var(--card-2); color: inherit; max-width: 60%; }
.settings .field input[type=number] { max-width: 90px; font-size: 16px; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--sep); background: var(--card-2); color: inherit; text-align: right; }
.settings .field input[type=checkbox] { flex: none; width: 22px; height: 22px; min-height: 0; margin-left: auto; -webkit-appearance: checkbox; appearance: auto; }
.settings .field .unit { flex: none; font-size: 13px; color: var(--text-3); }
.settings .goal-new { margin-top: 10px; padding-top: 6px; border-top: 1px solid var(--sep); }
.settings .row-between > div:first-child { min-width: 0; }
.danger-text { color: var(--red); }
.btn.danger-btn { background: var(--red-soft); color: var(--red); }
.sheet-body { padding: 4px 2px 16px; }
.confirm-input { width: 100%; font-size: 16px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--sep); background: var(--card-2); color: inherit; }

/* ---------- design v3: the sky follows the hour (dawn / day / dusk / night) ---------- */
.hero { position: relative; padding: 10px 2px 22px; }
.hero::before {
  content: ""; position: absolute; z-index: -1; left: 50%; top: -120px; width: 100vw; height: calc(100% + 300px);
  transform: translateX(-50%); pointer-events: none;
  background: linear-gradient(180deg, transparent 38%, color-mix(in srgb, var(--bg) 70%, transparent) 70%, var(--bg) 96%), var(--sky, transparent);
}
.hero-greeting { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; margin-top: 22px; }
.sky-dawn  { --sky: radial-gradient(120% 90% at 88% 0%, #ffd2ad 0%, rgba(255, 210, 173, 0) 60%),
                    radial-gradient(90% 70% at 0% 30%, #ffeccc 0%, rgba(255, 236, 204, 0) 70%), #fdf1e7; }
.sky-day   { --sky: radial-gradient(120% 90% at 85% 0%, #bcd9ff 0%, rgba(188, 217, 255, 0) 62%),
                    radial-gradient(90% 70% at 0% 25%, #dcecff 0%, rgba(220, 236, 255, 0) 70%), #eef5ff; }
.sky-dusk  { --sky: radial-gradient(110% 90% at 90% 0%, #ffb9a6 0%, rgba(255, 185, 166, 0) 60%),
                    radial-gradient(100% 80% at 0% 20%, #d7c6ff 0%, rgba(215, 198, 255, 0) 70%), #f6eefb; }
.sky-night { --sky: radial-gradient(1.2px 1.2px at 18% 22%, #fff 99%, transparent),
                    radial-gradient(1px 1px at 72% 14%, rgba(255, 255, 255, .9) 99%, transparent),
                    radial-gradient(1.4px 1.4px at 86% 38%, rgba(255, 255, 255, .8) 99%, transparent),
                    radial-gradient(1px 1px at 40% 8%, rgba(255, 255, 255, .7) 99%, transparent),
                    radial-gradient(1px 1px at 58% 44%, rgba(255, 255, 255, .6) 99%, transparent),
                    radial-gradient(120% 90% at 85% 0%, #3b3f8f 0%, rgba(59, 63, 143, 0) 65%), #1a1f45; }
.hero.sky-night .hero-greeting, .hero.sky-night .hero-name { color: #fff; }
.hero.sky-night .hero-status, .hero.sky-night .hero-date { color: rgba(255, 255, 255, .72); }
@media (prefers-color-scheme: dark) {
  .sky-dawn  { --sky: radial-gradient(120% 90% at 88% 0%, rgba(255, 150, 90, .32) 0%, transparent 62%), #17120f; }
  .sky-day   { --sky: radial-gradient(120% 90% at 85% 0%, rgba(75, 143, 245, .30) 0%, transparent 62%), #0f1420; }
  .sky-dusk  { --sky: radial-gradient(110% 90% at 90% 0%, rgba(255, 120, 100, .28) 0%, transparent 60%),
                      radial-gradient(100% 80% at 0% 20%, rgba(160, 120, 255, .22) 0%, transparent 70%), #141019; }
}
/* the numbers sit on the sky like frosted glass */
.stats-strip .stat { background: color-mix(in srgb, var(--card) 78%, transparent); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4); box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset, var(--shadow); }
/* cards arrive one after another instead of all at once */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.ideas > .idea:not(.skeleton) { animation: rise .42s cubic-bezier(.2, .7, .2, 1) both; }
.ideas > .idea:nth-child(2) { animation-delay: .06s; } .ideas > .idea:nth-child(3) { animation-delay: .12s; }
.ideas > .idea:nth-child(4) { animation-delay: .18s; } .ideas > .idea:nth-child(n+5) { animation-delay: .24s; }
@media (prefers-reduced-motion: reduce) { .ideas > .idea { animation: none !important; } }
/* someone's own words, as remembered: a violet marker stroke under the quote */
.memory { color: var(--purple); font-weight: 600; padding: 0 1px;
  background: linear-gradient(transparent 60%, var(--purple-soft) 60%); -webkit-box-decoration-break: clone; box-decoration-break: clone; }
/* relationship warmth: talked this week → ember, this month → amber, this season → sky, longer → frost */
.avatar[class*="warm-"] { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--ring); }
.warm-hot  { --ring: #ff6b3d; } .warm-warm { --ring: #f3b13c; }
.warm-cool { --ring: #8fb8f2; } .warm-cold { --ring: #c9d0da; }
@media (prefers-color-scheme: dark) { .warm-cold { --ring: #4a515c; } }
/* approving: the letter folds away toward the top right, then the card shows a green seal */
@keyframes fly-off {
  40% { transform: translate(6px, -6px) rotate(-2deg) scale(.92); opacity: 1; }
  to  { transform: translate(140px, -90px) rotate(-14deg) scale(.25); opacity: 0; }
}
.approve-card.flying .approve-body { animation: fly-off .46s cubic-bezier(.5, 0, .75, .3) forwards; }
.approve-card.flying .approve-actions { opacity: .4; pointer-events: none; transition: opacity .2s; }
.approve-card.approved .approve-body { position: relative; }
.approve-card.approved .approve-body::after {
  content: "✓"; position: absolute; right: 10px; bottom: -12px; width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px;
  color: #fff; background: var(--green); box-shadow: 0 0 0 3px var(--card); animation: rise .3s both;
}
@media (prefers-reduced-motion: reduce) { .approve-card.flying .approve-body { animation: none; } }
/* People: "who do you want to meet?" */
.meet { background: var(--card); border-radius: var(--radius); padding: 14px; margin: 12px 0 4px; box-shadow: var(--shadow);
  background-image: radial-gradient(120% 120% at 100% 0%, var(--purple-soft), transparent 60%); }
.meet-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.meet-title { font-size: 17px; font-weight: 700; padding-top: 2px; }
.meet-sub { font-size: 13.5px; color: var(--text-2); line-height: 1.45; margin-top: 2px; }
.meet .composer { margin: 0; }
/* Today: replies written ahead, one gesture to send */
.quicks { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.quicks:empty { display: none; }
.quicks-title { font-size: 13px; font-weight: 700; color: var(--text-2); letter-spacing: .02em; margin: 2px 2px -2px; }
.quick { position: relative; background: var(--card); border-radius: var(--radius); padding: 13px 14px 11px; box-shadow: var(--shadow);
  animation: rise .42s cubic-bezier(.2, .7, .2, 1) both; }
.quick-head { display: flex; align-items: center; gap: 10px; }
.quick-name { font-weight: 700; font-size: 15px; }
.quick-sub { font-size: 12px; color: var(--text-3); }
.quick-theirs { margin: 10px 0 8px; padding: 9px 12px; background: var(--in-bubble); border-radius: 16px 16px 16px 4px;
  font-size: 14.5px; line-height: 1.45; max-width: 88%; overflow-wrap: anywhere; }
.quick-draft { margin-left: auto; padding: 10px 13px; background: var(--out-bubble); border-radius: 16px 16px 4px 16px; width: fit-content;
  max-width: 88%; font-size: 15px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none; cursor: grab; }
.quick.branching .quick-draft { outline: 2px solid var(--accent); outline-offset: 2px; }
.quick .branches { top: 40px; }
.quick-hint { font-size: 11.5px; color: var(--text-3); text-align: right; margin-top: 5px; }
.quick-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.quick-status { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; font-size: 14px;
  color: var(--text-2); }
.quick-status .link-btn { border: 0; background: none; color: var(--accent); font-weight: 700; font-size: 14px; cursor: pointer; padding: 6px 2px; }
.quick.counting .quick-draft { box-shadow: 0 0 0 2px var(--accent); }
.quick.sent { opacity: .7; }
.quick.sent .quick-hint, .quick.counting .quick-hint { display: none; }

/* Connect: one list of sources, problems on top, the rest folded */
.conn-hero { padding: 6px 2px 4px; }
.conn-sub { font-size: 14.5px; color: var(--green); font-weight: 600; }
.conn-sub.warn { color: var(--orange); }
.conn-label { font-size: 13px; font-weight: 700; color: var(--text-2); margin: 20px 4px 8px; letter-spacing: .02em; }
.conn-list { padding: 4px 0; }
.conn-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; }
.conn-row + .conn-row { border-top: 0.5px solid var(--sep); }
.conn-main { flex: 1; min-width: 0; }
.conn-name { display: flex; align-items: center; gap: 7px; font-weight: 650; font-size: 15px; min-width: 0; }
.conn-name span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); opacity: .45; }
.conn-row.add .conn-dot { display: none; }
.conn-row.on .conn-dot { background: var(--green); opacity: 1; }
.conn-row.warn .conn-dot { background: var(--orange); opacity: 1; }
.conn-line { font-size: 12.5px; color: var(--text-2); line-height: 1.4; margin-top: 1px; }
.conn-row.warn .conn-line { color: var(--orange); }
.conn-row .btn { flex: none; }
.conn-add { display: flex; gap: 8px; padding: 4px 14px 12px; }
.conn-add input { flex: 1; min-width: 0; }
.conn-problems { border: 1px solid var(--orange-soft); }
.conn-problem { display: flex; gap: 10px; color: var(--orange); }
.conn-problem + .conn-problem { margin-top: 10px; }
.conn-problem strong, .conn-problem .kv { color: var(--text); }
.conn-link { display: block; font-size: 13.5px; font-weight: 600; margin: 8px 4px 0; }
.conn-more { margin-top: 20px; }
.conn-more summary { font-weight: 650; cursor: pointer; }
.conn-tg { margin-top: 14px; }
.agent-sub { font-weight: 700; margin-top: 14px; }
.agent-log { margin-top: 14px; }
.agent-log summary { font-weight: 650; cursor: pointer; }

/* Publish: chips for where, a composer for what, a line per platform for how it went */
.pub-chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pub-chip { border: 1.5px solid var(--sep); background: var(--card); border-radius: 16px; padding: 11px 12px; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); min-width: 0; }
.pub-chip.on { border-color: var(--accent); background: var(--accent-soft); }
.pub-chip.off { opacity: .75; }
.pub-chip:disabled { opacity: .45; cursor: default; }
.pub-chip-name { font-weight: 700; font-size: 15px; }
.pub-chip-sub { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pub-chip.on .pub-chip-sub { color: var(--accent); }
.pub-compose { display: flex; flex-direction: column; gap: 10px; }
.pub-thumbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.pub-thumb, .pub-add { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--card-2); }
.pub-thumb img, .pub-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.pub-add { border: 1.5px dashed var(--sep); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--text-2); font-size: 11.5px; cursor: pointer; }
.pub-remove { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55);
  color: #fff; font-size: 15px; line-height: 1; cursor: pointer; }
.pub-progress { position: absolute; inset: auto 0 0; background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; text-align: center; padding: 3px 0; }
.pub-caption { width: 100%; font-size: 16px; border: 0.5px solid var(--sep); border-radius: 14px; padding: 11px 13px; background: var(--bg); resize: vertical; }
.pub-tailored:empty, .pub-extras:empty { display: none; }
.publish > .btn.block { margin-top: 12px; }
.pub-post { padding: 12px 14px; }
.pub-post + .pub-post { border-top: 0.5px solid var(--sep); }
.pub-post-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; }
.pub-target { display: flex; align-items: center; gap: 8px; font-size: 13.5px; padding: 3px 0; }
.pub-target-name { font-weight: 650; min-width: 74px; }
.pub-target-state { color: var(--text-2); flex: 1; min-width: 0; }
.pub-target.published .conn-dot { background: var(--green); opacity: 1; }
.pub-target.processing .conn-dot, .pub-target.queued .conn-dot { background: var(--accent); opacity: 1; animation: pulse 1.2s ease-in-out infinite; }
.pub-target.failed .conn-dot { background: var(--red); opacity: 1; }
.pub-target.failed .pub-target-state { color: var(--red); }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .pub-target .conn-dot { animation: none !important; } }
.publish .field.stacked { flex-direction: column; align-items: stretch; gap: 4px; padding: 6px 0; }
.publish .field.stacked > span { flex: none; font-size: 13.5px; color: var(--text-2); }
.publish .field.stacked textarea, .publish .field.stacked input, .publish .field.stacked select { width: 100%; min-height: 40px;
  padding: 8px 10px; border-radius: 10px; background: var(--card-2); border: 0.5px solid var(--sep); text-align: left; max-width: none; }

/* The agent speaking first: a time line, a small title, and a dot on the chat tab until it is read */
.chat-time { align-self: center; font-size: 12px; color: var(--text-3); margin: 10px 0 2px; }
.chat-bubble.proactive { border: 0.5px solid var(--accent-soft); }
.chat-proactive-title { font-size: 11.5px; font-weight: 700; color: var(--accent); margin-bottom: 4px; }
.tab { position: relative; }
.tab.has-unread::after { content: ""; position: absolute; top: 7px; left: calc(50% + 9px); width: 8px; height: 8px; border-radius: 50%;
  background: var(--red); box-shadow: 0 0 0 2px var(--tabbar-bg); }

/* Settings: reply styles, tap order shown as A/B/C */
.style-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.style-chip { border: 1px solid var(--sep); background: var(--card-2); color: var(--text); border-radius: 999px; padding: 7px 13px;
  font-size: 14px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.style-chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 650; }
.style-chip b { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px;
  display: inline-flex; align-items: center; justify-content: center; }

/* The long-press pager: draft -> how to answer -> tone, one full-width page per swipe */
.pager { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; justify-content: center;
  background: color-mix(in srgb, var(--bg) 70%, transparent); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  animation: rise .18s ease-out both; touch-action: none; }
.pager-top { position: absolute; top: calc(14px + env(safe-area-inset-top)); left: 16px; right: 16px; display: flex; flex-direction: column;
  align-items: center; gap: 8px; }
.pager-back { position: absolute; left: 0; top: 0; border: 0; background: none; color: var(--accent); font-size: 16px; font-weight: 600; padding: 4px 0; }
.pager-who { font-size: 13px; color: var(--text-2); font-weight: 600; }
.pager-dots { display: flex; gap: 6px; }
.pager-dot { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--card-2); color: var(--text-3); font-weight: 600;
  transition: background .2s, color .2s; }
.pager-dot.on { background: var(--accent); color: #fff; }
.pager-viewport { overflow: hidden; width: 100%; }
.pager-strip { display: flex; width: 300%; transition: transform .28s cubic-bezier(.2, .8, .2, 1); }
.pager-page { width: calc(100% / 3); padding: 0 18px; display: flex; flex-direction: column; gap: 10px; }
.pager-title { font-size: 22px; font-weight: 800; margin: 0 2px 4px; }
.pager-row { background: var(--card); border-radius: 18px; padding: 14px 16px; box-shadow: 0 8px 28px rgba(17, 24, 39, .12);
  border: 2px solid transparent; transition: transform .12s ease, border-color .12s ease; }
.pager-row.hot { border-color: var(--accent); transform: scale(1.02); }
.pager-row.hot-static { background: var(--out-bubble); }
.pager-way .pager-row-text { font-size: 19px; font-weight: 700; text-align: center; }
.pager-row-label { font-size: 12.5px; font-weight: 700; color: var(--accent); margin-bottom: 4px; }
.pager-row-text { font-size: 16px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.pager-hint { font-size: 13px; color: var(--text-2); text-align: center; margin-top: 6px; }
.pager.tap .pager-row { cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .pager-strip { transition: none; } }
