:root {
  /* Inbox Aloud brand: navy + bright blue */
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #eef1f7;
  --text: #0e1a36;
  --muted: #5d6882;
  --line: #e1e6f0;
  --accent: #1270d9;
  --accent-ink: #ffffff;
  --accent-soft: #e7f1ff;
  --brand-blue: #1a8cff;
  --navy: #0d1b3e;
  --danger: #b3261e;
  --ok: #1d7a4a;
  --warn: #9a5b00;
  --radius: 14px;
  --pane: 440px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1120; --surface: #121a2c; --surface-2: #1a2338; --text: #e8edf7; --muted: #94a0ba;
    --line: #243049; --accent: #5aa9ff; --accent-ink: #061226; --accent-soft: #15284a; --brand-blue: #5aa9ff;
    --danger: #ff8a80; --ok: #6fd39b; --warn: #f0b45a; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1120; --surface: #121a2c; --surface-2: #1a2338; --text: #e8edf7; --muted: #94a0ba;
  --line: #243049; --accent: #5aa9ff; --accent-ink: #061226; --accent-soft: #15284a; --brand-blue: #5aa9ff;
  --danger: #ff8a80; --ok: #6fd39b; --warn: #f0b45a; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  min-height: 100dvh; overflow-x: clip;
}
h1 { font-size: 1.6rem; margin: 0 0 .5rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
p { margin: .4rem 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error { color: var(--danger); min-height: 1em; }
.center-text { text-align: center; }
[hidden] { display: none !important; }

.screen { max-width: 560px; margin: 0 auto; padding: 0 16px calc(84px + env(safe-area-inset-bottom)); }
.screen.center { display: grid; place-items: center; min-height: 100dvh; padding-bottom: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 12px 0; }
.card.narrow { width: 100%; max-width: 420px; }

label { display: block; font-size: .85rem; color: var(--muted); margin: 12px 0 4px; }
label.check { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: .95rem; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px;
}
input[type="checkbox"] { width: 20px; height: 20px; }
textarea { resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: .95rem; text-decoration: none; cursor: pointer;
  color: var(--text); background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 10px 16px; min-height: 44px;
  transition: transform .12s ease, background-color .15s ease;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.danger { color: var(--danger); }
.btn.danger-solid { background: var(--danger); color: #fff; border-color: transparent; }
.confirm-box { margin-top: 14px; padding: 14px 16px; border: 1px solid var(--danger); border-radius: 12px; background: color-mix(in srgb, var(--danger) 7%, var(--surface)); }
.confirm-box p { margin: 0 0 8px; }
.btn.wide { width: 100%; margin-top: 14px; }
.btn.big { min-height: 54px; font-size: 1.05rem; }
.btn.small { min-height: 32px; padding: 4px 12px; font-size: .85rem; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.row { display: flex; align-items: center; }
.gap { gap: 8px; }
.wrap { flex-wrap: wrap; }
.icon-btn { background: none; border: 0; color: var(--text); width: 44px; height: 44px; border-radius: 50%; cursor: pointer; }
.icon-btn.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.facts { padding-left: 18px; margin: 12px 0; }
.facts li { margin: 6px 0; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top)) 0 6px; }
.topbar .title { font-weight: 700; }
.banner { border-radius: 12px; padding: 10px 14px; margin: 6px 0; background: var(--accent-soft); font-size: .92rem; }
.banner.warn { background: color-mix(in srgb, var(--warn) 16%, var(--surface)); }
.banner.bad { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); }

.counters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 4px; }
.counter { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; }
.counter span { display: block; font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.counter small { color: var(--muted); font-size: .78rem; }

.orb {
  position: relative; display: grid; place-items: center; align-content: center; gap: 8px;
  width: min(62vw, 230px); aspect-ratio: 1; margin: 22px auto 10px; border-radius: 50%;
  border: 0; cursor: pointer; color: var(--accent-ink); background: var(--accent);
  box-shadow: 0 10px 40px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: transform .15s ease;
}
.orb:active { transform: scale(.97); }
.orb-label { font-weight: 700; font-size: 1rem; }
.orb-ring { position: absolute; inset: -10px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); }
@media (prefers-reduced-motion: no-preference) {
  .orb-ring { animation: breathe 3.2s ease-in-out infinite; }
}
@keyframes breathe { 50% { transform: scale(1.04); opacity: .5; } }

.type-form { display: flex; gap: 8px; margin: 12px 0; }
.type-form input { flex: 1; min-width: 0; }

.section { margin: 22px 0 8px; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 8px 0; }
.list.compact li { padding: 8px 12px; font-size: .85rem; margin: 4px 0; }
.item-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.item-from { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-subject { font-size: .92rem; overflow-wrap: anywhere; }
.item-summary { font-size: .88rem; color: var(--muted); margin-top: 4px; }
.item-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tag { font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.tag.urgent { background: color-mix(in srgb, var(--danger) 16%, var(--surface)); color: var(--danger); }
.tag.reply_needed { background: var(--accent-soft); color: var(--accent); }
.tag.sent { color: var(--ok); }
.empty { text-align: center; color: var(--muted); padding: 20px; background: none !important; border: 1px dashed var(--line) !important; }
.meta-line { margin: 18px 0; text-align: center; }
.explain { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 8px 0 12px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr);
  max-width: 560px; margin: 0 auto;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button { font: inherit; font-size: .8rem; font-weight: 600; color: var(--muted); background: none; border: 0; padding: 14px 4px; cursor: pointer; }
.tabbar button.active { color: var(--accent); }
.pill { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: .7rem; }

/* Live conversation */
.live {
  position: fixed; inset: 0; z-index: 10; background: var(--bg);
  display: flex; flex-direction: column; gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) max(16px, calc((100% - 528px) / 2)) calc(12px + env(safe-area-inset-bottom));
}
.live-top { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.spacer { flex: 1; }
.state-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); }
.live[data-state="listening"] .state-dot { background: var(--ok); }
.live[data-state="thinking"] .state-dot { background: var(--warn); }
.live[data-state="speaking"] .state-dot { background: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .live[data-state="listening"] .state-dot, .live[data-state="speaking"] .state-dot { animation: pulse 1.2s ease-in-out infinite; }
}
@keyframes pulse { 50% { transform: scale(1.35); opacity: .6; } }

.current { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.cur-from { font-weight: 700; }
.cur-subject { font-size: .92rem; }
.cur-summary { font-size: .88rem; color: var(--muted); margin-top: 4px; }

.transcript { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 0; min-height: 80px; }
.msg { max-width: 88%; padding: 9px 13px; border-radius: 16px; font-size: .95rem; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.app { align-self: center; font-size: .8rem; color: var(--muted); background: none; padding: 2px 8px; text-align: center; }

.draft { background: var(--surface); border: 2px solid var(--accent); border-radius: var(--radius); padding: 12px; }
.draft-head { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.draft textarea { margin: 8px 0; max-height: 30dvh; }
.badge { font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.badge.ask { background: var(--accent); color: var(--accent-ink); }
.countdown { margin: 6px 0 10px; font-weight: 600; }

.live-controls { display: flex; gap: 8px; }
.live-controls .ctrl { flex: 1; }
.ctrl { font: inherit; font-weight: 700; min-height: 54px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.ctrl[aria-pressed="true"] { background: var(--warn); color: #111; }
.ctrl.end { background: var(--danger); color: #fff; border-color: transparent; }
.ctrl.orb-small { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.ctrl.orb-small.listening { background: var(--ok); }

.email-view { background: var(--surface); border: 2px solid var(--accent); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 4px; max-height: 55dvh; }
.ev-msg + .ev-msg { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; }
.ev-msg-head { font-weight: 650; font-size: .85rem; margin-bottom: 4px; }
.ev-msg-head span { font-weight: 400; color: var(--muted); }
.ev-msg-text { white-space: pre-wrap; }
.ev-body { overflow-y: auto; font-size: .92rem; margin: 8px 0; padding: 8px; background: var(--surface-2); border-radius: 10px; flex: 1; min-height: 60px; overflow-wrap: anywhere; }

/* ---------- Inbox Aloud layout ---------- */
.brand-blue { color: var(--brand-blue); }
.login-logo { display: block; margin: 0 auto 10px; }
#screen-login h1 { text-align: center; }
#screen-login .muted { text-align: center; }

/* Phone (default): one column, bottom tab bar */
.app { max-width: 560px; margin: 0 auto; padding: 0 16px calc(84px + env(safe-area-inset-bottom)); }
.sidebar { display: none; }
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar .title { font-weight: 800; letter-spacing: -.01em; }
.home-grid { display: flex; flex-direction: column; }
.home-side-col { order: -1; }
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 4px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip { font: inherit; font-size: .85rem; font-weight: 650; white-space: nowrap; cursor: pointer; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); }
.chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.inbox-list li { cursor: pointer; transition: border-color .15s ease, background-color .15s ease; }
.inbox-list li:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.inbox-list li.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.item-meta { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }
.item-date { color: var(--muted); font-size: .8rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.wide-grid, .settings-grid { display: block; }

/* Reading pane: a full-screen sheet on phones */
.reader { position: fixed; inset: 0; z-index: 15; overflow-y: auto; background: var(--bg); padding: calc(12px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); }
.reader-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.reader-subject { font-size: 1.3rem; line-height: 1.25; margin: 4px 0 8px; overflow-wrap: anywhere; }
.reader-summary { color: var(--muted); font-size: .92rem; margin-bottom: 10px; }
.reader-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.reader-msgs { display: flex; flex-direction: column; gap: 10px; }
.msg-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.msg-card.mine { background: var(--accent-soft); border-color: transparent; }
.msg-head { display: flex; justify-content: space-between; gap: 10px; font-size: .85rem; margin-bottom: 6px; }
.msg-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .95rem; }
.msg-files { margin-top: 6px; font-size: .8rem; color: var(--muted); }

/* Inbox rows: switch to a one-line-per-column layout whenever the list itself is wide enough */
.home-list-col { container-type: inline-size; container-name: list; min-width: 0; }
@container list (min-width: 620px) {
.inbox-list li {
    position: relative; display: grid; grid-template-columns: 190px minmax(0, 1fr) auto; grid-template-areas: "from subj meta" "from sum meta";
    column-gap: 18px; row-gap: 2px; padding: 12px 16px; margin: 6px 0; align-items: start;
  }
  .inbox-list li.empty { display: block; }
  .inbox-list .item-top { display: contents; }
  .inbox-list .item-from { grid-area: from; padding-top: 1px; }
  .inbox-list .item-meta { grid-area: meta; justify-self: end; flex-direction: column; align-items: flex-end; gap: 6px; }
  .inbox-list .item-subject { grid-area: subj; font-weight: 600; }
  .inbox-list .item-summary { grid-area: sum; margin-top: 0; }
  .inbox-list .item-summary.small { display: none; }
  /* quick actions float over the row on hover instead of reserving an empty line */
  .inbox-list .item-actions {
    position: absolute; right: 12px; bottom: 8px; margin: 0; padding-left: 16px; opacity: 0; pointer-events: none;
    background: linear-gradient(90deg, transparent, var(--surface) 16px); transition: opacity .15s ease;
  }
  .inbox-list li:hover .item-actions, .inbox-list li:focus-within .item-actions { opacity: 1; pointer-events: auto; }
}

/* ---------- Desktop ---------- */
@media (min-width: 1024px) {
  .app { display: grid; grid-template-columns: 248px minmax(0, 1fr); max-width: none; padding: 0; min-height: 100dvh; }
  .tabbar { display: none; }
  .sidebar {
    display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100dvh;
    padding: 22px 14px; background: var(--navy); color: #dfe7f7;
  }
  .brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; font-size: 1.25rem; letter-spacing: -.01em; color: #fff; }
  .brand img { background: #fff; border-radius: 10px; padding: 3px; }
  .brand b { color: #6db6ff; font-weight: 800; }
  .side-nav { display: flex; flex-direction: column; gap: 2px; }
  .side-nav button {
    display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: inherit; font-weight: 600; font-size: .95rem;
    padding: 11px 12px; border: 0; border-radius: 10px; background: none; color: #c9d5ec; cursor: pointer;
  }
  .side-nav button svg { width: 20px; height: 20px; flex-shrink: 0; }
  .side-nav button:hover { background: rgba(255,255,255,.06); color: #fff; }
  .side-nav button.active { background: rgba(109,182,255,.16); color: #fff; }
  .side-nav .count { margin-left: auto; font-size: .78rem; font-weight: 700; color: #9fb4da; }
  .side-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid rgba(255,255,255,.08); display: flex; flex-direction: column; gap: 4px; }
  .side-foot .muted { color: #8fa1c4; }

  .app-main { padding: 18px 32px 40px; min-width: 0; }
  .topbar { padding: 6px 0 10px; }
  .topbar-logo { display: none; }
  .topbar .title { font-size: 1.5rem; }

  /* Inbox: list on the left, assistant / email on the right */
  .home-grid { display: grid; grid-template-columns: minmax(0, 1fr) var(--pane); gap: 28px; align-items: start; }
  .home-side-col { order: 0; position: sticky; top: 18px; max-height: calc(100dvh - 36px); overflow-y: auto; }
  .assistant { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 22px 22px 14px; }
  .assistant .orb { width: 210px; margin: 26px auto 12px; }
  .filters { padding-top: 4px; flex-wrap: wrap; overflow: visible; }

  /* The email opens in the right-hand pane instead of covering the screen */
  .reader { position: static; inset: auto; z-index: auto; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: visible; }

  /* Live conversation docks on the right; the inbox stays visible */
  .live {
    left: auto; right: 0; top: 0; bottom: 0; width: calc(var(--pane) + 32px); max-width: none; margin: 0;
    padding: 20px 22px; border-left: 1px solid var(--line); box-shadow: -12px 0 40px rgba(13, 27, 62, .10);
  }
  body.live-open .app-main { padding-right: calc(var(--pane) + 64px); }
  body.live-open .home-grid { grid-template-columns: minmax(0, 1fr); }
  body.live-open .home-side-col { display: none; }

  .wide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; align-items: start; }
  .wide-grid .section:first-child { margin-top: 6px; }
  .settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; max-width: 1100px; }
  .settings-grid .card:first-child { margin-top: 12px; }
}
@media (min-width: 1024px) and (max-width: 1300px) {
  :root { --pane: 380px; }
  .app { grid-template-columns: 216px minmax(0, 1fr); }
  .app-main { padding-left: 24px; padding-right: 24px; }
  .assistant .orb { width: 180px; }
}
@media (min-width: 1440px) {
  :root { --pane: 480px; }
  .app-main { padding-left: 40px; padding-right: 40px; }
}

/* History: session transcripts */
.transcript-btn { margin-top: 8px; }
.transcript-view { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow-y: auto; padding: 10px; border-radius: 10px; background: var(--surface-2); }
.tl { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 8px; font-size: .88rem; align-items: baseline; }
.tl-who { font-weight: 700; color: var(--muted); }
.tl.you .tl-who { color: var(--accent); }
.tl-text { overflow-wrap: anywhere; }
.tl.app .tl-text { color: var(--muted); font-style: italic; }
.tl-at { color: var(--muted); font-size: .75rem; }

/* Sort menu at the end of the filter row */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.filters .sort { margin: 0 0 0 auto; flex-shrink: 0; }
.filters .sort select { width: auto; padding: 7px 30px 7px 12px; border-radius: 999px; font-size: .85rem; font-weight: 650; background-color: var(--surface); color: var(--text); cursor: pointer; }

/* New email */
.compose-btn { display: none; }
.new-mail-mobile { margin-top: 4px; }
.composer form label:first-of-type { margin-top: 4px; }
.type-form.tight { margin: 0; }
.confirm-send { margin-top: 14px; padding: 14px; border-radius: 12px; background: var(--accent-soft); }
.confirm-send p { margin: 0 0 10px; overflow-wrap: anywhere; }
#c-actions { margin-top: 14px; }
@media (min-width: 1024px) {
  .compose-btn { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 4px 14px; }
  .new-mail-mobile { display: none; }
}

/* ---------- Ava bar ---------- */
/* Phone: floats at the bottom (thumb reach) over an open email / New email, or while minimised. */
.ava-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 30;
  display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 22px;
  background: var(--navy); color: #fff; box-shadow: 0 10px 28px rgba(13, 27, 62, .35);
}
.ava-mic { width: 42px; height: 42px; flex-shrink: 0; border: 0; border-radius: 50%; cursor: pointer; display: grid; place-items: center; background: linear-gradient(135deg, #2b95ff, #1270d9); }
.ava-mic svg { width: 20px; height: 20px; fill: #fff; }
.ava-bar-text { flex: 1; min-width: 0; text-align: left; background: none; border: 0; color: inherit; font: inherit; padding: 2px 0; cursor: pointer; }
.ava-bar-title { display: block; font-weight: 700; font-size: .92rem; }
.ava-bar-line { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .78rem; line-height: 1.3; color: #a9bddf; }
.ava-bar.in-call .ava-bar-line { color: #e8efff; }
.ava-pill { flex-shrink: 0; font: inherit; font-size: .78rem; font-weight: 700; border: 0; border-radius: 999px; padding: 8px 11px; cursor: pointer; background: rgba(255,255,255,.12); color: #dce8ff; }
.ava-pill[aria-pressed="true"] { background: rgba(109, 182, 255, .35); color: #fff; }
.ava-pill.end { background: #c0392b; color: #fff; }
.ava-wave { display: flex; align-items: center; justify-content: center; gap: 3px; width: 30px; height: 24px; flex-shrink: 0; }
.ava-wave i { width: 3px; border-radius: 3px; background: #6db6ff; height: 8px; }
.ava-bar[data-state="speaking"] .ava-wave i { animation: avawave 1s ease-in-out infinite; }
.ava-wave i:nth-child(2) { height: 15px; animation-delay: -.5s; } .ava-wave i:nth-child(3) { height: 21px; }
.ava-wave i:nth-child(4) { height: 13px; animation-delay: -.7s; } .ava-wave i:nth-child(5) { animation-delay: -.3s; }
@keyframes avawave { 50% { transform: scaleY(.35); } }
@media (prefers-reduced-motion: reduce) { .ava-bar .ava-wave i { animation: none !important; } }
.ava-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: #8fa1c4; vertical-align: middle; }
.ava-bar[data-state="listening"] .ava-dot { background: #3ddc84; }
.ava-bar[data-state="speaking"] .ava-dot { background: #6db6ff; }
.ava-bar[data-state="thinking"] .ava-dot { background: #f0b45a; }
/* keep the end of the form clear of the floating bar */
body.ava-bar-on .reader, body.ava-bar-on .app { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

/* Ava-written fields in the email form */
.draft-flag { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 2px 0 6px; }
.draft-flag .badge.ask { background: var(--accent); color: var(--accent-ink); }
.ava-filled { background: var(--surface) !important; border-color: color-mix(in srgb, var(--accent) 45%, var(--line)) !important; box-shadow: 0 0 0 3px var(--accent-soft); }
.ava-hint { color: var(--accent); font-weight: 700; margin-left: 4px; }
#c-actions { align-items: center; flex-wrap: wrap; }

/* Live sheet extras */
.live-ctx { font-size: .85rem; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.live-ctx b { color: var(--text); }
.live-note { margin: 0; font-size: .8rem; color: var(--muted); line-height: 1.35; }

@media (min-width: 1024px) {
  /* Desktop: the bar sits at the top of the right-hand column */
  .ava-bar { position: sticky; top: 0; left: auto; right: auto; bottom: auto; margin-bottom: 12px; box-shadow: 0 8px 22px rgba(13, 27, 62, .22); }
  body.ava-bar-on .reader, body.ava-bar-on .app { padding-bottom: 0; }
  body.ava-bar-on .home-side-col { display: block !important; }
  /* compact session: the docked panel steps aside so the email / form can use the column */
  body.ava-compact .live { display: none; }
  body.ava-compact.live-open .app-main { padding-right: 32px; }
  body.ava-compact.live-open .home-grid { grid-template-columns: minmax(0, 1fr) var(--pane); }
  /* ...and the transcript drops down under the bar when you ask for it */
  body.ava-compact.ava-drawer .live {
    display: flex; top: var(--drawer-top, 92px); bottom: auto; right: var(--drawer-right, 32px); width: var(--drawer-width, var(--pane)); height: min(520px, calc(100dvh - var(--drawer-top, 92px) - 16px)); z-index: 25;
    padding: 14px 16px; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 18px 40px rgba(13, 27, 62, .18);
  }
  body.ava-drawer .live .live-top, body.ava-drawer .live .live-controls, body.ava-drawer .live .live-ctx, body.ava-drawer .live .current { display: none; }
  #min-btn { display: none; }
}
@media (max-width: 1023px) {
  /* Phone: Ava's pop-up sits above an open email / form; minimised = tucked into the bar */
  .live { z-index: 40; }
  body.ava-min .live { display: none; }
}

.google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; background: #fff; color: #1f1f1f; border: 1px solid var(--line); font-weight: 600; text-decoration: none; }
.or { text-align: center; margin: 12px 0 4px; }
