/* App layout on top of tokens.css. Token variables only: no new colors here. */

[hidden] { display: none !important; }
#app { max-width: 520px; margin: 0 auto; min-height: 100dvh; }
.screen { padding-top: max(20px, env(safe-area-inset-top)); padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.ico { display: inline-flex; flex: none; }
.m0 { margin: 0; }
.center { text-align: center; }
.muted { color: var(--muted); }
.strong { font-weight: 600; }
.text-soft { color: var(--text-soft); }
.pre { white-space: pre-line; line-height: 1.8; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.stack-xs { display: flex; flex-direction: column; gap: 4px; }
.row { display: flex; align-items: center; gap: 8px; }
.row > .input { flex: 1; min-width: 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
html { color-scheme: dark; }
select.input { cursor: pointer; }
.btn:disabled { opacity: .55; cursor: default; }
a.btn--secondary { color: var(--text); }

/* Loading, toast */
.loading { min-height: 60dvh; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); }
.spin { width: 20px; height: 20px; border-radius: var(--r-pill); border: 2px solid var(--raised); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; inset-inline: 16px; bottom: calc(96px + env(safe-area-inset-bottom)); margin: 0 auto; max-width: 480px;
  background: var(--raised); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 12px 16px; font-size: 14px; text-align: center; z-index: 50; }

/* Top bar of non-tab screens */
.topbar { display: flex; align-items: center; gap: 12px; }
.topbar__title { flex: 1; font-weight: 600; text-align: center; }
.topbar__spacer { width: var(--tap); flex: none; }
.icon-btn { flex: none; cursor: pointer; }
.icon-btn--bare { border: 0; background: none; color: var(--muted); }
.icon-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
[dir="ltr"] .topbar .ico svg, [dir="rtl"] .send .ico svg { transform: scaleX(-1); }

/* Tab screens */
.with-tabs { min-height: 100dvh; display: flex; flex-direction: column; }
.with-tabs .screen { flex: 1; min-height: 0; }
.with-tabs .tabbar { position: sticky; bottom: 0; }

/* Welcome */
.welcome__top { display: flex; align-items: center; justify-content: space-between; }
.brand { font-weight: 600; font-size: 18px; color: var(--text); display: inline-flex; align-items: center; gap: 8px; }
.lang-pick__wrap { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 12px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--border); color: var(--muted); }
.lang-pick { border: 0; background: transparent; color: var(--text); font-size: 14px; }
.lang-pick option { background: var(--surface); }
.welcome__body { align-items: center; justify-content: center; text-align: center; }
.emblem { position: relative; width: 168px; height: 168px; display: flex; align-items: center; justify-content: center; color: var(--accent); }
.emblem > svg { position: absolute; inset: 0; }
.emblem__mark { position: relative; width: 76px; height: 76px; }
.dev { color: var(--muted); }
.dev summary { cursor: pointer; text-align: center; min-height: var(--tap); display: flex; align-items: center; justify-content: center; }

/* Consent checkbox card */
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.check > span { display: flex; flex-direction: column; gap: 4px; }
.check__title { font-weight: 500; }

/* Home */
.home-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.balance-tile { display: flex; flex-direction: column; align-items: center; min-width: 72px; padding: 8px 12px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); text-decoration: none; }
.balance-tile__num { font-size: 22px; font-weight: 600; color: var(--accent); line-height: 1.2; }
.mode-card { display: flex; align-items: center; gap: 16px; padding: 18px 16px; min-height: 96px; border-radius: var(--r-2xl); background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; }
.mode-card__icon { width: 56px; height: 56px; border-radius: var(--r-lg); background: var(--raised); color: var(--text); display: flex; align-items: center; justify-content: center; flex: none; }
.mode-card--accent { border-color: var(--accent); }
.mode-card--accent .mode-card__icon { background: var(--accent); color: var(--on-accent); }
.mode-card__text { display: flex; flex-direction: column; gap: 4px; }
.mode-card__title { font-size: 17px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.chip--sm { padding: 2px 10px; font-size: 12px; font-weight: 400; }
.list { display: flex; flex-direction: column; gap: 8px; }
.row-link { display: flex; align-items: center; gap: 12px; padding: 12px; min-height: 64px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; }
.row-link__text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.row-link__title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile { width: 44px; height: 44px; border-radius: var(--r-md); background: var(--raised); color: var(--accent); display: flex; align-items: center; justify-content: center; flex: none; }
.row-link__meta { display: inline-flex; align-items: center; gap: 6px; }
.kind-ico { display: inline-flex; }
.kind-ico--talk { color: var(--talk-tile-a); }
.kind-ico--call { color: var(--call-line); }
.tile--sm { width: 36px; height: 36px; border-radius: var(--r-sm); }

/* Setup: objectives */
.objective { display: flex; align-items: center; gap: 10px; padding: 0 4px 0 12px; padding-inline: 12px 4px; min-height: 52px; }
.objective__input { flex: 1; min-width: 0; min-height: 48px; border: 0; background: transparent; outline: none; }
.objective:focus-within { border-color: var(--accent); }

/* Live session */
.live { height: 100dvh; display: flex; flex-direction: column; }
.live__head { display: flex; flex-direction: column; gap: 12px; padding: max(16px, env(safe-area-inset-top)) var(--gutter) 8px; }
.live__title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.live__title .label { display: inline-flex; align-items: center; gap: 4px; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chip--objective { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; flex: none; }
.live__scroll { flex: 1; overflow-y: auto; padding: 8px var(--gutter) 16px; overscroll-behavior: contain; }
.live__scroll .chat { min-height: 100%; }
.chat__empty { align-self: stretch; }
.chat__note { align-self: center; font-size: 12px; }
.bubble-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.bubble { overflow-wrap: anywhere; }
.live__sheet { padding-bottom: max(16px, env(safe-area-inset-bottom)); gap: 10px; }
.live__status { min-height: 20px; }
.live__bar { display: flex; align-items: center; gap: 8px; }
.live__input { flex: 1; min-width: 0; min-height: 48px; }
.mic { flex: none; cursor: pointer; }
.mic--off { background: var(--raised); color: var(--muted); box-shadow: none; }
.decision { display: flex; flex-direction: column; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.decision[hidden] { display: none; }
.chat--static { justify-content: flex-start; }

/* Report */
.report-head { display: flex; align-items: center; gap: 16px; }
.ring { position: relative; flex: none; }
.ring svg { position: absolute; inset: 0; }
.ring__label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 18px; }
.objective-result { display: flex; gap: 12px; align-items: flex-start; }
.objective-result--open { background: transparent; border: 1px dashed var(--border-dashed); }
.objective-result__mark { width: 30px; height: 30px; border-radius: var(--r-pill); background: var(--raised); color: var(--muted); display: flex; align-items: center; justify-content: center; flex: none; }
.objective-result__mark.ok { background: var(--ok-bg); color: var(--ok); }
.rate[aria-pressed="true"] { background: var(--raised); }

/* Home */
.home-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.home-hello { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); text-decoration: none; font-size: 15px; }
.avatar--sm { width: 44px; height: 44px; font-size: 17px; }
.home-title { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 4px 0 2px; }
.home-title__bar { width: 40px; height: 3px; border-radius: var(--r-pill); background: var(--accent); }
.mode-grid { gap: 12px; align-items: stretch; }
.mode-tile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 18px 12px 14px;
  border-radius: var(--r-2xl); background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; min-width: 0; }
.mode-tile__icon { width: 72px; height: 72px; border-radius: var(--r-xl); background: var(--raised); color: var(--text); display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.mode-tile__title { font-size: 16px; font-weight: 600; line-height: 1.35; }
.mode-tile__sub { font-size: 12px; line-height: 1.6; color: var(--muted); flex: 1; }
.mode-tile__action { align-self: stretch; min-height: var(--tap); margin-top: 4px; border-radius: var(--r-pill); border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600; font-size: 14px; color: var(--muted); }
.mode-tile--talk { background: linear-gradient(160deg, var(--talk-card-a), var(--talk-card-b)); border: 1px solid var(--talk-card-edge);
  color: var(--on-accent); box-shadow: 0 0 24px var(--talk-glow); }
.mode-tile--call { background: linear-gradient(160deg, var(--call-card-a), var(--call-card-b)); border: 1px solid var(--call-card-edge); color: var(--on-mode); }
.mode-tile--talk .mode-tile__icon { background: linear-gradient(160deg, var(--talk-tile-a), var(--talk-tile-b)); color: var(--on-mode); }
.mode-tile--call .mode-tile__icon { background: linear-gradient(160deg, var(--call-tile-a), var(--call-tile-b)); color: var(--on-mode); border: 1px solid var(--call-card-edge); }
.mode-tile--talk .mode-tile__sub { color: var(--talk-sub); }
.mode-tile--call .mode-tile__sub { color: var(--call-sub); }
.mode-tile--talk .mode-tile__action { background: linear-gradient(160deg, var(--talk-btn-a), var(--talk-btn-b)); border-color: transparent; color: var(--on-mode); }
.mode-tile--call .mode-tile__action { background: transparent; border: 2px solid var(--call-line); color: var(--on-mode); }
.mode-tile--call .mode-tile__action .ico { color: var(--call-line); }
.mode-tile--talk .mode-tile__action svg { fill: currentColor; } /* solid play mark, never mirrored */
.mode-tile__title { font-size: 17px; }
.accent-ico { color: var(--accent); display: inline-flex; }
.see-all { gap: 4px; text-decoration: none; color: var(--accent); }
[dir="ltr"] .see-all .ico svg { transform: scaleX(-1); }

/* History */
.pills { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.pill { min-height: var(--tap); padding: 0 16px; border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-weight: 500; white-space: nowrap; cursor: pointer; }
.pill[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.empty { padding: 32px 16px; text-align: center; border: 1px dashed var(--border-dashed); border-radius: var(--r-xl); }

/* Balance */
.balance-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 24px 16px; }
.balance-hero__num { font-size: 56px; font-weight: 600; line-height: 1.1; color: var(--accent); }
.package { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: start; cursor: pointer; color: var(--text); }
.package[aria-checked="true"] { border: 2px solid var(--accent); padding: 15px; }
.package__min { font-size: 24px; font-weight: 600; }
.package__price { color: var(--accent); font-weight: 600; }
.package__tag { position: absolute; top: 10px; inset-inline-end: 10px; }
.moves { padding: 4px 16px; }
.move { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; }
.move + .move { border-top: 1px solid var(--border); }
.move__delta { color: var(--muted); font-weight: 500; white-space: nowrap; }
.move__delta--plus { color: var(--ok); }
.move__amounts { align-items: flex-end; text-align: end; }

/* Profile */
.profile-head { display: flex; align-items: center; gap: 14px; }
.avatar { width: 56px; height: 56px; border-radius: var(--r-pill); background: var(--raised); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 600; flex: none; }
.fact-lines { display: flex; flex-direction: column; }
.fact-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.fact-line + .fact-line { border-top: 1px solid var(--border); }
.fact-line__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fact-line__value { color: var(--text); overflow-wrap: anywhere; }
.fact-lines .see-all { padding-top: 8px; }
.chip--ask { color: var(--accent); border-color: var(--accent); background: transparent; }
.chip--never { background: var(--danger-bg); border-color: transparent; color: var(--danger); }
.chip { white-space: nowrap; }
.segmented button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.link-danger { min-height: var(--tap); border: 0; background: none; color: var(--danger); font-weight: 500; cursor: pointer; }
.danger-box { display: flex; flex-direction: column; gap: 12px; border-color: var(--danger); }
.danger-box[hidden] { display: none; }

/* Help */
.help-item { padding: 0; }
.help-item__head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 56px; cursor: pointer; list-style: none; }
.help-item__head::-webkit-details-marker { display: none; }
.help-item p { padding: 0 14px 14px; }
.help-item[open] .help-item__head { color: var(--accent); }

/* Facts editor + get-to-know chat */
.facts__group { margin-top: 8px; }
/* who-hears icons: unselected = quiet outline; selected = the colour of its meaning */
.privacy-pick { display: inline-flex; gap: 6px; }
.privacy-pick__btn { width: var(--tap); height: 36px; border-radius: var(--r-sm); border: 1px solid var(--border); background: transparent;
  color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.privacy-pick__btn--share[aria-checked="true"] { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.privacy-pick__btn--ask[aria-checked="true"] { background: transparent; border: 2px solid var(--accent); color: var(--accent); }
.privacy-pick__btn--never[aria-checked="true"] { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.privacy-legend { display: flex; flex-direction: column; gap: 12px; }
.privacy-legend__items { display: flex; flex-direction: column; gap: 10px; }
.privacy-legend__item { display: flex; align-items: center; gap: 10px; }
.privacy-legend__item > span:last-child { display: flex; flex-direction: column; }
.privacy-legend .privacy-pick__btn { width: 36px; height: 32px; cursor: default; }
.sticky-action { position: sticky; bottom: 0; padding: 12px 0 max(4px, env(safe-area-inset-bottom)); background: var(--bg); }
.fact-row { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; transition: border-color .6s; }
.fact-row--fresh { border-color: var(--accent); }

/* Live session, split layout (default): a full-screen layer over the app. Top half turned to the
   other person (light, their language only), a wide divider, bottom half the owner's (dark, the
   owner's language only); every control sits in one folded panel under it. */
.split { display: none; flex: 1; min-height: 0; flex-direction: column; }
.live--split { position: fixed; inset: 0; z-index: 40; background: var(--bg); }
.live--split .split { display: flex; }
.live--split .live__scroll, .live--split .live__head { display: none; }
.half { flex: 1; min-height: 0; overflow-y: auto; padding: 12px var(--gutter); display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.half > :first-child { margin-top: auto; }
.half--theirs { transform: rotate(180deg); background: var(--their-bg); color: var(--their-text); }
.half--theirs .bubble--other { align-self: flex-start; background: var(--their-own); border: 1px solid var(--their-own-edge); }
.half--theirs .bubble--mine { align-self: flex-end; background: var(--their-ours); }
.half--theirs .bubble__main { color: var(--their-text); }
.half--theirs .bubble--mine .bubble__main { color: var(--their-ours-text); }
.half--theirs .bubble--latest { border: 2px solid var(--accent); }
.half--mine { background: var(--bg); color: var(--text); }
.split__divider { flex: none; height: 14px; background: var(--accent); display: flex; align-items: center; justify-content: center; }
.split__grip { width: 56px; height: 4px; border-radius: var(--r-pill); background: var(--on-accent); opacity: .45; }
.live--split .live__sheet { border-radius: 0; padding: 0 var(--gutter) max(6px, env(safe-area-inset-bottom)); gap: 6px; }
.live__handle { width: 100%; min-height: var(--tap); display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; background: none; color: var(--muted); cursor: pointer; }
.live__handle .ico { color: var(--accent); transition: transform .2s; }
.live__handle--open .ico { transform: rotate(180deg); }
.live__mini { display: inline-flex; align-items: center; gap: 4px; }
.live__drawer { display: flex; flex-direction: column; gap: 12px; padding-bottom: 8px; max-height: 62vh; overflow-y: auto; }
.live__drawer[hidden] { display: none; }
.bubble--big .bubble__main { font-size: 19px; line-height: 1.55; }
