/* Shell: chat list | chat | panel. Below 860px it becomes a stack with the chat sliding in. */

.shell { height: 100dvh; display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr) auto; position: relative; }
.offline-bar { position: absolute; top: 0; left: 0; right: 0; z-index: 50; text-align: center; padding: calc(4px + env(safe-area-inset-top)) 12px 4px; font-size: 13px; font-weight: 600; background: var(--warn); color: #1b1305; }

/* ---- sidebar ---- */
.sidebar { display: flex; flex-direction: column; min-height: 0; background: var(--paper-2); border-right: 1px solid var(--line); }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(16px + env(safe-area-inset-top)) 16px 12px 20px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-text { display: grid; min-width: 0; }
.brand-text strong { font: 800 20px/1.1 var(--f-display); letter-spacing: -.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn { font: 500 11px var(--f-mono); color: var(--ink-3); display: inline-flex; align-items: center; gap: 6px; }
.conn::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }
.conn.online::before { background: var(--ok); }
.conn.offline::before { background: var(--bad); }
.search { margin: 0 14px 10px; display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 40px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-3); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; height: 100%; }
.chat-list { flex: 1; overflow-y: auto; padding: 4px 8px 12px; scrollbar-width: thin; }
.chat-list .list-label { margin: 16px 12px 6px; }
.list-empty { color: var(--ink-3); text-align: center; font-size: 14px; padding: 24px; }
.chat-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; text-align: left; transition: background .12s; animation: fade-in .35s var(--ease) both; }
.chat-item:nth-child(2) { animation-delay: .03s; } .chat-item:nth-child(3) { animation-delay: .06s; } .chat-item:nth-child(4) { animation-delay: .09s; } .chat-item:nth-child(5) { animation-delay: .12s; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } }
.chat-item:hover { background: color-mix(in srgb, var(--surface) 60%, transparent); }
.chat-item.active { background: var(--surface); box-shadow: var(--shadow-1), inset 3px 0 0 var(--accent); }
.chat-item-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.chat-item-top { display: flex; align-items: center; gap: 6px; }
.chat-item-top strong { font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-top time { margin-left: auto; font: 500 11px var(--f-mono); color: var(--ink-3); flex: none; }
.chat-item-bottom { display: flex; align-items: center; gap: 6px; min-width: 0; }
.preview, .typing-text { flex: 1; min-width: 0; font-size: 13.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.typing-text { color: var(--machine); font-weight: 600; }
.chat-item.unread .chat-item-top strong { font-weight: 800; }
.chat-item.unread .preview { color: var(--ink); }
.chat-item.unread time { color: var(--accent); }
.badge { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font: 700 11px/20px var(--f-mono); text-align: center; }
.task-count { flex: none; display: inline-flex; align-items: center; gap: 3px; font: 600 11px var(--f-mono); color: var(--ink-3); padding: 2px 6px; border-radius: 6px; background: var(--surface-3); }
.side-foot { display: flex; align-items: center; gap: 4px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.me { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 12px; text-align: left; }
.me:hover { background: var(--surface); }
.me span { display: grid; min-width: 0; }
.me strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me small { font: 500 11px var(--f-mono); color: var(--ink-3); }

/* ---- chat ---- */
.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative;
  background-color: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px; }
.chat-empty { align-items: center; justify-content: center; gap: 8px; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; background: color-mix(in srgb, var(--paper) 86%, transparent); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); z-index: 5; }
.chat-head .back { display: none; margin-left: -6px; }
.chat-id { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; text-align: left; padding: 4px 6px; border-radius: 12px; }
.chat-id:hover { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.chat-id-text { display: grid; min-width: 0; }
.chat-id-text strong { font: 750 17px/1.2 var(--f-display); letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub .live, .sub b.live { color: var(--ok); font-weight: 600; }
.typing-sub { color: var(--machine); font-weight: 600; }
.chat-actions { display: flex; gap: 4px; }
.head-btn { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 11px; border-radius: 10px; color: var(--ink-2); font-weight: 600; font-size: 13px; }
.head-btn:hover { background: var(--surface); color: var(--ink); }
.head-btn.on { background: var(--ink); color: var(--paper); }
.head-btn .count { position: absolute; top: 3px; left: 23px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font: 700 10px/16px var(--f-mono); text-align: center; }

/* ---- panel ---- */
.panel { width: var(--panel-w); display: flex; flex-direction: column; min-height: 0; background: var(--paper-2); border-left: 1px solid var(--line); animation: slide-in .28s var(--ease); }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
.panel-head { display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 10px 10px 14px; border-bottom: 1px solid var(--line); }
.panel-tabs { flex: 1; display: flex; gap: 4px; }
.panel-tabs button { padding: 8px 12px; border-radius: 10px; font-weight: 650; font-size: 14px; color: var(--ink-2); }
.panel-tabs button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.tab { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.tab > .btn { justify-content: center; }
.task-add { display: grid; gap: 8px; margin-bottom: 10px; }
.task-add-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.task-add-row .btn { grid-column: 1 / -1; justify-content: center; }
.task-list { display: grid; gap: 6px; }
.member { display: flex; align-items: center; gap: 4px; }
.member-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; text-align: left; }
.member-main:hover { background: var(--surface); }
.member-main span { display: grid; min-width: 0; }
.member-main strong { font-size: 14px; }
.member-main small { color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info-hero { display: grid; justify-items: center; text-align: center; gap: 4px; padding: 8px 0 16px; }
.info-hero h3 { margin: 8px 0 0; font: 750 21px var(--f-display); letter-spacing: -.02em; }
.info-hero p { margin: 0; color: var(--ink-2); font: 500 12.5px var(--f-mono); }
.info-about { margin: 0 0 12px; text-align: center; color: var(--ink-2); }
.tab.info .btn { justify-content: center; margin-top: 4px; }
.commands { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 4px; }
.commands li { display: flex; gap: 10px; align-items: baseline; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-size: 13.5px; }
.commands code { font: 600 12.5px var(--f-mono); color: var(--machine); flex: none; }
.commands span { color: var(--ink-2); }

/* ---- modal ---- */
.modal-backdrop { position: fixed; inset: 0; z-index: 800; background: rgb(18 16 12 / .38); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(480px, 100%); max-height: min(86dvh, 760px); display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--line-2); border-radius: 22px; box-shadow: var(--shadow-2); animation: pop .26s var(--ease); overflow: hidden; }
.modal.wide { width: min(640px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 14px 8px 22px; }
.modal-head h2 { margin: 0; font: 800 21px var(--f-display); letter-spacing: -.025em; }
.modal-body { padding: 8px 22px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.modal-body > .btn { align-self: flex-start; }
.modal-body > .btn.wide { align-self: stretch; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--paper-2); }
.pick-list { display: grid; gap: 4px; margin: 4px 0 10px; }
.pick { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 12px; border: 1px solid transparent; cursor: pointer; text-align: left; width: 100%; }
.pick:hover { background: var(--surface); }
.pick.on { background: var(--surface); border-color: var(--accent); }
.pick input { position: absolute; opacity: 0; }
.pick > span { flex: 1; min-width: 0; display: grid; }
.pick strong { font-size: 14.5px; }
.pick small { color: var(--ink-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.copy-box { display: flex; gap: 8px; align-items: center; padding: 8px 8px 8px 12px; border-radius: 12px; background: var(--surface); border: 1px dashed var(--line-2); margin: 8px 0; }
.copy-box code { flex: 1; min-width: 0; font: 500 12px var(--f-mono); overflow-wrap: anywhere; }
.settings-sec { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.settings-sec:last-child { border-bottom: 0; flex-direction: row; flex-wrap: wrap; justify-content: space-between; }
.settings-sec > .btn { align-self: flex-start; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* bots */
.token-reveal { display: grid; gap: 10px; margin-bottom: 8px; }
.warn { display: flex; gap: 8px; align-items: center; margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-weight: 600; font-size: 13.5px; }
.snippet { border-radius: 12px; overflow: hidden; border: 1px solid var(--line-2); background: #181612; color: #efe9dc; }
.snippet-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 4px 4px 12px; font: 600 11.5px var(--f-mono); color: #a7a090; border-bottom: 1px solid rgb(255 255 255 / .08); }
.snippet-head .btn { color: #d8d1c2; }
.snippet pre { margin: 0; padding: 10px 12px; overflow-x: auto; font: 500 12.5px/1.5 var(--f-mono); }
.create-bot, .bot-detail { display: flex; flex-direction: column; gap: 4px; }
.create-bot > .btn, .bot-detail > .btn { align-self: flex-start; }

/* ---- onboarding ---- */
.onboarding { min-height: 100dvh; height: 100dvh; overflow-y: auto; display: grid; grid-template-columns: 1.1fr 1fr; }
.hero { position: relative; padding: clamp(32px, 6vw, 80px); display: flex; flex-direction: column; justify-content: center; gap: 18px; background: var(--ink); color: var(--paper); overflow: hidden; }
.hero::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgb(255 255 255 / .05) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / .05) 1px, transparent 1px); background-size: 36px 36px; mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%); }
.hero::after { content: ''; position: absolute; width: 520px; height: 520px; right: -160px; bottom: -200px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 55%, transparent), transparent 65%); filter: blur(30px); opacity: .55; }
.hero > * { position: relative; z-index: 1; }
.hero .brand-mark i:nth-child(1) { background: var(--paper); }
.hero h1 { margin: 0; font: 800 clamp(48px, 8vw, 104px)/.92 var(--f-display); letter-spacing: -.055em; animation: rise .6s var(--ease) both .05s; }
.hero-lead { margin: 0; font-size: clamp(18px, 2vw, 22px); max-width: 26ch; color: color-mix(in srgb, var(--paper) 80%, transparent); animation: rise .6s var(--ease) both .15s; }
.hero-points { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; max-width: 460px; }
.hero-points li { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid rgb(255 255 255 / .12); font-size: 14.5px; color: color-mix(in srgb, var(--paper) 72%, transparent); animation: rise .6s var(--ease) both; }
.hero-points li:nth-child(1) { animation-delay: .25s; } .hero-points li:nth-child(2) { animation-delay: .32s; } .hero-points li:nth-child(3) { animation-delay: .39s; } .hero-points li:nth-child(4) { animation-delay: .46s; }
.hero-points b { color: var(--paper); font: 600 12px var(--f-mono); letter-spacing: .04em; text-transform: uppercase; padding-top: 2px; }
.onb-side { display: grid; place-items: center; padding: 32px 20px; }
.onb-card { width: min(420px, 100%); display: flex; flex-direction: column; gap: 4px; animation: rise .5s var(--ease) both .2s; }
.onb-card h2 { margin: 0 0 6px; font: 800 30px/1.05 var(--f-display); letter-spacing: -.035em; }
.onb-card > p { margin: 0 0 14px; }
.onb-card .btn.big { margin-top: 8px; }
.eyebrow { font: 600 11.5px var(--f-mono) !important; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin: 0 !important; }
.onb-user { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); margin: 10px 0; }
.onb-user div { display: grid; }
.onb-user small { font-family: var(--f-mono); color: var(--ink-3); }

/* ---- responsive ---- */
@media (max-width: 1180px) {
  .shell.has-panel .panel { position: absolute; top: 0; right: 0; bottom: 0; z-index: 30; box-shadow: var(--shadow-2); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { grid-column: 1; grid-row: 1; }
  .chat { grid-column: 1; grid-row: 1; display: none; }
  .shell.has-chat .sidebar { display: none; }
  .shell.has-chat .chat { display: flex; animation: push .28s var(--ease); }
  @keyframes push { from { transform: translateX(28px); opacity: .4; } }
  .chat-head .back { display: inline-grid; }
  .head-btn .label { display: none; }
  .head-btn .count { left: 22px; }
  .shell.has-panel .panel { position: fixed; inset: 0; width: auto; z-index: 40; animation: sheet .3s var(--ease); }
  @keyframes sheet { from { transform: translateY(24px); opacity: 0; } }
  .modal-backdrop { place-items: end stretch; padding: 0; }
  .modal, .modal.wide { width: 100%; max-height: 92dvh; border-radius: 22px 22px 0 0; animation: sheet .3s var(--ease); }
  .onboarding { grid-template-columns: 1fr; grid-auto-rows: max-content; }
  .hero { padding: 48px 24px 36px; }
  .hero-points li { grid-template-columns: 1fr; gap: 2px; }
}

/* ---- team switcher and sign-in ---- */
.brand-wrap { position: relative; min-width: 0; flex: 1; }
button.brand { text-align: left; padding: 4px 8px 4px 4px; margin-left: -4px; border-radius: 12px; max-width: 100%; }
button.brand:hover { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.brand-text strong { display: inline-flex; align-items: center; gap: 4px; }
.brand-text strong .icon { flex: none; color: var(--ink-3); }
.team-menu-backdrop { position: fixed; inset: 0; z-index: 600; }
.team-menu { position: absolute; top: calc(68px + env(safe-area-inset-top)); left: 12px; width: min(300px, calc(100vw - 24px)); padding: 6px; display: grid; gap: 2px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow-2); animation: pop .18s var(--ease); }
.team-menu-head { font: 600 11px var(--f-mono); color: var(--ink-3); padding: 8px 10px 6px; overflow: hidden; text-overflow: ellipsis; }
.team-menu button { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; font-weight: 600; text-align: left; }
.team-menu button:hover { background: var(--surface-3); }
.team-menu button.on { background: var(--surface-2); }
.btn.google { background: var(--surface); color: var(--ink); border-color: var(--line-2); box-shadow: var(--shadow-1); gap: 12px; }
.btn.google:hover:not(:disabled) { border-color: var(--ink-3); }
.google-wrap { display: grid; gap: 8px; margin: 6px 0 10px; }
.dev-login { margin: 8px 0 12px; padding: 12px; border: 1px dashed var(--line-2); border-radius: 14px; display: grid; gap: 8px; }
.dev-login .row { flex-wrap: nowrap; }
.onb-card form { display: flex; flex-direction: column; gap: 4px; }
.onb-card .pick-list { margin-bottom: 0; }
.confirm-layer { z-index: 850; }
.modal.confirm { width: min(380px, 100%); }
.confirm-text { margin: 8px 0 4px; font: 650 17px/1.35 var(--f-display); }
@media (max-width: 860px) { .confirm-layer { place-items: center; padding: 16px; } .modal.confirm { border-radius: 22px; } }
/* Avatars inside pick rows keep their size; only the text column grows. */
.pick > .avatar { flex: none; display: inline-grid; }
.invite-cta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px dashed var(--line-2); margin-bottom: 6px; }
.invite-cta > div { flex: 1; min-width: 180px; display: grid; gap: 2px; }
.invite-cta small { color: var(--ink-2); font-size: 12.5px; }
.phone-login { display: grid; gap: 4px; padding: 12px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--surface); margin-bottom: 10px; }
.row.nowrap { flex-wrap: nowrap; }
.row.end { justify-content: flex-end; margin-top: 8px; }
.contact-invite { display: grid; gap: 8px; }
.contact-invite > .btn { justify-self: start; }
.pending-list { display: grid; gap: 4px; }
.pending { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font: 500 13.5px var(--f-mono); color: var(--ink-2); }
.steps-simple { margin: 2px 0 6px; padding-left: 20px; display: grid; gap: 4px; color: var(--ink-2); font-size: 14px; }
.guide-preview summary { cursor: pointer; font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.guide-preview pre { white-space: pre-wrap; font: 500 12px/1.5 var(--f-mono); background: #181612; color: #efe9dc; padding: 12px; border-radius: 12px; margin: 8px 0 0; }
.consent-list { list-style: none; padding: 0; margin: 4px 0 10px; display: grid; gap: 8px; }
.consent-list li { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; }
.consent-list .icon { color: var(--machine); }
.connect-howto { margin: 8px 0; padding-left: 18px; display: grid; gap: 6px; font-size: 13px; color: var(--ink-2); }
.connect-howto code { font: 500 11.5px var(--f-mono); word-break: break-all; }
/* guests and invite scope */
.guest-tag { display: inline-block; font: 700 9.5px/1 var(--f-mono); letter-spacing: .08em; padding: 3px 5px 2px; border-radius: 4px; color: var(--warn); background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); vertical-align: 2px; }
.list-label.guest-label { color: var(--warn); }
.scope-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.scope-card { display: grid; gap: 4px; justify-items: start; text-align: left; padding: 14px; border-radius: 14px; border: 2px solid var(--line-2); background: var(--surface); transition: border-color .15s, background .15s; }
.scope-card .icon { color: var(--ink-3); }
.scope-card strong { font: 700 15px/1.25 var(--f-display); }
.scope-card small { color: var(--ink-2); font-size: 12.5px; line-height: 1.35; }
.scope-card.on { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 7%, var(--surface)); }
.scope-card.on .icon { color: var(--ok); }
.scope-card.chat.on { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 9%, var(--surface)); }
.scope-card.chat.on .icon { color: var(--warn); }
.big-warning { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; margin-bottom: 12px; border-radius: 16px; border: 2px solid var(--warn); background: color-mix(in srgb, var(--warn) 12%, var(--surface)); animation: pop .25s var(--ease); }
.big-warning-mark { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--warn); color: #1b1305; font: 900 28px/1 var(--f-display); }
.big-warning strong { display: block; font: 750 16px/1.3 var(--f-display); margin-bottom: 4px; }
.big-warning p { margin: 0 0 8px; color: var(--ink-2); font-size: 13.5px; }
.scope-pill { font: 700 10px var(--f-mono); letter-spacing: .05em; text-transform: uppercase; padding: 3px 7px 2px; border-radius: 5px; background: var(--ok-soft); color: var(--ok); }
.scope-pill.chat { background: var(--warn-soft); color: var(--warn); }
@media (max-width: 560px) { .scope-choice { grid-template-columns: 1fr; } }

/* Phone field: country button with flag and prefix, then the national number. */
.phone-input { position: relative; display: flex; flex: 1; min-width: 0; align-items: stretch; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); }
.phone-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.phone-input .input { flex: 1; min-width: 0; border: 0; box-shadow: none !important; background: transparent; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.cc-btn { display: flex; align-items: center; gap: 7px; flex: none; padding: 0 10px 0 11px; border: 0; border-right: 1px solid var(--line); border-radius: 10px 0 0 10px; background: transparent; color: var(--ink); font: 600 14px var(--f-mono); cursor: pointer; }
.cc-btn:disabled { cursor: default; }
.cc-btn:not(:disabled):hover { background: var(--surface-2); }
.flag { width: 22px; height: 16px; flex: none; border-radius: 3px; object-fit: cover; box-shadow: 0 0 0 1px rgb(0 0 0 / .14); }
.cc-caret { width: 6px; height: 6px; margin-left: 1px; border-right: 1.6px solid var(--ink-3); border-bottom: 1.6px solid var(--ink-3); transform: translateY(-2px) rotate(45deg); transition: transform .15s; }
.phone-input.open .cc-caret { transform: translateY(1px) rotate(-135deg); }
.cc-menu { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; min-width: 250px; max-height: 300px; overflow: auto; margin: 0; padding: 5px; list-style: none; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow-2); animation: pop .14s ease-out; }
.cc-option { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font: 500 14px var(--f-body); text-align: left; cursor: pointer; }
.cc-option:hover, .cc-option:focus-visible { background: var(--surface-2); outline: none; }
.cc-option.on { font-weight: 650; }
.cc-option svg { color: var(--accent); }
.cc-code { font: 600 13px var(--f-mono); color: var(--ink-2); }
.cc-btn .cc-code { color: var(--ink); }
.phone-login .field { margin: 0; }
.phone-login .hint { margin: 2px 0 0; }

/* Invites: e-mail and phone each get their own field. */
.invite-fields { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.invite-fields .field { margin: 0; }
.invite-fields .row.nowrap { align-items: stretch; }
.invite-or { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font: 600 11px var(--f-mono); text-transform: uppercase; letter-spacing: .08em; }
.invite-or::before, .invite-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* Switching teams swipes the whole screen like a vertical feed (account.js, switchTeam). */
html[data-swipe]::view-transition-old(root),
html[data-swipe]::view-transition-new(root) { animation: .52s cubic-bezier(.72, 0, .18, 1) both; mix-blend-mode: normal; }
html[data-swipe]::view-transition-new(root) { box-shadow: 0 0 0 1px var(--line), 0 0 48px rgb(0 0 0 / .2); }
html[data-swipe="next"]::view-transition-old(root) { animation-name: swipe-out-up; }
html[data-swipe="next"]::view-transition-new(root) { animation-name: swipe-in-up; }
html[data-swipe="prev"]::view-transition-old(root) { animation-name: swipe-out-down; }
html[data-swipe="prev"]::view-transition-new(root) { animation-name: swipe-in-down; }
@keyframes swipe-out-up { to { transform: translateY(-100%); } }
@keyframes swipe-in-up { from { transform: translateY(100%); } }
@keyframes swipe-out-down { to { transform: translateY(100%); } }
@keyframes swipe-in-down { from { transform: translateY(-100%); } }

/* Context menu: right-click, long press or the ⋯ button (Menu.js). */
.ctx-menu { position: fixed; z-index: 90; min-width: 220px; max-width: min(320px, calc(100vw - 16px)); padding: 5px; display: grid; gap: 1px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 13px; box-shadow: var(--shadow-2); animation: pop .12s ease-out; }
.ctx-menu button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink); font: 500 14px var(--f-body); text-align: left; }
.ctx-menu button:hover, .ctx-menu button:focus-visible { background: var(--surface-2); outline: none; }
.ctx-menu button svg { color: var(--ink-2); flex: none; }
.ctx-menu button.danger, .ctx-menu button.danger svg { color: var(--bad); }
.ctx-menu button:disabled { opacity: .45; }
.ctx-gap { width: 16px; flex: none; }
.ctx-sep { height: 1px; margin: 4px 6px; background: var(--line); }

/* Chat rows: the ⋯ button shows on hover or keyboard focus; touch screens use a long press. */
.chat-row { position: relative; }
.chat-row .chat-item { -webkit-touch-callout: none; user-select: none; }
.row-more { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); opacity: 0; pointer-events: none; background: var(--surface); box-shadow: 0 0 0 1px var(--line); transition: opacity .12s; }
.chat-row:hover .row-more, .chat-row:focus-within .row-more { opacity: 1; pointer-events: auto; }
@media (hover: none) { .row-more { display: none; } }

/* Pulling past the end of the chat list switches team (TeamPull.js). */
.chat-list { overscroll-behavior-y: contain; }
.team-pull { position: relative; overflow: hidden; width: calc(100% - 8px); margin: 12px 4px 4px; padding: 10px 12px; display: flex; align-items: center; gap: 8px; border: 1px dashed var(--line-2); border-radius: 12px; color: var(--ink-3); font: 600 11.5px var(--f-mono); text-align: left; }
.team-pull::before { content: ''; position: absolute; inset: 0; background: var(--accent-soft); transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform .09s linear; }
.team-pull > * { position: relative; }
.team-pull b { margin-left: auto; color: var(--ink-2); font: 650 13px var(--f-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-pull:hover, .team-pull.on { color: var(--ink); border-style: solid; border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.team-pull.on b { color: var(--ink); }
.team-pull.top { position: sticky; top: 0; z-index: 2; margin: 0 4px 8px; background: var(--paper); }
