/* THE STAFF — Apple Messages, in ARZU's colours. Her ruling, 27 Sep: "like Apple Messages, similar to Grok Bot,
 * each business a folder, the head at folder level, ARZU colours and proper branding."
 * ARZU's type laws: no px font sizes; one control scales everything; nothing under .82rem. */
:root {
  --scale: 1;
  font-size: calc(clamp(17px, 0.42vw + 15.2px, 22px) * var(--scale));
  --ink: #0B0B10; --ink-1: #101018; --ink-2: #16161f; --ink-3: #1e1e2a; --line: #262633; --line-soft: #1c1c26;
  --text: #EDEDF2; --text-2: #A9A9BC; --text-3: #77778C;
  --irid-a: #7B3FE4; --irid-b: #1F4FE0; --irid-c: #35E0FF; --live: #2BFF88; --warn: #FFB020; --danger: #FF5470;
  --sweep: linear-gradient(100deg, var(--irid-a), var(--irid-b) 55%, var(--irid-c));
  --bubble-them: #26262f; --bubble-me: linear-gradient(135deg, #1F4FE0, #7B3FE4);
  --s1: .35rem; --s2: .6rem; --s3: .9rem; --s4: 1.3rem; --s5: 1.9rem;
  --r-sm: .6rem; --r: 1rem; --r-lg: 1.5rem; --rail: clamp(20rem, 30vw, 30rem);
}
:root[data-scale="large"] { --scale: 1.14; } :root[data-scale="largest"] { --scale: 1.3; }
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: var(--ink); color: var(--text); font-family: Inter, -apple-system, system-ui, "Segoe UI", sans-serif; font-size: 1rem; line-height: 1.45; -webkit-font-smoothing: antialiased; overflow: hidden; }
body::before { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(80rem 50rem at 12% -10%, rgba(123,63,228,.18), transparent 60%), radial-gradient(60rem 44rem at 92% 8%, rgba(31,79,224,.14), transparent 62%); }
h1, h2, h3 { font-family: Sora, Inter, sans-serif; font-weight: 600; line-height: 1.15; letter-spacing: -.015em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--ink-2); border-radius: 999px; padding: .5rem .9rem; min-height: 2.6rem; }
button.primary { background: var(--sweep); border-color: transparent; color: #fff; font-weight: 600; }
button.ghost { background: transparent; border-color: transparent; }
button.round { width: 2.6rem; height: 2.6rem; padding: 0; display: grid; place-items: center; }
button:disabled { opacity: .45; cursor: default; }
input, select, textarea { background: var(--ink-1); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .6rem .8rem; min-height: 2.6rem; width: 100%; }
.muted { color: var(--text-2); } .quiet { color: var(--text-3); }
.pill { display: inline-block; padding: .12rem .6rem; border-radius: 999px; border: 1px solid var(--line); font-size: .85rem; color: var(--text-2); background: var(--ink-2); }
.pill.live { color: var(--live); border-color: rgba(43,255,136,.35); } .pill.warn { color: var(--warn); border-color: rgba(255,176,32,.35); } .pill.bad { color: var(--danger); border-color: rgba(255,84,112,.35); }
.toasts { position: fixed; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: .5rem; z-index: 50; width: min(92vw, 34rem); }
.toast { background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--r); padding: .8rem 1rem; box-shadow: 0 1.2rem 3rem -1rem rgba(0,0,0,.65); }
.toast.good { border-color: rgba(43,255,136,.5); } .toast.bad { border-color: rgba(255,84,112,.5); }

/* ---- avatars: the blob glyphs, in each business's colour ---- */
.av { width: 2.7rem; height: 2.7rem; border-radius: 50%; display: grid; place-items: center; font-family: Sora, sans-serif; font-weight: 700; font-size: .95rem; color: #fff; flex: none; background: var(--ink-3); position: relative; overflow: hidden; }
.av::after { content: ''; position: absolute; inset: 0; background: radial-gradient(60% 60% at 30% 25%, rgba(255,255,255,.28), transparent 70%); }
.av.chief { background: var(--sweep); width: 3.6rem; height: 3.6rem; font-size: 1.2rem; }
.av.chief.sm { width: 1.6rem; height: 1.6rem; font-size: .6rem; }
.av.big { width: 4.6rem; height: 4.6rem; font-size: 1.5rem; border-radius: 1.4rem; }
.av.sm { width: 1.6rem; height: 1.6rem; font-size: .6rem; }
.av .e { font-size: 1.3em; position: relative; z-index: 1; }
.av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.brand { display: flex; align-items: center; gap: .5rem; font-family: Sora, sans-serif; font-weight: 700; letter-spacing: .06em; font-size: 1rem; }
.brand img.m { width: 1.6rem; height: 1.9rem; object-fit: contain; }
.brand img.w { height: 1.6rem; width: auto; max-width: 8rem; object-fit: contain; image-rendering: auto; }   /* the wordmark lockup image — its own ratio, never stretched */
.look { display: grid; grid-template-columns: auto 1fr; gap: .8rem; align-items: center; }
.look .opts { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.look input[type=text] { width: 5.5rem; text-align: center; font-size: 1.3rem; }
.look input[type=color] { width: 2.6rem; height: 2.6rem; padding: .2rem; border-radius: 50%; }
.look .up { position: relative; overflow: hidden; }
.look .up input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.signin .brand { justify-content: center; font-size: 1.4rem; } .signin .brand img.m { width: 2.6rem; height: 3rem; } .signin .brand img.w { height: 3rem; max-width: 14rem; }

/* ---- shell ---- */
.app { height: 100%; display: grid; grid-template-columns: var(--rail) 1fr; }
.rail { border-right: 1px solid var(--line-soft); background: rgba(16,16,24,.92); display: flex; flex-direction: column; min-height: 0; position: relative; }
/* 29 Sep 2026 (Mia): the list resizes by its edge and hides, on desktop, remembered per device; the phone layout is untouched */
.rail-resize { position: absolute; top: 0; right: -4px; width: 8px; height: 100%; cursor: col-resize; z-index: 3; }
.rail-resize::after { content: ''; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px; background: var(--irid-c); opacity: 0; transition: opacity .15s; }
.rail-resize:hover::after, .rail-resize.on::after, .rail-resize:focus-visible::after { opacity: .9; }
.rail-resize:focus-visible { outline: none; }
.rail-open { display: none; }
@media (min-width: 861px) {
  .app.rail-shut { grid-template-columns: 1fr; }
  .app.rail-shut .rail { display: none; }
  .app.rail-shut .rail-open { display: inline-grid; }
}
@media (max-width: 860px) { .rail-resize, .rail-shut, .rail-open { display: none !important; } }
.rail .tools { display: flex; justify-content: space-between; align-items: center; gap: .4rem; padding: calc(var(--s2) + env(safe-area-inset-top)) var(--s3) 0; }
.rail .me { display: grid; justify-items: center; gap: .35rem; padding: var(--s2) var(--s3) var(--s3); text-align: center; }
.rail .me .av { display: grid; }
.rail .me .name { font-weight: 600; font-size: .95rem; }
.rail .list { overflow: auto; flex: 1; padding: 0 var(--s2) var(--s2); }
.convo { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .8rem; align-items: center; width: 100%; text-align: left; padding: .6rem .7rem; border: 0; background: transparent; border-radius: .9rem; min-height: 3.6rem; }
.convo:hover { background: var(--ink-2); } .convo.on { background: var(--ink-3); }
.convo .t { min-width: 0; display: grid; gap: .1rem; }
.convo .line { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.convo .line > .n, .convo .line > .p { flex: 1; min-width: 0; }
.convo .n { font-weight: 600; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo .p { color: var(--text-2); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo .p.sys { color: var(--warn); }
.convo .when { color: var(--text-3); font-size: .74rem; white-space: nowrap; }
.unread { width: .7rem; height: .7rem; border-radius: 50%; background: var(--irid-c); box-shadow: 0 0 .6rem rgba(53,224,255,.7); flex: none; }
.folder { margin-top: .35rem; }
.folder .convo { border-left: .25rem solid transparent; }
.folder.open .convo.head { border-left-color: var(--fc, var(--irid-b)); background: var(--ink-2); }
.folder .kids { padding-left: 1.1rem; }
.folder .kids .convo { min-height: 3rem; }
.folder .kids .av { width: 2.2rem; height: 2.2rem; font-size: .8rem; }
.chev { color: var(--text-3); font-size: .9rem; padding: 0 .2rem; }
.rail .foot { border-top: 1px solid var(--line-soft); padding: var(--s2) var(--s3) calc(var(--s2) + env(safe-area-inset-bottom)); display: flex; gap: .5rem; align-items: center; }
.rail .foot .who { flex: 1; color: var(--text-2); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- the conversation ---- */
.main { display: flex; flex-direction: column; min-height: 0; }
.bar { display: flex; align-items: center; justify-content: center; gap: .6rem; padding: calc(var(--s2) + env(safe-area-inset-top)) var(--s4) var(--s2); border-bottom: 1px solid var(--line-soft); background: rgba(11,11,16,.75); backdrop-filter: blur(12px); position: relative; }
.bar .back, .bar .gear { position: absolute; top: calc(var(--s2) + env(safe-area-inset-top)); }
.bar .back { left: var(--s3); display: none; } .bar .gear { right: var(--s3); }
.bar .chip { display: inline-flex; align-items: center; gap: .5rem; padding: .3rem .9rem .3rem .3rem; border-radius: 999px; background: var(--ink-2); border: 1px solid var(--line); font-weight: 600; max-width: 70%; }
.bar .chip .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .chip .s { color: var(--text-3); font-weight: 400; font-size: .8rem; white-space: nowrap; }
.thread { flex: 1; overflow: auto; padding: var(--s3) var(--s4); display: flex; flex-direction: column; gap: .35rem; }
.day { align-self: center; color: var(--text-3); font-size: .78rem; margin: .6rem 0 .3rem; }
.msg { max-width: min(44rem, 78%); padding: .6rem .95rem; border-radius: 1.25rem; line-height: 1.4; white-space: pre-wrap; word-break: break-word; position: relative; }
.msg.user { align-self: flex-end; background: var(--bubble-me); color: #fff; border-bottom-right-radius: .35rem; }
.msg.seat { align-self: flex-start; background: var(--bubble-them); border-bottom-left-radius: .35rem; }
.msg.seat + .msg.seat { border-top-left-radius: .5rem; } .msg.user + .msg.user { border-top-right-radius: .5rem; }
.msg.system { align-self: center; background: transparent; color: var(--warn); font-size: .88rem; max-width: 92%; text-align: center; }
.msg .who { display: block; font-size: .78rem; color: var(--text-3); margin: 0 0 .2rem .1rem; }
.msg .meta { display: block; font-size: .72rem; color: rgba(255,255,255,.55); margin-top: .3rem; text-align: right; }
.msg.seat .meta { color: var(--text-3); text-align: left; }
.messaged { align-self: center; color: var(--text-3); font-size: .82rem; display: inline-flex; align-items: center; gap: .35rem; margin: .4rem 0; }
.messaged .stack { display: inline-flex; } .messaged .stack .av { margin-left: -.5rem; border: 2px solid var(--ink); }
.typing { align-self: flex-start; background: var(--bubble-them); border-radius: 1.25rem; padding: .7rem 1rem; display: inline-flex; gap: .3rem; }
.typing i { width: .5rem; height: .5rem; border-radius: 50%; background: var(--text-3); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3 } 40% { opacity: 1 } }
.compose { display: grid; grid-template-columns: auto 1fr auto; gap: .5rem; align-items: end; padding: var(--s2) var(--s3) calc(var(--s2) + env(safe-area-inset-bottom)); background: rgba(11,11,16,.75); border-top: 1px solid var(--line-soft); }
.compose textarea { resize: none; min-height: 2.6rem; max-height: 9rem; border-radius: 1.3rem; padding: .6rem 1rem; }
.compose .send { background: var(--sweep); border: 0; color: #fff; }

/* ---- settings and files ---- */
.panel { padding: var(--s4); overflow: auto; flex: 1; display: grid; gap: var(--s4); align-content: start; }
.card { background: var(--ink-1); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s4); display: grid; gap: .8rem; }
.card h3 { font-size: 1.05rem; }
.row { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 10rem; }
.switch { display: inline-flex; align-items: center; gap: .5rem; } .switch input { width: 1.5rem; height: 1.5rem; min-height: 0; }
.files { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9rem; line-height: 1.7; } .files .dir { color: var(--irid-c); }
.center { display: grid; place-items: center; height: 100%; padding: var(--s4); }
.signin { width: min(26rem, 100%); display: grid; gap: .9rem; justify-items: stretch; text-align: center; }
.signin h1 { font-size: 1.8rem; }
.wait { color: var(--text-2); font-size: .95rem; }
.wait::after { content: ''; display: inline-block; width: .8rem; height: .8rem; border: 2px solid var(--text-3); border-top-color: var(--irid-c); border-radius: 50%; margin-left: .5rem; vertical-align: -.1rem; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
p.brief { margin: .2rem 0 .5rem; font-size: 1.05em; line-height: 1.45; }
.signal { display: grid; grid-template-columns: 1fr auto; gap: .6rem; align-items: center; padding: .5rem 0; border-bottom: 1px solid var(--line-soft); }
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }   /* minmax(0,…): a wide row can no longer push the whole screen past the phone's edge */
  .main, .panel, .card { min-width: 0; max-width: 100%; }
  .row { flex-wrap: wrap; }
  .look { grid-template-columns: 1fr; justify-items: start; }
  .bar .chip { min-width: 0; } .bar .chip .n, .bar .chip .s { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rail { display: none; } .app.show-rail .rail { display: flex; } .app.show-rail .main { display: none; }
  .bar .back { display: inline-grid; }
  .msg { max-width: 86%; }
}

/* ---- Build 3: voice, prefs, connections ---- */
:root { --text-3: #8A8AA0; }                       /* AA contrast for small type on the ink */
:focus-visible { outline: 2px solid var(--irid-c); outline-offset: 2px; }
.compose { grid-template-columns: auto 1fr auto auto; }
.compose .mic { background: var(--ink-2); border-color: var(--line); font-size: 1.1rem; touch-action: none; user-select: none; -webkit-user-select: none; }
.compose .mic.on { background: var(--danger); border-color: transparent; color: #fff; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,84,112,.55); } 50% { box-shadow: 0 0 0 .6rem rgba(255,84,112,0); } }
.msg .play { border-radius: 999px; min-height: 2.2rem; width: 2.2rem; padding: 0; display: inline-grid; place-items: center; background: rgba(255,255,255,.08); border-color: transparent; font-size: .8rem; }
.msg .play.mini { position: absolute; right: -2.7rem; bottom: .2rem; opacity: .55; }
.msg .play.mini:hover, .msg .play.mini.on, .msg .play.mini:focus-visible { opacity: 1; }
.msg.seat { margin-right: 2.9rem; }
.note { display: flex; align-items: center; gap: .6rem; margin-top: .5rem; padding: .45rem .6rem; border-radius: 1rem; background: rgba(255,255,255,.05); }
.note .play { background: var(--sweep); color: #fff; }
.note .wave { display: inline-flex; align-items: center; gap: 2px; height: 1.6rem; flex: 1; }
.note .wave i { display: block; width: 3px; border-radius: 2px; background: var(--text-2); height: 30%; }
.note .wave i:nth-child(3n) { height: 70%; } .note .wave i:nth-child(4n) { height: 50%; } .note .wave i:nth-child(7n) { height: 90%; } .note .wave i:nth-child(5n) { height: 40%; }
.note.on .wave i { animation: wave .9s ease-in-out infinite; background: var(--irid-c); }
.note.on .wave i:nth-child(2n) { animation-delay: .15s; } .note.on .wave i:nth-child(3n) { animation-delay: .3s; }
@keyframes wave { 0%, 100% { transform: scaleY(.6); } 50% { transform: scaleY(1.3); } }
.voice-row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; padding: .5rem 0; border-bottom: 1px solid var(--line-soft); }
.voice-row .grow { flex: 1; min-width: 9rem; }
.voice-row .speed { display: inline-flex; align-items: center; gap: .4rem; } .voice-row .speed input { width: 7rem; min-height: 0; padding: 0; } .voice-row output { min-width: 3.2rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.steps { padding-left: 1.3rem; display: grid; gap: .3rem; } .steps li { color: var(--text-2); }
.lane b { text-transform: none; }
.tok-app { display: grid; gap: .4rem; padding: .5rem 0; border-bottom: 1px solid var(--line-soft); }
.minted { display: grid; gap: .6rem; padding: var(--s3); border: 1px solid rgba(43,255,136,.45); border-radius: var(--r); background: rgba(43,255,136,.06); }
.minted code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; padding: .6rem .8rem; background: var(--ink); border-radius: var(--r-sm); user-select: all; -webkit-user-select: all; }
@media (max-width: 860px) { .msg.seat { margin-right: 2.6rem; } .compose .mic { font-size: 1.2rem; } }

/* 3.3b: the speed button — big, one tap cycles */
.spd { min-height: 2.2rem; min-width: 3.4rem; padding: 0 .7rem; border-radius: 999px; font-weight: 700; font-variant-numeric: tabular-nums; background: rgba(255,255,255,.1); border-color: transparent; color: var(--text); }
.spd:hover { background: rgba(255,255,255,.16); }
.mini-ctl { position: absolute; right: -6.4rem; bottom: .2rem; display: inline-flex; gap: .3rem; align-items: center; }
.mini-ctl .play.mini { position: static; }
.mini-ctl .spd.mini { opacity: .55; min-width: 3.4rem; }
.msg.seat:hover .mini-ctl .spd.mini, .mini-ctl .spd.mini:focus-visible, .msg.seat .mini-ctl .play.mini.on + .spd.mini { opacity: 1; }
.msg.seat { margin-right: 6.6rem; }
@media (max-width: 860px) { .msg.seat { margin-right: 6.4rem; max-width: 78%; } .mini-ctl .spd.mini { opacity: .8; } }

/* ---- Build 3b (item 3): the call screen — one screen, big words, one big button ---- */
.call { position: fixed; inset: 0; z-index: 60; display: grid; grid-template-rows: auto auto 1fr auto; gap: var(--s3, 1rem); padding: max(var(--s4, 1.5rem), env(safe-area-inset-top)) var(--s4, 1.5rem) max(var(--s4, 1.5rem), env(safe-area-inset-bottom)); background: var(--ink, #0B0B10); color: var(--text, #fff); }
.call-head { display: grid; gap: .3rem; }
.call-title { font-size: 1.35rem; } .call-title b { font-weight: 700; }
.call-sub { color: var(--text-2, #bbb); font-size: .95rem; }
.call-status { font-size: 1.4rem; line-height: 1.35; min-height: 3.8rem; padding: .8rem 1rem; border-radius: var(--r, 1rem); background: rgba(255,255,255,.06); }
.call-status.listening { box-shadow: inset 0 0 0 2px rgba(43,255,136,.45); }
.call-status.waiting { color: var(--text-2, #bbb); font-variant-numeric: tabular-nums; }
.call-status.speaking { box-shadow: inset 0 0 0 2px var(--irid-c, #7cf); }
.call-lines { overflow: auto; display: grid; align-content: end; gap: .5rem; }
.call-lines .line { padding: .6rem .9rem; border-radius: 1rem; max-width: 92%; line-height: 1.4; }
.call-lines .line.you { justify-self: end; background: var(--sweep, #2b6dff); color: #fff; }
.call-lines .line.seat { justify-self: start; background: rgba(255,255,255,.08); }
.call-lines .line .w { display: block; font-size: .8rem; opacity: .7; margin-bottom: .15rem; }
.call-actions { display: grid; gap: .8rem; }
.call-hangup { min-height: 4.2rem; font-size: 1.35rem; font-weight: 700; border-radius: 999px; background: var(--danger, #ff5470); color: #fff; border-color: transparent; }
.call-talk { min-height: 4.2rem; font-size: 1.2rem; font-weight: 600; border-radius: 999px; background: var(--ink-2, #17171f); border-color: var(--line, #333); touch-action: none; user-select: none; -webkit-user-select: none; }
.call-talk.on { background: var(--sweep, #2b6dff); color: #fff; border-color: transparent; animation: pulse 1s ease-in-out infinite; }
.bar .call { position: static; inset: auto; display: inline-grid; padding: 0; background: transparent; }

/* 29 Sep 2026 (Mia): a real emoji palette and colour swatches in "How X looks" — tap to pick; the text field and the native colour picker stay */
.pick { display: grid; gap: .4rem; width: 100%; }
.pick .swatches { display: flex; flex-wrap: wrap; gap: .45rem; }
.pick .swatches button { width: 2.2rem; height: 2.2rem; min-height: 0; padding: 0; border-radius: 50%; border: 2px solid transparent; }
.pick .swatches button.on, .pick .swatches button:focus-visible { border-color: #fff; }
.emoji-grid { display: none; grid-template-columns: repeat(auto-fill, minmax(2.6rem, 1fr)); gap: .3rem; padding: .5rem; border: 1px solid var(--line-soft); border-radius: var(--r); background: var(--ink-2, #17171f); width: 100%; }
.emoji-grid.open { display: grid; }
.emoji-grid button { font-size: 1.5rem; min-height: 2.6rem; padding: 0; background: transparent; border-color: transparent; }
.emoji-grid button:hover, .emoji-grid button:focus-visible { background: rgba(255,255,255,.1); }
