/* Text inbox. iOS Messages feel: system font, grouped greys, one accent from brand.css. */
:root {
  --bg: #FFFFFF;
  --bg-grouped: #F2F2F7;
  --cell: #FFFFFF;
  --label: #000000;
  --label-2: rgba(60, 60, 67, .6);
  --label-3: rgba(60, 60, 67, .3);
  --sep: rgba(60, 60, 67, .29);
  --fill: rgba(118, 118, 128, .12);
  --bubble-in: #E9E9EB;
  --bubble-in-text: #000000;
  --bar: rgba(249, 249, 249, .86);
  --red: #FF3B30;
  --green: #34C759;
  --spring: cubic-bezier(.32, .72, 0, 1);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-grouped: #000000;
    --cell: #1C1C1E;
    --label: #FFFFFF;
    --label-2: rgba(235, 235, 245, .6);
    --label-3: rgba(235, 235, 245, .3);
    --sep: rgba(84, 84, 88, .65);
    --fill: rgba(118, 118, 128, .24);
    --bubble-in: #262629;
    --bubble-in-text: #FFFFFF;
    --bar: rgba(22, 22, 23, .86);
    --red: #FF453A;
    --green: #30D158;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--label);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 17px; line-height: 1.29; letter-spacing: -.41px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; }
a { color: var(--accent-link); }
.hidden { display: none !important; }
svg.i { width: 1em; height: 1em; display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

#app { min-height: 100%; }
.screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------- nav bar ---------- */
.nav {
  position: sticky; top: 0; z-index: 10;
  padding-top: env(safe-area-inset-top);
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.nav.edge { box-shadow: 0 .5px 0 var(--sep); }
.nav-row { height: 44px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 8px; }
.nav-row > :first-child { justify-self: start; }
.nav-row > :last-child { justify-self: end; }
.nav-title { font-weight: 600; font-size: 17px; opacity: 0; transition: opacity .2s ease; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }
.nav.edge .nav-title, .nav-title.always { opacity: 1; }
.nav-btn { color: var(--accent-link); font-size: 17px; height: 44px; min-width: 44px; display: inline-flex; align-items: center; gap: 2px; padding: 0 8px; }
.nav-btn svg.i { width: 24px; height: 24px; }
.nav-btn.back svg.i { width: 22px; height: 22px; stroke-width: 2.6; margin-left: -6px; }
.nav-btn.strong { font-weight: 600; }
.nav-btn:active { opacity: .4; }

.large-title { font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: .37px; padding: 2px 16px 8px; margin: 0; }

/* ---------- search ---------- */
.search { margin: 0 16px 10px; height: 36px; border-radius: 10px; background: var(--fill); display: flex; align-items: center; gap: 6px; padding: 0 8px; color: var(--label-2); }
.search svg.i { width: 17px; height: 17px; flex: none; }
.search input { flex: 1; border: 0; background: none; outline: none; font-size: 17px; color: var(--label); min-width: 0; }
.search input::placeholder { color: var(--label-2); }

/* ---------- banners ---------- */
.banner { margin: 4px 16px 12px; padding: 14px 16px; border-radius: 14px; background: var(--bg-grouped); display: flex; gap: 12px; align-items: center; }
@media (prefers-color-scheme: dark) { .banner { background: var(--cell); } }
.banner .b-text { flex: 1; font-size: 15px; line-height: 20px; color: var(--label-2); }
.banner .b-text b { display: block; color: var(--label); font-weight: 600; }
.pill-btn { background: var(--accent); color: var(--accent-text); font-weight: 600; font-size: 15px; height: 32px; padding: 0 14px; border-radius: 16px; flex: none; }
.pill-btn:active { opacity: .7; }

/* ---------- thread list ---------- */
.list { flex: 1; }
.row { display: flex; align-items: stretch; gap: 0; padding-left: 4px; width: 100%; text-align: left; position: relative; }
.row:active { background: var(--fill); }
.row .dot { width: 24px; flex: none; display: flex; align-items: center; justify-content: center; }
.row .dot i { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); display: none; }
@media (prefers-color-scheme: dark) { .row .dot i { background: var(--accent-link); } }
.row.unread .dot i { display: block; }
.avatar { width: 44px; height: 44px; border-radius: 50%; flex: none; align-self: center; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #A5ABB8, #858994); color: #fff; font-weight: 600; font-size: 18px; letter-spacing: 0; }
.avatar svg { width: 26px; height: 26px; fill: rgba(255, 255, 255, .95); stroke: none; }
.row .main { flex: 1; min-width: 0; margin-left: 12px; padding: 10px 16px 11px 0; box-shadow: 0 .5px 0 var(--sep); }
.row:last-child .main { box-shadow: none; }
.row .top { display: flex; align-items: baseline; gap: 8px; }
.row .name { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .time { color: var(--label-2); font-size: 15px; display: flex; align-items: center; gap: 4px; flex: none; }
.row .time svg.i { width: 14px; height: 14px; stroke-width: 2.4; color: var(--label-3); }
.row .preview { color: var(--label-2); font-size: 15px; line-height: 20px; letter-spacing: -.24px; margin-top: 1px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.row .tag { font-size: 12px; color: var(--label-2); border: 1px solid var(--sep); border-radius: 6px; padding: 0 5px; margin-right: 5px; font-weight: 500; letter-spacing: 0; }

.empty { text-align: center; color: var(--label-2); padding: 80px 32px; font-size: 15px; line-height: 20px; }
.empty b { display: block; color: var(--label); font-size: 20px; font-weight: 600; margin-bottom: 6px; }

/* ---------- thread ---------- */
.thread-head { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 2px 0 6px; }
.thread-head .avatar { width: 50px; height: 50px; font-size: 20px; }
.thread-head .avatar svg { width: 30px; height: 30px; }
.thread-head .who { font-size: 11px; color: var(--label); display: flex; align-items: center; gap: 1px; letter-spacing: .07px; max-width: 70vw; }
.thread-head .who span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-head .who svg.i { width: 10px; height: 10px; stroke-width: 3; color: var(--label-3); flex: none; }
.thread .nav-row { height: auto; min-height: 44px; align-items: start; }
.thread .nav-row .nav-btn { margin-top: 4px; }

.bubbles { flex: 1; padding: 8px 12px 12px; display: flex; flex-direction: column; }
.stamp { text-align: center; font-size: 11px; color: var(--label-2); margin: 14px 0 6px; letter-spacing: .07px; }
.stamp b { font-weight: 600; }
.line-note { text-align: center; font-size: 11px; color: var(--label-2); margin: 10px 0 4px; letter-spacing: .07px; }
.b { max-width: 76%; padding: 7px 12px 8px; border-radius: 18px; margin-top: 8px; font-size: 17px; line-height: 22px; white-space: pre-wrap; word-break: break-word; }
.b.in { align-self: flex-start; background: var(--bubble-in); color: var(--bubble-in-text); }
.b.out { align-self: flex-end; background: var(--accent); color: var(--accent-text); }
.b.cont { margin-top: 2px; }
.b.in.cont-next { border-bottom-left-radius: 6px; }
.b.in.cont { border-top-left-radius: 6px; }
.b.out.cont-next { border-bottom-right-radius: 6px; }
.b.out.cont { border-top-right-radius: 6px; }
.b a { color: inherit; text-decoration: underline; }
.b.photo-only { padding: 0; background: none; }
.b img { display: block; max-width: 100%; width: 240px; border-radius: 16px; margin: 0 0 4px; background: var(--fill); min-height: 120px; object-fit: cover; }
.b.photo-only img { margin: 0; }
.b .file { display: inline-block; text-decoration: underline; }
.status { align-self: flex-end; font-size: 11px; color: var(--label-2); margin: 3px 4px 0; font-weight: 500; }
.status.fail { color: var(--red); }

.composer {
  position: sticky; bottom: 0; z-index: 5;
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  display: flex; align-items: flex-end; gap: 8px;
}
.line-pick { height: 34px; padding: 0 10px; border-radius: 17px; background: var(--fill); color: var(--label); font-size: 13px; font-weight: 600; letter-spacing: 0; flex: none; display: inline-flex; align-items: center; gap: 3px; }
.line-pick svg.i { width: 11px; height: 11px; stroke-width: 3; color: var(--label-2); }
.field { flex: 1; min-height: 34px; border: 1px solid var(--sep); border-radius: 18px; display: flex; align-items: flex-end; padding: 0 3px 0 12px; background: var(--bg); }
.field textarea { flex: 1; border: 0; outline: none; background: none; resize: none; font-size: 17px; line-height: 22px; padding: 5px 0; max-height: 132px; min-width: 0; }
.field textarea::placeholder { color: var(--label-3); }
.send { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-text); margin: 2px 0 2px 6px; display: flex; align-items: center; justify-content: center; flex: none; transition: opacity .15s ease, transform .12s ease; }
.send svg.i { width: 16px; height: 16px; stroke-width: 2.8; }
.send:disabled { opacity: .3; }
.send:not(:disabled):active { transform: scale(.9); }

/* ---------- new message ---------- */
.to-row { display: flex; align-items: center; gap: 8px; padding: 0 16px; min-height: 44px; box-shadow: 0 .5px 0 var(--sep); }
.to-row label { color: var(--label-2); flex: none; }
.to-row input { flex: 1; border: 0; background: none; outline: none; font-size: 17px; min-width: 0; padding: 10px 0; }
.seg { display: inline-flex; padding: 2px; border-radius: 9px; background: var(--fill); }
.seg button { font-size: 13px; font-weight: 500; letter-spacing: 0; padding: 5px 12px; border-radius: 7px; color: var(--label); }
.seg button.on { background: var(--cell); box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04); font-weight: 600; }
@media (prefers-color-scheme: dark) { .seg button.on { background: #636366; } }
.hint { color: var(--label-2); font-size: 13px; padding: 8px 16px; line-height: 18px; }

/* ---------- sign in ---------- */
.gate { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: calc(40px + env(safe-area-inset-top)) 28px calc(28px + env(safe-area-inset-bottom)); }
.gate .icon { width: 96px; height: 96px; border-radius: 22px; box-shadow: 0 8px 24px rgba(0, 0, 0, .14); margin-bottom: 22px; }
.gate h1 { font-size: 28px; line-height: 34px; font-weight: 700; margin: 0 0 8px; letter-spacing: .36px; }
.gate p { color: var(--label-2); margin: 0 0 30px; max-width: 320px; font-size: 17px; line-height: 22px; }
.gate .spacer { flex: 1; }
.big-btn { width: 100%; max-width: 360px; height: 50px; border-radius: 14px; background: var(--accent); color: var(--accent-text); font-weight: 600; font-size: 17px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.big-btn svg.i { width: 22px; height: 22px; }
.big-btn:active { opacity: .75; }
.big-btn:disabled { opacity: .5; }
.gate .small { font-size: 13px; color: var(--label-2); margin-top: 14px; line-height: 18px; max-width: 320px; }
.gate .err { color: var(--red); font-size: 15px; margin-top: 14px; min-height: 20px; max-width: 320px; }
.steps { text-align: left; width: 100%; max-width: 340px; margin: 0 0 26px; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: center; padding: 10px 0; font-size: 17px; }
.steps li::before { content: counter(s); width: 28px; height: 28px; border-radius: 50%; background: var(--fill); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 15px; flex: none; }
.steps svg.i { display: inline-block; vertical-align: -3px; width: 20px; height: 20px; color: var(--accent-link); }

/* ---------- sheets and alerts ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s ease; }
.scrim.center { align-items: center; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(100%); } }
@keyframes pop { from { transform: scale(1.15); opacity: 0; } }
.sheet { background: var(--bg-grouped); width: 100%; max-width: 640px; border-radius: 12px 12px 0 0; max-height: 92vh; overflow: auto; padding-bottom: calc(24px + env(safe-area-inset-bottom)); animation: rise .35s var(--spring); }
@media (prefers-color-scheme: dark) { .sheet { background: #1C1C1E; } .sheet .group { background: #2C2C2E; } }
.sheet .nav-row { position: sticky; top: 0; background: inherit; }
.group-title { font-size: 13px; color: var(--label-2); text-transform: uppercase; letter-spacing: -.08px; padding: 22px 32px 7px; }
.group { margin: 0 16px; background: var(--cell); border-radius: 10px; overflow: hidden; }
.cell { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 11px 16px; position: relative; width: 100%; text-align: left; }
.cell + .cell::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: .5px; background: var(--sep); }
.cell .c-main { flex: 1; min-width: 0; }
.cell .c-sub { color: var(--label-2); font-size: 15px; }
.cell.btn { color: var(--accent-link); }
.cell.btn:active { background: var(--fill); }
.cell.danger { color: var(--red); justify-content: center; }
.group-foot { font-size: 13px; color: var(--label-2); padding: 7px 32px 0; line-height: 18px; }

.alert { width: 270px; border-radius: 14px; background: rgba(242, 242, 242, .94); -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px); text-align: center; overflow: hidden; animation: pop .25s var(--spring); }
@media (prefers-color-scheme: dark) { .alert { background: rgba(37, 37, 37, .94); } }
.alert h3 { font-size: 17px; font-weight: 600; margin: 19px 16px 2px; }
.alert p { font-size: 13px; line-height: 18px; margin: 0 16px 14px; }
.alert input { width: calc(100% - 32px); margin: 0 16px 16px; height: 28px; border-radius: 6px; border: .5px solid var(--sep); padding: 0 6px; font-size: 13px; background: var(--bg); outline: none; }
.alert .acts { display: flex; box-shadow: 0 -.5px 0 var(--sep); }
.alert .acts button { flex: 1; height: 44px; color: var(--accent-link); font-size: 17px; }
.alert .acts button + button { box-shadow: -.5px 0 0 var(--sep); font-weight: 600; }
.action-sheet { width: calc(100% - 16px); max-width: 420px; margin-bottom: calc(8px + env(safe-area-inset-bottom)); animation: rise .35s var(--spring); }
.action-sheet .grp { border-radius: 14px; overflow: hidden; background: rgba(242, 242, 242, .94); -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px); margin-top: 8px; }
@media (prefers-color-scheme: dark) { .action-sheet .grp { background: rgba(44, 44, 46, .94); } }
.action-sheet button { display: block; width: 100%; height: 57px; font-size: 20px; color: var(--accent-link); letter-spacing: .38px; }
.action-sheet button + button { box-shadow: 0 -.5px 0 var(--sep); }
.action-sheet .cap { font-size: 13px; color: var(--label-2); padding: 14px 16px; box-shadow: 0 .5px 0 var(--sep); }
.action-sheet .cancel { font-weight: 600; }

.viewer { position: fixed; inset: 0; background: #000; z-index: 60; display: flex; align-items: center; justify-content: center; animation: fade .2s ease; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer .nav-btn { position: absolute; top: env(safe-area-inset-top); right: 8px; color: #fff; }

.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: rgba(0, 0, 0, .78); color: #fff; font-size: 15px; padding: 10px 16px; border-radius: 12px; z-index: 70; max-width: 86vw; text-align: center; animation: fade .2s ease; }

@media (min-width: 700px) {
  .screen { max-width: 680px; margin: 0 auto; box-shadow: 0 0 0 .5px var(--sep); }
}

/* screens that own the whole visible area (thread, new message) so the keyboard never hides the composer */
.screen.fixed { position: fixed; left: 0; right: 0; top: var(--vvt, 0px); height: var(--vvh, 100dvh); min-height: 0; margin: 0 auto; }
.screen.fixed .nav { position: relative; flex: none; }
.screen.fixed .bubbles { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.screen.fixed .composer { position: relative; flex: none; }
.thread-head { justify-self: center; }
.thread-head:active { opacity: .6; }
.nav-spacer { width: 44px; } .nav-spacer.wide { width: 60px; }
