/* VanGuard Message web app. Mirrors the Android app: Manrope, the same seven themes,
   20px bubbles with a 6px tail corner, gradient outgoing bubbles, gold ☥ accents. */

@font-face {
  font-family: "Manrope";
  src: url("assets/manrope.ttf") format("truetype");
  font-weight: 200 800;
  font-display: swap;
}

/* ---------- themes (tokens only) ---------- */
:root,
html[data-theme="light"] {
  --bg: linear-gradient(135deg, #fff4d6 0%, #ffe1c4 55%, #f3d6ff 100%);
  --wallpaper: none;
  --scrim: transparent;
  --text: #1e1b16;
  --muted: #6b6455;
  --accent: #e8623f;
  --on-accent: #ffffff;
  --panel: rgba(255, 253, 248, 0.86);
  --panel-strong: #fffdf8;
  --raised: #efe6d3;
  --line: rgba(30, 27, 22, 0.12);
  --out: linear-gradient(135deg, #f7b733 0%, #f2734f 55%, #d9508a 100%);
  --out-text: #ffffff;
  --in-text: #1e1b16;
  --danger: #c8452e;
  --stripe: #d4a54a;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: linear-gradient(135deg, #141110 0%, #1b1426 55%, #2a1220 100%);
  --text: #e8dcc4;
  --muted: #8c8578;
  --accent: #d4a54a;
  --on-accent: #0f0e0c;
  --panel: rgba(36, 33, 25, 0.92);
  --panel-strong: #1a1816;
  --raised: #242119;
  --line: #3b3630;
  --out: linear-gradient(135deg, #c98a1e 0%, #c4502f 55%, #9e2f6a 100%);
  --out-text: #ffffff;
  --in-text: #e8dcc4;
  --danger: #d9694f;
  color-scheme: dark;
}
html[data-theme="fatiu_flag"],
html[data-theme="garvey"],
html[data-theme="black_panther"],
html[data-theme="malcolm_x"],
html[data-theme="ayitian"] {
  --text: #f4eee2;
  --muted: #d2c9ba;
  --in-text: #f4eee2;
  --panel: rgba(20, 18, 22, 0.55);
  --panel-strong: rgba(20, 18, 22, 0.86);
  --raised: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.14);
  --danger: #ff7a5c;
  color-scheme: dark;
}
html[data-theme="fatiu_flag"] {
  --bg: linear-gradient(180deg, #d8322a 0%, #4a1e1e 30%, #2a2a2e 55%, #5a5a62 80%, #a8a8b0 100%);
  --accent: #ff4b3e;
  --on-accent: #ffffff;
  --out: linear-gradient(135deg, #ff4b3e, #b0201a);
  --out-text: #ffffff;
}
html[data-theme="garvey"] {
  --bg: linear-gradient(180deg, #d8322a 0%, #4a1e1e 30%, #2a2a2e 55%, #1e4a30 80%, #1fa654 100%);
  --accent: #3ed37a;
  --on-accent: #06180d;
  --out: linear-gradient(135deg, #ff4b3e, #24b85c);
  --out-text: #ffffff;
}
html[data-theme="black_panther"] {
  --bg: #000000;
  --wallpaper: url("assets/bpp_bg.jpg");
  --scrim: rgba(0, 0, 0, 0.35);
  --accent: #4fc3f7;
  --on-accent: #041018;
  --panel: rgba(16, 18, 22, 0.65);
  --out: linear-gradient(135deg, #1e88e5, #4fc3f7);
  --out-text: #041018;
}
html[data-theme="malcolm_x"] {
  --bg: #000000;
  --wallpaper: url("assets/malcolmx_bg.jpg");
  --scrim: rgba(0, 0, 0, 0.35);
  --accent: #ededed;
  --on-accent: #111111;
  --panel: rgba(16, 18, 22, 0.65);
  --out: linear-gradient(135deg, #b0b0b0, #ededed);
  --out-text: #111111;
}
html[data-theme="ayitian"] {
  --bg: #07090c;
  --wallpaper: url("assets/ayitian_bg.jpg");
  --scrim: rgba(7, 11, 14, 0.3);
  --accent: #e0b75a;
  --on-accent: #0e0a02;
  --panel: rgba(14, 18, 22, 0.65);
  --out: linear-gradient(135deg, #e0b75a, #9c7422);
  --out-text: #0e0a02;
}

/* ---------- base ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: #0f0e0c;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  font-size: 15px;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
/* JS toggles `hidden`; class rules like `.search-bar { display: flex }` must not override it. */
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#bg { position: fixed; inset: 0; background: var(--bg); z-index: 0; }
#bg::before { content: ""; position: absolute; inset: 0; background: var(--wallpaper) center / cover no-repeat; }
#bg::after { content: ""; position: absolute; inset: 0; background: var(--scrim); }

#app {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--app-h, 100dvh);
  display: flex;
  flex-direction: column;
  z-index: 1;
}
@media (min-width: 900px) {
  #app { max-width: 720px; margin: 0 auto; box-shadow: 0 0 0 1px var(--line); }
}

.screen { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: calc(env(safe-area-inset-top) + 6px) 6px 6px;
  min-height: 56px;
}
.title-block { flex: 1; min-width: 0; padding: 0 6px; }
.title { font-size: 19px; font-weight: 700; letter-spacing: -0.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subtitle { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.brand .ankh { color: var(--stripe); }
.icon-btn {
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: transparent; color: var(--text);
  display: inline-grid; place-items: center; flex: none;
}
.icon-btn:active { background: var(--line); }
.icon-btn svg { width: 24px; height: 24px; }
.content { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ---------- inbox ---------- */
.search-field {
  margin: 2px 12px 8px; display: flex; align-items: center; gap: 8px;
  padding: 0 14px; height: 44px; border-radius: 22px;
  background: var(--panel); border: 1px solid var(--line);
}
.search-field svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.search-field input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 16px; outline: none; }
.conv-row { display: flex; align-items: center; gap: 12px; padding: 8px 16px; cursor: pointer; }
.conv-row:active { background: var(--line); }
.avatar {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 17px; flex: none; letter-spacing: 0.3px;
}
.avatar.sm { width: 36px; height: 36px; font-size: 14px; }
.conv-main { flex: 1; min-width: 0; border-bottom: 1px solid var(--line); padding: 4px 0 10px; }
.conv-top { display: flex; align-items: baseline; gap: 8px; }
.conv-name { flex: 1; font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { font-size: 12px; color: var(--muted); flex: none; }
.conv-bottom { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.conv-snippet { flex: 1; font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-row.unread .conv-name, .conv-row.unread .conv-snippet { color: var(--text); font-weight: 700; }
.badge {
  min-width: 22px; height: 22px; border-radius: 11px; background: var(--accent); color: var(--on-accent);
  font-size: 12px; font-weight: 700; display: grid; place-items: center; padding: 0 6px; flex: none;
}
.fab {
  position: absolute; right: 18px; bottom: calc(env(safe-area-inset-bottom) + 18px);
  height: 56px; padding: 0 22px 0 18px; border-radius: 28px; border: 0;
  background: var(--out); color: var(--out-text); font-weight: 700; font-size: 15px;
  display: flex; align-items: center; gap: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.fab svg { width: 22px; height: 22px; }
.empty { text-align: center; color: var(--muted); padding: 48px 28px; line-height: 1.55; }
.banner {
  margin: 6px 12px 8px; padding: 12px 14px; border-radius: 16px;
  background: var(--panel-strong); border: 1px solid var(--line);
  font-size: 14px; line-height: 1.45; display: flex; gap: 10px; align-items: center;
}
.banner .grow { flex: 1; }
.banner b { display: block; }

/* ---------- thread ---------- */
.msgs {
  flex: 1; min-height: 0; overflow-y: auto; padding: 8px 10px 12px;
  display: flex; flex-direction: column; gap: 2px; overscroll-behavior: contain;
}
.day {
  align-self: center; margin: 12px 0 6px; padding: 3px 12px; border-radius: 12px;
  background: var(--panel); color: var(--muted); font-size: 12px; font-weight: 600;
}
.sender-name { font-size: 12px; color: var(--muted); margin: 8px 0 2px 14px; }
.row { display: flex; flex-direction: column; max-width: 100%; }
.row.out { align-items: flex-end; }
.row.in { align-items: flex-start; }
.bubble {
  max-width: min(80%, 440px); border-radius: 20px; overflow: hidden;
  background: var(--panel); color: var(--in-text); position: relative;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  touch-action: pan-y; transition: transform 0.18s ease;
}
.row.out .bubble { background: var(--out); color: var(--out-text); border-bottom-right-radius: 6px; }
.row.in .bubble { border-bottom-left-radius: 6px; }
.bubble.dragging { transition: none; }
.bubble .body { padding: 9px 14px; font-size: 16px; line-height: 22px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble .body a { color: inherit; text-decoration: underline; }
.bubble.unsent { background: transparent !important; border: 1px solid var(--line); color: var(--muted); font-style: italic; }
.bubble.hl { box-shadow: inset 0 0 0 2px var(--accent); }
.quote { margin: 10px 12px 0; padding-left: 8px; border-left: 3px solid var(--stripe); font-size: 13px; opacity: 0.88; }
.quote .who { font-size: 11px; font-weight: 700; }
.quote .qt { font-style: italic; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.att-img { display: block; width: 270px; max-width: 100%; max-height: 360px; object-fit: cover; background: var(--raised); cursor: zoom-in; }
.att-video { position: relative; width: 270px; max-width: 100%; height: 180px; background: #000; display: grid; place-items: center; cursor: pointer; }
.att-video video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.att-video .play, .viewer .play {
  position: absolute; width: 58px; height: 58px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.45); display: grid; place-items: center; color: #fff;
}
.att-file { display: flex; align-items: center; gap: 10px; padding: 12px 14px; color: inherit; cursor: pointer; }
.att-file svg { width: 26px; height: 26px; flex: none; }
.att-file .fname { font-weight: 600; font-size: 14px; word-break: break-all; }
.att-file .fmeta { font-size: 12px; opacity: 0.75; }
.att-loading { width: 220px; height: 110px; display: grid; place-items: center; font-size: 13px; opacity: 0.75; }
.audio { display: flex; align-items: center; gap: 8px; padding: 6px 12px 8px 6px; width: 270px; max-width: 100%; }
.audio-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(127, 127, 127, 0.22);
  color: inherit; display: grid; place-items: center; flex: none;
}
.audio-btn svg { width: 22px; height: 22px; }
.audio-track { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.audio-track input[type="range"] { width: 100%; accent-color: currentColor; margin: 0; }
.audio-meta { display: flex; justify-content: space-between; font-size: 11px; opacity: 0.85; }
.transcribe {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px 0; font-size: 12px; font-weight: 700;
  background: none; border: 0; color: inherit;
}
.transcribe svg { width: 16px; height: 16px; }
.transcript { padding: 10px 12px 0; font-size: 14px; line-height: 20px; opacity: 0.94; white-space: pre-wrap; }
.reacts { display: flex; gap: 4px; margin: 3px 6px 0; flex-wrap: wrap; }
.react-chip { border: 1px solid transparent; background: var(--panel-strong); color: var(--text); border-radius: 12px; padding: 2px 8px; font-size: 13px; }
.react-chip.mine { border-color: var(--stripe); }
.meta { font-size: 11px; color: var(--muted); margin: 2px 8px 4px; }
.meta.failed { color: var(--danger); font-weight: 700; }
.pinned-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 12px 8px; flex: none; }
.pin {
  flex: none; max-width: 240px; padding: 6px 10px; border-radius: 12px; background: var(--panel-strong);
  border: 1px solid var(--line); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.search-bar { display: flex; align-items: center; gap: 4px; padding: 2px 10px 2px 16px; background: var(--panel-strong); font-size: 13px; flex: none; }
.search-bar .count { flex: 1; }
.topbar input.thread-search {
  flex: 1; min-width: 0; height: 40px; border-radius: 20px; border: 1px solid var(--line);
  background: var(--panel); padding: 0 14px; font-size: 16px; outline: none;
}

/* ---------- composer ---------- */
.composer-wrap {
  flex: none; padding: 6px 8px calc(env(safe-area-inset-bottom) + 6px);
  background: var(--panel-strong); border-top: 1px solid var(--line);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.composer { display: flex; align-items: flex-end; gap: 4px; }
.composer .plus { color: var(--accent); }
.input {
  flex: 1; min-width: 0; min-height: 44px; max-height: 140px; resize: none; border: 0; border-radius: 22px;
  padding: 11px 16px; background: var(--raised); font-size: 16px; line-height: 22px; outline: none;
}
.send-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center; flex: none;
}
.send-btn svg { width: 22px; height: 22px; }
.send-btn:disabled { opacity: 0.45; }
.compose-banner { display: flex; align-items: center; gap: 8px; padding: 4px 4px 8px 12px; }
.compose-banner .grow { flex: 1; min-width: 0; }
.compose-banner .lbl { font-weight: 700; color: var(--accent); font-size: 12px; }
.compose-banner .txt { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.staged { display: flex; gap: 8px; overflow-x: auto; padding: 4px 4px 8px; }
.staged-item {
  position: relative; flex: none; width: 84px; height: 84px; border-radius: 12px; overflow: hidden;
  background: var(--raised); display: grid; place-items: center; font-size: 11px; text-align: center; padding: 6px;
  word-break: break-all;
}
.staged-item img, .staged-item video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.staged-item .x {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, 0.62); color: #fff; display: grid; place-items: center; z-index: 1;
}
.staged-item .x svg { width: 14px; height: 14px; }
.rec-bar { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.rec-bar .icon-btn { color: var(--danger); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s steps(2) infinite; }
.rec-time { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 17px; }
.rec-level { flex: 1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.rec-level i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.1s linear; }
@keyframes blink { 50% { opacity: 0.3; } }

/* ---------- sheets ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 40;
  display: flex; align-items: flex-end; justify-content: center; animation: fade 0.15s ease;
}
.sheet {
  width: 100%; max-width: 720px; max-height: 82dvh; overflow-y: auto; background: var(--panel-strong);
  color: var(--text); border-radius: 22px 22px 0 0; padding: 6px 0 calc(env(safe-area-inset-bottom) + 12px);
  animation: rise 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
}
.sheet-grip { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 10px; }
.sheet h3 { margin: 2px 20px 10px; font-size: 17px; }
.sheet .sheet-pad { padding: 0 20px 8px; }
.sheet-emoji-row { display: flex; gap: 6px; overflow-x: auto; padding: 2px 14px 10px; }
.sheet-emoji-row button { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--raised); font-size: 24px; flex: none; }
.sheet-emoji-row button.mine { box-shadow: inset 0 0 0 2px var(--stripe); }
.sheet-item {
  display: block; width: 100%; text-align: left; padding: 13px 20px; background: none; border: 0;
  color: var(--text); font-size: 16px;
}
.sheet-item small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.sheet-item.danger { color: var(--danger); }
.sheet-item:active { background: var(--line); }
.sheet hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
@keyframes rise { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } }

/* ---------- full-screen viewer ---------- */
.viewer { position: fixed; inset: 0; background: #000; z-index: 50; display: flex; flex-direction: column; color: #fff; }
.viewer-top {
  position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 2px;
  padding: calc(env(safe-area-inset-top) + 4px) 6px 10px; background: linear-gradient(rgba(0, 0, 0, 0.65), transparent);
  z-index: 2; transition: opacity 0.2s;
}
.viewer.bare .viewer-top { opacity: 0; pointer-events: none; }
.viewer-top .icon-btn { color: #fff; }
.viewer-top .vt { flex: 1; min-width: 0; font-size: 15px; font-weight: 700; }
.viewer-top .vt small { display: block; opacity: 0.78; font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-track { flex: 1; display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; }
.viewer-track::-webkit-scrollbar { display: none; }
.viewer-slide { flex: 0 0 100%; height: 100%; scroll-snap-align: center; display: grid; place-items: center; overflow: hidden; position: relative; }
.viewer-slide img { max-width: 100%; max-height: 100%; object-fit: contain; transform-origin: center center; transition: transform 0.15s ease; touch-action: none; }
.viewer-slide video { max-width: 100%; max-height: 100%; }

/* ---------- settings / onboarding ---------- */
.settings { padding: 4px 18px calc(env(safe-area-inset-bottom) + 36px); }
.section { margin: 12px 0 24px; }
.section h2 { font-size: 12px; letter-spacing: 0.7px; text-transform: uppercase; color: var(--accent); margin: 0 0 10px; }
.section p, .hint { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 6px 0; }
.field { display: block; margin: 10px 0; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin: 0 0 4px 4px; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel);
  padding: 0 14px; font-size: 16px; outline: none;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.btn {
  min-height: 44px; padding: 0 18px; border-radius: 22px; border: 1px solid var(--line); background: var(--panel);
  color: var(--text); font-weight: 700; font-size: 15px;
}
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.btn.danger { color: var(--danger); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: 0.5; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--panel);
  color: var(--text); font-size: 14px; font-weight: 600;
}
.chip.selected { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.toggle-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.toggle-row .tl { flex: 1; }
.toggle-row .tl b { display: block; font-size: 15px; font-weight: 600; }
.toggle-row .tl small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 16px; background: var(--line); transition: background 0.15s; }
.switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%;
  background: #fff; transition: transform 0.15s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }
.onboard { flex: 1; overflow-y: auto; padding: calc(env(safe-area-inset-top) + 36px) 22px 36px; }
.onboard-inner { max-width: 440px; margin: 0 auto; }
.logo { width: 96px; height: 96px; border-radius: 24px; display: block; margin: 8px auto 18px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); }
.onboard h1 { text-align: center; font-size: 28px; letter-spacing: -0.5px; margin: 0 0 6px; }
.onboard .lede { text-align: center; color: var(--muted); margin: 0 0 22px; line-height: 1.55; }
.card { background: var(--panel-strong); border: 1px solid var(--line); border-radius: 22px; padding: 18px; }
.error { color: var(--danger); font-size: 14px; margin: 8px 4px; min-height: 1em; }
.recap { white-space: pre-wrap; line-height: 1.55; font-size: 15px; padding: 0 20px 12px; }
.spinner {
  width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite; margin: 18px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

#toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 96px);
  transform: translateX(-50%) translateY(20px); background: rgba(20, 18, 16, 0.94); color: #f4eee2;
  padding: 10px 16px; border-radius: 18px; font-size: 14px; max-width: 86vw; opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s; z-index: 60; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* "My texts": the phone's own SMS/MMS on a computer */
.sub-line { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bubble .subject { font-weight: 600; padding: 10px 14px 0; }
.card .sub { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.topbar .chip { margin-left: auto; margin-right: 6px; padding: 6px 12px; font-size: 13px; white-space: nowrap; }

/* a muted conversation's bell, next to its name in the list */
.muted-bell { font-size: 12px; opacity: 0.75; margin-left: 4px; flex: 0 0 auto; }

/* a paused recording: the dot stops blinking and says so */
.rec-dot.paused { animation: none; opacity: 0.35; }
.rec-paused { font-size: 12px; color: var(--muted); margin-left: 6px; }

/* recap: custom date range */
.custom-range { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-top: 12px; }
.custom-range label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.custom-range input[type="date"] { font: inherit; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--raised); color: var(--text); }
.recap b { font-weight: 650; }

/* Shared media & links */
.shared-search[hidden], .shared-search:has(input[hidden]) { display: none; }
.shared-tabs { display: flex; gap: 4px; padding: 4px 12px 8px; overflow-x: auto; }
.shared-tab { flex: 1 0 auto; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600;
  padding: 8px 10px; border-bottom: 2px solid transparent; white-space: nowrap; }
.shared-tab.on { color: var(--text); border-bottom-color: var(--stripe); }
.shared-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 3px; padding: 3px; }
.shared-tile { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 8px; background: var(--raised); cursor: pointer; }
.shared-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shared-tile.video { background: #1b1b1b; }
.shared-play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; }
.shared-play svg { width: 34px; height: 34px; }
.shared-row { align-items: center; }
.shared-icon { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--raised); color: var(--stripe); }
.shared-icon svg { width: 20px; height: 20px; }
.shared-row .conv-snippet { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* scheduled messages: strips above the composer and rows in the Scheduled list */
.sched-list { display: flex; flex-direction: column; gap: 4px; padding: 6px 10px 0; }
.sched-strip { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; border-radius: 12px; padding: 8px 12px;
  background: var(--raised); color: var(--text); font: inherit; cursor: pointer; }
.sched-strip.warn { background: color-mix(in srgb, var(--stripe) 22%, var(--raised)); }
.sched-main { display: flex; flex-direction: column; min-width: 0; }
.sched-main b { font-size: 13px; }
.sched-main span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sched-row { padding: 8px 14px; border-bottom: 1px solid var(--line); }
.send-btn { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }

/* sign-in screen: the notes for someone who already uses VanGuard */
.onboard .banner.returning { margin: 0 0 14px; }

/* long-press sheet extras and multi-select */
.sheet-emoji-row button.more-emoji { display: grid; place-items: center; color: var(--muted); }
.sheet-emoji-row button.more-emoji svg { width: 22px; height: 22px; }
.emoji-input { width: 100%; font-size: 32px; text-align: center; padding: 8px; border-radius: 14px; border: 1px solid var(--line); background: var(--raised); color: inherit; }
.row-btns { display: flex; justify-content: flex-end; margin-top: 10px; }
.details .detail { padding: 6px 0; border-bottom: 1px solid var(--line); }
.details .detail:last-child { border-bottom: 0; }
.details .k { font-size: 12px; color: var(--muted); }
.details .v { font-size: 15px; overflow-wrap: anywhere; }
.row.picking { position: relative; }
.row.picking .bubble { cursor: pointer; }
.row.picked .bubble { box-shadow: inset 0 0 0 3px var(--accent); }
.row.picking.in { padding-left: 30px; }
.row.picking.out { padding-right: 30px; }
.row.picking::after { content: ""; position: absolute; top: 50%; width: 20px; height: 20px; margin-top: -10px; border-radius: 50%; border: 2px solid var(--muted); box-sizing: border-box; }
.row.picking.in::after { left: 2px; }
.row.picking.out::after { right: 2px; }
.row.picked::after { border-color: var(--accent); background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center / 13px no-repeat; }
@media (max-width: 440px) {
  .sheet-emoji-row { gap: 5px; }
  .sheet-emoji-row button { width: 40px; height: 40px; font-size: 21px; }
}

/* "My photo": the picture is the wallpaper; JS sets the accent and dim from it */
html[data-theme="photo"] {
  --bg: #000000;
  --text: #f4eee2;
  --muted: #d2c9ba;
  --in-text: #f4eee2;
  --panel: rgba(16, 18, 22, 0.65);
  --panel-strong: rgba(16, 18, 22, 0.88);
  --raised: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.14);
  --danger: #ff7a5c;
  color-scheme: dark;
}

/* swipes: the label says what letting go will do, as on the phone */
.swipe-wrap { position: relative; }
[data-swipe] { position: relative; }
[data-swipe]::before {
  content: attr(data-swipe-label); position: absolute; top: 50%; transform: translateY(-50%);
  font-size: 13px; font-weight: 700; color: var(--accent); opacity: 0.45; pointer-events: none; z-index: 0;
}
[data-swipe].swipe-armed::before { opacity: 1; }
[data-swipe][data-swipe-label="Delete"]::before { color: var(--danger); }
[data-swipe="right"]::before { left: 14px; }
[data-swipe="left"]::before { right: 14px; }
.swipe-wrap > .conv-row, .row > .bubble { position: relative; z-index: 1; }
.swipe-pick { margin: 10px 0; }
.swipe-pick b { display: block; font-size: 14px; margin-bottom: 6px; }
.sheet-emoji-row button.more-emoji { font-size: 20px; }
.conv-row { touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; transition: transform 0.18s ease; }
.conv-row.dragging { transition: none; background: var(--panel-strong); }
input[type="range"] { accent-color: var(--accent); width: 100%; }
