/* Messages for the Tesla browser. Apple-style, large touch targets, light + dark. */

:root {
  color-scheme: light dark;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  --bg: #ffffff;
  --sidebar: #f5f5f7;
  --elevated: #ffffff;
  --label: #000000;
  --label-2: rgba(60, 60, 67, 0.62);
  --label-3: rgba(60, 60, 67, 0.34);
  --separator: rgba(60, 60, 67, 0.2);
  --separator-strong: rgba(60, 60, 67, 0.32);
  --fill: rgba(118, 118, 128, 0.12);
  --fill-2: rgba(118, 118, 128, 0.2);
  --fill-pressed: rgba(118, 118, 128, 0.28);
  --blue: #007aff;
  --bubble-blue: #0b84ff;
  --bubble-green: #34c759;
  --bubble-gray: #e9e9eb;
  --on-gray: #000000;
  --red: #ff3b30;
  --material: rgba(250, 250, 252, 0.78);
  --material-sidebar: rgba(245, 245, 247, 0.82);
  --avatar-top: #a5abb8;
  --avatar-bottom: #858994;
  --tapback-gray: #e9e9eb;
  --tapback-glyph: #8e8e93;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.08);

  --sidebar-w: clamp(380px, 33vw, 560px);
  --target: 64px;
  --bubble-font: 1.08rem;
  --radius-bubble: 1.2em;
  --header-h: 124px;
  --app-h: 100dvh;
  --ease: cubic-bezier(0.25, 0.8, 0.25, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.64, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --sidebar: #1c1c1e;
    --elevated: #1c1c1e;
    --label: #ffffff;
    --label-2: rgba(235, 235, 245, 0.62);
    --label-3: rgba(235, 235, 245, 0.32);
    --separator: rgba(84, 84, 88, 0.5);
    --separator-strong: rgba(84, 84, 88, 0.75);
    --fill: rgba(118, 118, 128, 0.24);
    --fill-2: rgba(118, 118, 128, 0.32);
    --fill-pressed: rgba(118, 118, 128, 0.44);
    --blue: #0a84ff;
    --bubble-blue: #0a84ff;
    --bubble-green: #30d158;
    --bubble-gray: #262629;
    --on-gray: #ffffff;
    --red: #ff453a;
    --material: rgba(22, 22, 24, 0.78);
    --material-sidebar: rgba(28, 28, 30, 0.84);
    --avatar-top: #6d6d74;
    --avatar-bottom: #4b4b51;
    --tapback-gray: #3a3a3c;
    --tapback-glyph: #aeaeb2;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.4);
  }
}

html {
  font-size: 23px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
@media (max-width: 1599px) {
  html { font-size: 22px; }
}
@media (max-width: 1279px) {
  html { font-size: 20px; }
  :root { --header-h: 108px; }
}
@media (max-height: 760px) {
  :root { --header-h: 100px; }
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--label);
  font-family: var(--font);
  font-feature-settings: 'cv11', 'ss03';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
body { position: fixed; inset: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
[hidden] { display: none !important; }
.noscript { padding: 40px; font-size: 1.2rem; }

svg.i { width: 1em; height: 1em; display: block; flex: none; }

#app {
  height: var(--app-h);
  transform: translateY(var(--vv-top, 0px));
  width: 100%;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
#app.booting { background: var(--bg); }

/* ------------------------------------------------------------------ lock screen */

.lock {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 520px) auto;
  justify-content: center;
  align-items: center;
  justify-items: center;
  padding: 32px clamp(24px, 6vw, 120px);
  gap: clamp(56px, 9vw, 180px);
  background:
    radial-gradient(1200px 700px at 15% 0%, rgba(52, 199, 89, 0.10), transparent 60%),
    radial-gradient(900px 600px at 100% 100%, rgba(10, 132, 255, 0.10), transparent 60%),
    var(--bg);
  animation: fade-in 0.35s var(--ease);
}
.lock-id { display: flex; flex-direction: column; align-items: center; width: min(100%, 520px); text-align: center; }
.lock-icon { width: 132px; height: 132px; filter: drop-shadow(0 8px 24px rgba(12, 189, 42, 0.28)); }
.lock-title { font-size: 2.1rem; font-weight: 700; letter-spacing: -0.025em; margin: 22px 0 6px; }
.lock-sub { font-size: 1rem; color: var(--label-2); margin: 0 0 26px; min-height: 1.4em; }
.lock-sub.error { color: var(--red); font-weight: 500; }
.lock-field {
  width: 100%;
  height: 76px;
  border-radius: 20px;
  border: 0;
  outline: none;
  background: var(--fill);
  text-align: center;
  font-size: 2rem;
  letter-spacing: 0.3em;
  padding: 0 24px;
  caret-color: var(--blue);
  transition: box-shadow 0.2s var(--ease);
  user-select: text;
  -webkit-user-select: text;
}
.lock-field:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 45%, transparent); }
.lock-field::placeholder { letter-spacing: 0; font-size: 1.05rem; color: var(--label-3); }
.lock-field:disabled { opacity: 0.5; }
.lock-unlock {
  margin-top: 22px;
  width: 100%;
  height: 72px;
  border-radius: 20px;
  border: 0;
  background: var(--blue);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  transition: transform 0.12s var(--ease), opacity 0.2s;
}
.lock-unlock:active { transform: scale(0.97); }
.lock-unlock:disabled { opacity: 0.45; }
.shake { animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@keyframes shake {
  10%, 90% { transform: translateX(-4px); }
  20%, 80% { transform: translateX(8px); }
  30%, 50%, 70% { transform: translateX(-14px); }
  40%, 60% { transform: translateX(14px); }
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, var(--key));
  gap: clamp(14px, 2.4vh, 26px) clamp(20px, 2.2vw, 34px);
  --key: clamp(84px, min(11vh, 7vw), 104px);
}
.key {
  width: var(--key);
  height: var(--key);
  border-radius: 50%;
  border: 0;
  background: var(--fill);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background-color 0.25s var(--ease), transform 0.12s var(--ease);
}
.key:active, .key.pressed { background: var(--fill-pressed); transform: scale(0.95); transition-duration: 0s; }
.key b { font-size: 2.05rem; font-weight: 400; letter-spacing: -0.01em; }
.key small { font-size: 0.5rem; font-weight: 600; letter-spacing: 0.18em; margin-top: 4px; color: var(--label-2); }
.key.plain { background: transparent; font-size: 1.5rem; color: var(--label); }
.key.plain:active { background: var(--fill); }
.key.ghost { visibility: hidden; }

@media (max-aspect-ratio: 1/1) {
  .lock { grid-template-columns: 1fr; align-content: center; gap: 36px; }
}

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

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100%;
  animation: fade-in 0.3s var(--ease);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ------------------------------------------------------------------ sidebar */

.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--separator);
}
.sb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 0;
  height: 84px;
  flex: none;
}
.tool {
  width: var(--target);
  height: var(--target);
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 38px;
  display: grid;
  place-items: center;
  transition: background-color 0.2s var(--ease), transform 0.12s var(--ease);
}
.tool:active { background: var(--fill); transform: scale(0.94); transition-duration: 0s; }
.tool.lockbtn { font-size: 32px; }
.sb-title {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 0 28px 14px;
  flex: none;
}
.sb-title h1 { font-size: 2.05rem; line-height: 1.1; font-weight: 700; letter-spacing: -0.028em; margin: 0; }
.demo-chip {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--label-2);
  background: var(--fill);
  border-radius: 8px;
  padding: 4px 8px;
  transform: translateY(-4px);
}

.search {
  position: relative;
  margin: 0 20px 14px;
  flex: none;
}
.search .mag {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 26px;
  color: var(--label-2);
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 62px;
  border: 0;
  border-radius: 16px;
  background: var(--fill);
  padding: 0 64px 0 58px;
  font-size: 1rem;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
  -webkit-appearance: none;
  appearance: none;
}
.search input::placeholder { color: var(--label-2); }
.search input::-webkit-search-cancel-button { display: none; }
.clear-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  border: 0;
  background: transparent;
  display: grid;
  place-items: center;
  font-size: 26px;
  color: var(--label-3);
}
.clear-btn .x { stroke: var(--sidebar); }
.i .x { stroke: var(--bg); }
.chip .i { color: var(--blue); }

.list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 2px 12px 28px;
  scrollbar-width: none;
}
.list::-webkit-scrollbar { display: none; }
.section-title {
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--label);
  padding: 18px 16px 8px;
  letter-spacing: -0.01em;
}

.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 112px;
  padding: 14px 16px 14px 30px;
  border-radius: 18px;
  cursor: default;
  transition: background-color 0.18s var(--ease);
  contain: layout paint;
}
.row:active { background: var(--fill); transition-duration: 0s; }
.row.selected { background: var(--blue); color: #fff; }
.row.selected .row-time, .row.selected .row-preview, .row.selected .row-chev { color: rgba(255, 255, 255, 0.82); }
.row::after {
  content: '';
  position: absolute;
  left: 118px;
  right: 16px;
  bottom: 0;
  height: 1px;
  background: var(--separator);
}
.row.selected::after, .row:has(+ .row.selected)::after, .row:last-child::after { display: none; }
.dot {
  position: absolute;
  left: 9px;
  top: 50%;
  width: 13px;
  height: 13px;
  margin-top: -6.5px;
  border-radius: 50%;
  background: var(--blue);
  transform: scale(0);
  transition: transform 0.25s var(--spring);
}
.row.unread .dot { transform: scale(1); }
.row.selected .dot { background: #fff; }
.row-main { flex: 1; min-width: 0; }
.row-top { display: flex; align-items: baseline; gap: 10px; }
.row-name {
  flex: 1;
  min-width: 0;
  font-size: 1.04rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-time { flex: none; font-size: 0.8rem; color: var(--label-2); font-variant-numeric: tabular-nums; }
.row-chev { flex: none; font-size: 18px; color: var(--label-3); align-self: center; }
.row-preview {
  margin-top: 4px;
  font-size: 0.9rem;
  line-height: 1.3;
  color: var(--label-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.row-preview mark { background: none; color: var(--label); font-weight: 600; }
.row.selected .row-preview mark { color: #fff; }
.list-empty {
  padding: 60px 24px;
  text-align: center;
  color: var(--label-2);
  font-size: 1rem;
  line-height: 1.4;
}
.list-empty strong { display: block; color: var(--label); font-size: 1.15rem; margin-bottom: 6px; }

/* ------------------------------------------------------------------ avatars */

.avatar {
  --size: 68px;
  width: var(--size);
  height: var(--size);
  flex: none;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  background: linear-gradient(180deg, var(--avatar-top), var(--avatar-bottom));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: calc(var(--size) * 0.4);
  letter-spacing: 0.01em;
  line-height: 1;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar svg.i { width: 62%; height: 62%; margin-top: 16%; opacity: 0.95; }
.avatar-group { background: transparent; overflow: visible; }
.avatar.avatar-group > .avatar { position: absolute; --size: calc(var(--gsize) * 0.66); border: 2px solid var(--sidebar); }
.avatar.avatar-group > .avatar:first-child { left: 0; top: 0; }
.avatar.avatar-group > .avatar:last-child { right: 0; bottom: 0; }
.avatar-group { --gsize: var(--size); }
.row.selected .avatar.avatar-group > .avatar { border-color: var(--blue); }

/* ------------------------------------------------------------------ conversation pane */

.pane {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.pane-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--label-2);
  font-size: 1.1rem;
  text-align: center;
  padding: 40px;
}
.pane-empty img { width: 104px; height: 104px; opacity: 0.9; }
.pane-empty strong { color: var(--label); font-size: 1.35rem; font-weight: 650; }

.conv-header {
  position: absolute;
  z-index: 5;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 1px solid var(--separator);
}
.conv-header .avatar { --size: 64px; }
@media (max-height: 760px), (max-width: 1279px) {
  .conv-header { gap: 5px; }
  .conv-header .avatar { --size: 52px; }
}
.conv-header .avatar.avatar-group > .avatar { border-color: var(--bg); }
.conv-name {
  font-size: 0.86rem;
  font-weight: 600;
  max-width: 80%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 4px;
}
.conv-sub { font-size: 0.66rem; color: var(--label-2); margin-top: -4px; }
.header-left {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
}
.text-btn {
  min-height: var(--target);
  min-width: var(--target);
  padding: 0 18px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 1rem;
  font-weight: 500;
  border-radius: 16px;
}
.text-btn:active { background: var(--fill); }

.scroller {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: calc(var(--header-h) + 12px) 0 10px;
  user-select: text;
  -webkit-user-select: text;
}
.thread {
  display: flex;
  flex-direction: column;
  padding: 0 clamp(20px, 3vw, 44px);
  max-width: 1400px;
  margin: 0 auto;
}
.thread-top { height: 1px; }
.loading-older {
  align-self: center;
  margin: 8px 0 18px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid var(--fill-2);
  border-top-color: var(--label-2);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.stamp {
  align-self: center;
  text-align: center;
  font-size: 0.68rem;
  color: var(--label-2);
  margin: 22px 0 10px;
  font-variant-numeric: tabular-nums;
}
.stamp b { font-weight: 600; }
.event {
  align-self: center;
  text-align: center;
  font-size: 0.7rem;
  color: var(--label-2);
  margin: 12px 40px;
  max-width: 80%;
}

.msg {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-top: 3px;
  position: relative;
}
.msg.run-start { margin-top: 14px; }
.msg.me { flex-direction: row-reverse; }
.msg .col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: min(72%, 36em);
  min-width: 0;
  gap: 3px;
  position: relative;
}
.msg.me .col { align-items: flex-end; }
.msg .side { width: 44px; flex: none; }
.msg .side .avatar { --size: 44px; }
.sender-name {
  font-size: 0.66rem;
  color: var(--label-2);
  margin: 0 0 2px 16px;
}
.msg.has-tapback { margin-top: 30px; }
.msg.has-tapback.run-start { margin-top: 36px; }

.bubble {
  position: relative;
  max-width: 100%;
  padding: 0.42em 0.78em 0.46em;
  border-radius: var(--radius-bubble);
  font-size: var(--bubble-font);
  line-height: 1.32;
  letter-spacing: -0.006em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  background: var(--bubble-gray);
  color: var(--on-gray);
}
.msg.me .bubble { background: var(--bubble-blue); color: #fff; }
.msg.me.sms .bubble { background: var(--bubble-green); }
.bubble a { color: inherit; text-decoration: underline; text-underline-offset: 0.12em; text-decoration-thickness: 1.5px; }
.msg:not(.me) .bubble a { color: var(--blue); text-decoration: none; }

/* tails (only on the last bubble of a run): a bubble-colored corner, carved by a
   background-colored rounded box; stays within 10px of the bubble so it never covers avatars */
.bubble.tail::before, .bubble.tail::after {
  content: '';
  position: absolute;
  bottom: 0;
  height: 24px;
}
.msg:not(.me) .bubble.tail::before {
  left: -8px;
  width: 22px;
  background: inherit;
  border-bottom-right-radius: 16px 14px;
}
.msg:not(.me) .bubble.tail::after {
  left: -10px;
  width: 10px;
  background: var(--bg);
  border-bottom-right-radius: 10px;
}
.msg.me .bubble.tail::before {
  right: -8px;
  width: 22px;
  background: inherit;
  border-bottom-left-radius: 16px 14px;
}
.msg.me .bubble.tail::after {
  right: -10px;
  width: 10px;
  background: var(--bg);
  border-bottom-left-radius: 10px;
}

.bubble.jumbo {
  background: transparent !important;
  font-size: 3rem;
  line-height: 1.1;
  padding: 0 0.05em;
}
.bubble.jumbo::before, .bubble.jumbo::after { display: none; }

.msg.pending .bubble { opacity: 0.6; }
.msg.failed .bubble { opacity: 0.75; }
.fail-btn {
  align-self: center;
  width: var(--target);
  height: var(--target);
  border: 0;
  background: transparent;
  color: var(--red);
  font-size: 34px;
  display: grid;
  place-items: center;
  flex: none;
}
.receipt {
  font-size: 0.66rem;
  color: var(--label-2);
  margin: 4px 6px 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.receipt b { font-weight: 600; }
.receipt.error { color: var(--red); font-weight: 500; }
.msg:not(.me) + .receipt { text-align: left; }

/* media */
.media {
  display: block;
  border-radius: 1.1rem;
  overflow: hidden;
  background: var(--fill);
  max-width: min(100%, 440px);
  min-width: 160px;
  min-height: 120px;
  cursor: zoom-in;
  border: 0;
  padding: 0;
  position: relative;
}
.media img {
  display: block;
  max-width: 440px;
  max-height: 460px;
  width: auto;
  height: auto;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}
.media img.loaded { opacity: 1; }
.media.loaded { min-height: 0; min-width: 0; background: transparent; }
.media.broken { display: grid; place-items: center; width: 240px; height: 160px; color: var(--label-2); font-size: 0.8rem; cursor: default; }
.file-chip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px 14px 14px;
  border-radius: 1.1rem;
  background: var(--bubble-gray);
  color: var(--on-gray);
  min-height: 76px;
  max-width: 100%;
}
.file-chip .ficon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: var(--fill-2);
  display: grid;
  place-items: center;
  font-size: 28px;
  color: var(--label-2);
  flex: none;
}
.file-chip .fname { font-size: 0.9rem; font-weight: 600; overflow-wrap: anywhere; }
.file-chip .fmeta { font-size: 0.7rem; color: var(--label-2); margin-top: 2px; }

/* tapbacks */
.tapbacks {
  position: absolute;
  top: -30px;
  display: flex;
  z-index: 1;
  pointer-events: none;
}
.msg:not(.me) .tapbacks { right: -26px; flex-direction: row-reverse; }
.msg.me .tapbacks { left: -26px; }
.tb {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--tapback-gray);
  color: var(--tapback-glyph);
  border: 3px solid var(--bg);
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 800;
  line-height: 0.9;
  position: relative;
}
.tb + .tb { margin-left: -18px; }
.msg:not(.me) .tb + .tb { margin-left: 0; margin-right: -18px; }
.tb.mine { background: var(--bubble-blue); color: #fff; }
.tb .i { width: 22px; height: 22px; }
.tb .ha { font-size: 10px; letter-spacing: 0.02em; text-align: center; transform: rotate(-14deg); }
.tb .em { font-size: 23px; font-weight: 400; }
.tb::after {
  content: '';
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: inherit;
  border: 3px solid var(--bg);
  bottom: -9px;
}
.msg:not(.me) .tb::after { left: 2px; }
.msg.me .tb::after { right: 2px; }
.tb + .tb::after { display: none; }

.highlight .bubble { animation: flash 1.6s var(--ease); }
@keyframes flash {
  0%, 30% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 55%, transparent); }
  100% { box-shadow: 0 0 0 4px transparent; }
}

.msg.enter { animation: pop-in 0.32s var(--spring); transform-origin: bottom right; }
.msg.enter:not(.me) { transform-origin: bottom left; }
@keyframes pop-in {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------ composer */

.composer {
  flex: none;
  padding: 12px clamp(20px, 3vw, 44px) 18px;
  background: var(--bg);
  position: relative;
  z-index: 4;
}
.composer-inner {
  max-width: 1400px;
  margin: 0 auto;
  position: relative;
  display: flex;
  align-items: flex-end;
  border: 1.5px solid var(--separator-strong);
  border-radius: 34px;
  background: var(--bg);
  min-height: 68px;
  transition: border-color 0.2s;
}
.composer textarea {
  flex: 1;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  font-size: var(--bubble-font);
  line-height: 1.32;
  padding: 17px 20px 17px 28px;
  max-height: 11.5em;
  min-height: 65px;
  overflow-y: auto;
  user-select: text;
  -webkit-user-select: text;
}
.composer textarea::placeholder { color: var(--label-3); }
.send {
  flex: none;
  width: 54px;
  height: 54px;
  margin: 6px 6px 6px 0;
  border-radius: 50%;
  border: 0;
  background: var(--bubble-blue);
  color: #fff;
  font-size: 30px;
  display: grid;
  place-items: center;
  transform: scale(0.4);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s var(--spring), opacity 0.18s var(--ease), background-color 0.2s;
}
/* larger invisible hit area */
.send::before { content: ''; position: absolute; inset: -10px; }
.send { position: relative; }
.composer.ready .send { transform: scale(1); opacity: 1; pointer-events: auto; }
.composer.sms .send { background: var(--bubble-green); }
.send:active { transform: scale(0.9) !important; transition-duration: 0.05s; }
.composer-note { text-align: center; font-size: 0.66rem; color: var(--label-2); margin-top: 8px; }

.new-pill {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 14px);
  transform: translate(-50%, 16px) scale(0.9);
  opacity: 0;
  pointer-events: none;
  height: 60px;
  padding: 0 26px 0 22px;
  border-radius: 30px;
  border: 0;
  background: var(--elevated);
  color: var(--blue);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  transition: transform 0.3s var(--spring), opacity 0.2s var(--ease);
}
.new-pill .i { font-size: 22px; }
.new-pill.show { opacity: 1; transform: translate(-50%, 0) scale(1); pointer-events: auto; }

/* ------------------------------------------------------------------ new message */

.to-row {
  position: absolute;
  z-index: 5;
  top: var(--header-h);
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 80px;
  padding: 8px clamp(20px, 3vw, 44px);
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 1px solid var(--separator);
}
.to-label { font-size: 1rem; color: var(--label-2); flex: none; }
.to-row input {
  flex: 1;
  min-width: 0;
  height: 64px;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 1.05rem;
  user-select: text;
  -webkit-user-select: text;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 10px 0 20px;
  border-radius: 26px;
  background: color-mix(in srgb, var(--blue) 14%, transparent);
  color: var(--blue);
  font-size: 1rem;
  font-weight: 500;
  border: 0;
}
.chip .i { font-size: 24px; opacity: 0.7; }
.chip.sms { background: color-mix(in srgb, var(--bubble-green) 16%, transparent); color: color-mix(in srgb, var(--bubble-green) 70%, var(--label)); }
.suggestions {
  position: absolute;
  z-index: 6;
  top: calc(var(--header-h) + 80px);
  left: 0;
  right: 0;
  bottom: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg);
  padding: 8px clamp(8px, 2vw, 30px) 24px;
}
.sugg {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 96px;
  padding: 12px 18px;
  border-radius: 18px;
}
.sugg:active { background: var(--fill); }
.sugg .avatar { --size: 60px; }
.sugg-name { font-size: 1.02rem; font-weight: 600; }
.sugg-handle { font-size: 0.82rem; color: var(--label-2); margin-top: 3px; }
.sugg-handle .lbl { color: var(--label); margin-right: 6px; }
.new-hint { padding: 40px 24px; text-align: center; color: var(--label-2); font-size: 0.95rem; }

/* ------------------------------------------------------------------ overlays */

.banner {
  position: absolute;
  z-index: 20;
  top: calc(var(--header-h) + 14px);
  left: calc(var(--sidebar-w) + (100% - var(--sidebar-w)) / 2);
  transform: translate(-50%, -12px);
  opacity: 0;
  width: max-content;
  max-width: min(calc((100% - var(--sidebar-w)) * 0.9), 760px);
  padding: 16px 24px;
  border-radius: 18px;
  background: var(--elevated);
  box-shadow: var(--shadow);
  font-size: 0.85rem;
  line-height: 1.35;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: transform 0.3s var(--spring), opacity 0.2s;
  pointer-events: none;
}
.banner.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.banner .i { font-size: 28px; color: var(--red); margin-top: 1px; }

.lightbox {
  position: fixed;
  z-index: 100;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: grid;
  place-items: center;
  animation: fade-in 0.2s var(--ease);
  cursor: zoom-out;
}
.lightbox img { max-width: 94vw; max-height: 90vh; object-fit: contain; border-radius: 12px; }
.lightbox .close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 30px;
  display: grid;
  place-items: center;
}

.conn {
  position: absolute;
  z-index: 8;
  left: 50%;
  bottom: 110px;
  left: calc(var(--sidebar-w) + (100% - var(--sidebar-w)) / 2);
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--label-2);
  background: var(--elevated);
  box-shadow: var(--shadow);
  padding: 10px 18px;
  border-radius: 20px;
  white-space: nowrap;
}

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

.is-new .scroller { padding-top: calc(var(--header-h) + 92px); }
.chips { display: flex; gap: 8px; flex: none; }

@media (max-width: 1279px) {
  .row-chev { display: none; }
  .row { gap: 16px; padding-right: 12px; }
  .row::after { left: 112px; }
}

/* ------------------------------------------------------------------ toolbar groups + menu */

.tb-group { display: flex; align-items: center; gap: 4px; }
.tool.menubtn { font-size: 34px; }
.tool.drivebtn { font-size: 40px; }

.menu {
  position: absolute;
  z-index: 40;
  top: 88px;
  left: 18px;
  width: min(520px, calc(100vw - 36px));
  padding: 8px;
  border-radius: 24px;
  background: var(--elevated);
  box-shadow: var(--shadow), 0 0 0 1px var(--separator);
  animation: menu-in 0.22s var(--spring);
  transform-origin: top left;
}
@keyframes menu-in { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: none; } }
.menu-row {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 88px;
  padding: 12px 16px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  text-align: left;
}
.menu-row + .menu-row { border-top: 1px solid var(--separator); border-radius: 0 0 16px 16px; }
button.menu-row:active { background: var(--fill); }
.menu-ic {
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 28px;
  color: #fff;
  background: var(--blue);
}
.menu-row:nth-child(2) .menu-ic { background: #ff9500; }
.menu-row:nth-child(3) .menu-ic { background: #8e8e93; }
.menu-label { flex: 1; min-width: 0; font-size: 1rem; font-weight: 600; }
.menu-label small { display: block; font-size: 0.72rem; font-weight: 400; color: var(--label-2); margin-top: 3px; line-height: 1.3; }
.menu-chev { font-size: 20px; color: var(--label-3); }
.menu-link, .ds-link {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 0.9rem;
  font-weight: 600;
  min-height: 64px;
  padding: 0 14px;
  border-radius: 14px;
  flex: none;
}

/* iOS switch: a real checkbox with a 64px hit area */
.sw { position: relative; display: inline-grid; place-items: center; width: 92px; height: 64px; flex: none; cursor: pointer; }
.sw-input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.sw-track {
  width: 76px;
  height: 44px;
  border-radius: 22px;
  background: var(--fill-2);
  position: relative;
  transition: background-color 0.25s var(--ease);
  pointer-events: none;
}
.sw-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18), 0 1px 1px rgba(0, 0, 0, 0.12);
  transition: transform 0.28s var(--spring);
}
.sw-input:checked + .sw-track { background: var(--bubble-green); }
.sw-input:checked + .sw-track .sw-thumb { transform: translateX(32px); }
.sw-input:focus-visible + .sw-track { box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 50%, transparent); }

/* ------------------------------------------------------------------ dictation in the composer */

.mic {
  flex: none;
  position: relative;
  width: 54px;
  height: 54px;
  margin: 6px 6px 6px 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--label-2);
  font-size: 30px;
  display: grid;
  place-items: center;
  transition: background-color 0.2s var(--ease), color 0.2s, transform 0.12s var(--ease);
}
.mic::before { content: ''; position: absolute; inset: -10px; }
.mic:active { background: var(--fill); transform: scale(0.92); }
.mic .mic-stop { display: none; width: 18px; height: 18px; border-radius: 4px; background: #fff; }
.composer.ready .mic, .composer.no-mic .mic, .composer.recording .mic { display: none; }
.composer.ready .send { display: grid; }
.composer:not(.ready) .send { position: absolute; right: 0; bottom: 0; }
.composer.listening .mic { display: grid; background: var(--red); color: #fff; animation: mic-pulse 1.4s ease-in-out infinite; }
.composer.listening .mic .mic-glyph { display: none; }
.composer.listening .mic .mic-stop { display: block; }
.composer.listening .send { display: none; }
.composer.listening .composer-inner { border-color: var(--blue); box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 22%, transparent); }
.composer.dictated .composer-inner { animation: dictated 0.9s var(--ease); }
@keyframes dictated { 0% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--blue) 40%, transparent); } 100% { box-shadow: 0 0 0 5px transparent; } }
@keyframes mic-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--red) 45%, transparent); } 50% { box-shadow: 0 0 0 10px transparent; } }

.rec-pill {
  position: absolute;
  inset: -1.5px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 6px 6px 8px;
  border-radius: 34px;
  background: var(--bg);
  border: 1.5px solid var(--red);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 16%, transparent);
  animation: fade-in 0.2s var(--ease);
}
.rec-cancel {
  width: 64px;
  height: 54px;
  flex: none;
  border: 0;
  border-radius: 27px;
  background: var(--fill);
  color: var(--label-2);
  font-size: 22px;
  display: grid;
  place-items: center;
}
.rec-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--red); flex: none; animation: blink 1.2s ease-in-out infinite; }
.rec-pill.busy .rec-dot { animation: none; background: var(--label-3); }
@keyframes blink { 50% { opacity: 0.25; } }
.rec-time { font-size: 0.95rem; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 3.2em; color: var(--red); flex: none; white-space: nowrap; }
.rec-pill.busy .rec-time { display: none; }
.rec-wave { flex: 1; min-width: 60px; height: 44px; color: var(--red); display: block; }
.rec-pill.busy .rec-wave { display: none; }
.rec-status:empty { display: none; }
.rec-status { flex: 1; font-size: 0.95rem; color: var(--label-2); display: flex; align-items: center; gap: 12px; }
.rec-pill.busy .rec-status::before {
  content: '';
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 3px solid var(--fill-2);
  border-top-color: var(--label-2);
  animation: spin 0.8s linear infinite;
}
.rec-stop {
  width: 58px;
  height: 58px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--red);
  display: grid;
  place-items: center;
  position: relative;
  transition: transform 0.12s var(--ease), opacity 0.2s;
}
.rec-stop::before { content: ''; position: absolute; inset: -8px; }
.rec-stop .sq { width: 20px; height: 20px; border-radius: 5px; background: #fff; }
.rec-stop:active { transform: scale(0.9); }
.rec-stop:disabled { opacity: 0.35; }

/* ------------------------------------------------------------------ announce banner (full layout) */

.announce {
  position: absolute;
  z-index: 25;
  top: 16px;
  left: 50%;
  transform: translate(-50%, -140%);
  display: flex;
  align-items: center;
  gap: 18px;
  width: min(760px, calc(100vw - 32px));
  min-height: 104px;
  padding: 16px 28px 16px 18px;
  border: 0;
  border-radius: 28px;
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  backdrop-filter: saturate(180%) blur(30px);
  box-shadow: var(--shadow), 0 0 0 1px var(--separator);
  text-align: left;
  transition: transform 0.4s var(--spring);
}
.announce.show { transform: translate(-50%, 0); }
.announce-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.announce-main strong { font-size: 1.05rem; }
.announce-main span { font-size: 0.95rem; color: var(--label-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drive-on .banner { left: 50%; top: 24px; z-index: 60; max-width: min(90vw, 820px); }
