:root,
:root[data-scheme="light"],
:root[data-look="teal"][data-scheme="light"] {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #efebe4;
  --line: #e3ddd3;
  --text: #1c1915;
  --text-2: #5f574e;
  --text-3: #8e857a;
  --their: #ffffff;
  --block: #f4ede1;
  --dash: #9c8f7e;
  --warn-bg: #fff1dc;
  --warn: #8a5200;
  --danger: #b3261e;
  --scrim: rgba(28, 25, 21, 0.4);
  --shadow: 0 1px 2px rgba(28, 25, 21, 0.1);
  --own: #0f766e;
  --accent: #0f766e;
  --soft: #d9eeea;
  --on-own: #ffffff;
  --btn: var(--own);
}

:root[data-scheme="dark"],
:root[data-look="teal"][data-scheme="dark"] {
  --bg: #12110f;
  --surface: #1c1a17;
  --surface-2: #28241f;
  --line: #36312a;
  --text: #eee8df;
  --text-2: #aba297;
  --text-3: #7a7166;
  --their: #25221e;
  --block: #30291f;
  --dash: #7d7366;
  --warn-bg: #3a2a12;
  --warn: #f2b866;
  --danger: #f2827a;
  --scrim: rgba(0, 0, 0, 0.6);
  --shadow: none;
  --own: #11635c;
  --accent: #5cc2b6;
  --soft: #163430;
  --on-own: #ffffff;
  --btn: var(--own);
}

:root[data-look="rose"][data-scheme="light"] {
  --own: #b4235a;
  --accent: #b4235a;
  --soft: #fae3eb;
  --on-own: #ffffff;
  --btn: var(--own);
}

:root[data-look="rose"][data-scheme="dark"] {
  --own: #93204d;
  --accent: #f27aa8;
  --soft: #3a1a27;
  --on-own: #ffffff;
  --btn: var(--own);
}

:root[data-look="blue"][data-scheme="light"] {
  --own: #1d5fd1;
  --accent: #1d5fd1;
  --soft: #dfe9fb;
  --on-own: #ffffff;
  --btn: var(--own);
}

:root[data-look="blue"][data-scheme="dark"] {
  --own: #1f4fa8;
  --accent: #86adf5;
  --soft: #1b2740;
  --on-own: #ffffff;
  --btn: var(--own);
}

:root[data-look="classic"][data-scheme="light"] {
  --own: #ddedea;
  --accent: #1f6f6b;
  --soft: #ddedea;
  --on-own: var(--text);
  --btn: var(--accent);
}

:root[data-look="classic"][data-scheme="dark"] {
  --own: #1f3533;
  --accent: #6fc2ba;
  --soft: #1f3533;
  --on-own: var(--text);
  --btn: var(--accent);
  /* Classic dark fills buttons with a light teal: white text on it was hard to read. */
  --on-accent: #10201e;
}

:root {
  --text-muted: var(--text-2);
  --own-bubble: var(--own);
  --their-bubble: var(--their);
  --block-bg: var(--block);
  --block-bar: var(--dash);
  --dashed: var(--dash);
  --warn-text: var(--warn);
  --border: var(--line);
  --radius: var(--r-button);
  --on-accent: #ffffff;
  --focus: var(--accent);
  --font: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;
  --fs-large: 2rem;
  --lh-large: 1.15;
  --fs-title: 1.25rem;
  --lh-title: 1.25;
  --fs-name: 1.0625rem;
  --lh-name: 1.25;
  --fs-message: 1.0625rem;
  --lh-message: 1.45;
  --fs-primary: var(--fs-message);
  --fs-body: var(--fs-message);
  --fs-block: 0.9375rem;
  --lh-block: 1.4;
  --fs-secondary: 0.875rem;
  --lh-secondary: 1.4;
  --fs-status: var(--fs-block);
  --fs-label: 0.8125rem;
  --lh-label: 1.3;
  --fs-caption: 0.8125rem;
  --lh-caption: 1.3;
  --fs-time: 0.6875rem;
  --fs-tag: 0.625rem;
  --lh-tag: 1.05;
  --fs-code: 1.75rem;
  --lh: var(--lh-message);
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --r-bubble: 20px;
  --r-tail: 6px;
  --r-sheet: 22px;
  --r-card: 18px;
  --r-button: 14px;
  --r-chip: 999px;
  --r-block: 12px;
  --tap: 48px;
  --tap-row: 56px;
  --tap-big: 64px;
  --motion-fade: 150ms ease-out;
  --motion-sheet: 220ms ease-out;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --motion-fade: 0ms;
    --motion-sheet: 0ms;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

button,
input,
textarea,
select {
  font-family: inherit;
}

html {
  font: -apple-system-body;
  font-family: var(--font);
}

body {
  margin: 0;
  /* Fixed to the screen: the thread list scrolls inside it and the composer stays pinned (UX 3.6). */
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  line-height: var(--lh);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}

#app {
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.thread-screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--sp-4);
  gap: var(--sp-4);
}

.screen-title {
  font-size: var(--fs-title);
  margin: 0;
}

/* The screen spaces its children with gap; browser paragraph margins doubled every space (0.7.4). */
.screen > p {
  margin: 0;
}

.top-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.top-bar-partner {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  border: none;
  background: transparent;
  text-align: left;
  padding: var(--sp-1);
  min-height: var(--tap);
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.top-bar-partner:disabled {
  cursor: default;
}

.top-bar-partner-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.top-bar-name {
  font-size: var(--fs-name);
  font-weight: 600;
  line-height: var(--lh-name);
}

.top-bar-sub {
  font-size: var(--fs-secondary);
  color: var(--text-muted);
  line-height: var(--lh-secondary);
}

.top-bar-waiting {
  font-size: var(--fs-label);
  color: var(--text-muted);
}

.avatar-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 600;
  flex-shrink: 0;
}

.avatar-36 {
  width: 36px;
  height: 36px;
  font-size: var(--fs-label);
}

.avatar-52 {
  width: 52px;
  height: 52px;
  font-size: var(--fs-name);
}

.avatar-88 {
  width: 88px;
  height: 88px;
  font-size: var(--fs-title);
}

.icon-btn {
  min-width: var(--tap);
  min-height: var(--tap);
  border: none;
  background: transparent;
  color: var(--text);
  border-radius: var(--r-button);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn {
  min-height: var(--tap);
  border-radius: var(--r-button);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-body);
  padding: var(--sp-2) var(--sp-4);
  cursor: pointer;
  width: 100%;
}

.btn-primary {
  background: var(--btn);
  color: var(--on-accent);
  border-color: var(--btn);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

.btn-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.thread {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: var(--sp-3);
}

.new-below {
  position: sticky;
  bottom: var(--sp-2);
  align-self: center;
  min-height: var(--tap);
  border-radius: var(--r-chip);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: var(--sp-2) var(--sp-4);
  cursor: pointer;
  z-index: 5;
}

.system-line {
  text-align: center;
  font-size: var(--fs-label);
  color: var(--text-muted);
  margin: 0;
}

.lang-tag {
  font-weight: 600;
  font-size: var(--fs-label);
}

.thread-skeleton {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.msg-wrap {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  align-self: flex-start;
  gap: var(--sp-1);
}

.msg-wrap-own {
  align-self: flex-end;
}

.msg-wrap .status-line {
  margin: 0;
  padding: 0 var(--sp-1);
}

.msg-wrap .status-line.warn {
  color: var(--warn);
}

.msg-wrap .status-btn {
  color: var(--warn);
}

.msg {
  position: relative;
  max-width: 100%;
  align-self: flex-start;
  border-radius: var(--r-bubble);
  padding: var(--sp-2) var(--sp-3) var(--sp-4);
  background: var(--their-bubble);
  border: none;
  box-shadow: var(--shadow);
  transition: opacity var(--motion-fade);
}

.thread > .msg-wrap {
  margin-top: 8px;
}

.thread > .msg-wrap:first-child {
  margin-top: 0;
}

.thread > .msg-wrap.msg-wrap-run-continue {
  margin-top: 3px;
}

.msg[data-side="own"] {
  background: var(--own-bubble);
  color: var(--on-own);
  box-shadow: none;
}

.msg[data-side="own"] .block-label,
.msg[data-side="own"] .lang-tag {
  color: rgba(255, 255, 255, 0.9);
}

:root[data-look="classic"] .msg[data-side="own"] .block-label,
:root[data-look="classic"] .msg[data-side="own"] .lang-tag {
  color: var(--text);
}

.msg[data-side="own"] .chip {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
}

:root[data-look="classic"] .msg[data-side="own"] .chip {
  background: var(--block);
  color: var(--text);
  border-color: var(--line);
}

.msg[data-side="own"] .reaction-chip {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
}

:root[data-look="classic"] .msg[data-side="own"] .reaction-chip {
  background: var(--block);
  color: var(--text);
  border-color: var(--line);
}

.msg[data-side="own"] .reply-quote {
  background: rgba(0, 0, 0, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--on-own);
}

:root[data-look="classic"] .msg[data-side="own"] .reply-quote {
  background: var(--block);
  border-color: var(--line);
  color: var(--text);
}

.msg[data-side="own"] a,
.msg[data-side="own"] .voice-play-btn {
  color: var(--on-own);
}

.msg.msg-tail-theirs {
  border-bottom-left-radius: var(--r-tail);
}

.msg.msg-tail-own {
  border-bottom-right-radius: var(--r-tail);
}

.msg-time {
  position: absolute;
  right: var(--sp-2);
  bottom: var(--sp-1);
  font-size: var(--fs-time);
  opacity: 0.85;
}

.msg[data-side="own"] .msg-time {
  color: var(--on-own);
}

.msg-body {
  font-size: var(--fs-message);
  line-height: var(--lh-message);
}

.msg[data-state="sending"] {
  opacity: 0.6;
}

.block-primary {
  font-size: var(--fs-primary);
}

.block-other {
  background: var(--block-bg);
  padding: var(--sp-2);
  border-radius: var(--r-block);
  margin-top: var(--sp-2);
  font-size: var(--fs-block);
  line-height: var(--lh-block);
}

.msg[data-side="own"] .block-other {
  background: rgba(0, 0, 0, 0.2);
}

:root[data-look="classic"] .msg[data-side="own"] .block-other {
  background: var(--block);
}

.block-dashed {
  border: 1px dashed var(--dashed);
  background: transparent;
}

.block-label {
  font-size: var(--fs-label);
  color: var(--text-muted);
  margin: 0 0 var(--sp-1);
}

.photoread-block {
  margin-top: var(--sp-2);
}

.photoread-block p:last-child,
.photoread-original-block p:last-child {
  margin: 0;
  overflow-wrap: anywhere;
}

.photoread-viewer {
  display: grid;
  gap: var(--sp-2);
}

.status-line {
  font-size: var(--fs-status);
  color: var(--text-muted);
  margin: var(--sp-2) 0 0;
}

.status-line.warn {
  color: var(--warn-text);
}

.status-btn {
  background: none;
  border: none;
  padding: var(--tap);
  min-width: var(--tap);
  min-height: var(--tap);
  font: inherit;
  color: var(--warn-text);
  text-decoration: underline;
  cursor: pointer;
}

.composer,
.composer-v2 {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: var(--sp-2) var(--sp-3) calc(var(--sp-2) + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.composer-v2-row {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-2);
}

.composer-attach,
.composer-send-round,
.composer-voice-round {
  width: 40px;
  height: 40px;
  min-width: 44px;
  min-height: 44px;
  padding: 2px;
  border-radius: 999px;
  flex-shrink: 0;
}

.composer-send-round {
  background: var(--own);
  color: var(--on-own);
}

.composer-field-wrap {
  flex: 1;
  position: relative;
  min-width: 0;
}

.composer-field {
  width: 100%;
  min-height: 40px;
  max-height: calc(var(--lh-message) * var(--fs-message) * 6 + var(--sp-3));
  resize: none;
  font: inherit;
  line-height: var(--lh-message);
  border: none;
  border-radius: 20px;
  padding: var(--sp-2) calc(var(--sp-5) + var(--sp-2)) var(--sp-2) var(--sp-3);
  background: var(--surface-2);
  color: var(--text);
}

.composer-mic-inset {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 40px;
  height: 40px;
  min-width: 44px;
  min-height: 44px;
  padding: 2px;
}

.composer-near {
  margin: 0;
  font-size: var(--fs-secondary);
}

.composer-side-spacer {
  width: 40px;
  flex-shrink: 0;
}

.attach-row-icon {
  width: 24px;
  display: inline-flex;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 20;
}

.sheet {
  width: 100%;
  max-width: 480px;
  max-height: 85dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  padding: var(--sp-3) var(--sp-4) calc(34px + env(safe-area-inset-bottom));
  transition: transform var(--motion-sheet);
}

.sheet-grab {
  width: 36px;
  height: 5px;
  border-radius: 999px;
  background: var(--line);
  margin: 0 auto var(--sp-3);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.sheet h2 {
  margin: 0;
  font-size: var(--fs-title);
  font-weight: 700;
  line-height: var(--lh-title);
}

.sheet-close {
  background: var(--surface-2);
  border-radius: 999px;
}

.sheet-row {
  min-height: var(--tap-row);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  border-bottom: 1px solid var(--line);
  width: 100%;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: var(--text);
}

/* A divider inside a sheet: a hairline in the theme's line colour (0.7.4: WebKit drew a bright ridge in dark mode). */
.sheet hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: var(--sp-3) 0 0;
}

.sheet-row.danger {
  color: var(--danger);
  margin-top: var(--sp-5);
}

.sheet-row:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-chip);
  border: 1px solid var(--line);
  background: var(--surface-2);
  /* A chip is often a <button>: without an explicit colour WebKit paints it black, unreadable in dark mode (0.7.3 audit). */
  color: var(--text);
  font-size: var(--fs-label);
  font-weight: 500;
  line-height: 1.2;
}

/* A chip you can tap keeps the 44px tap rule (UX section 9, item 25); a label chip stays compact. */
button.chip {
  min-height: 44px;
  cursor: pointer;
}

.msg-body p {
  margin: 0;
}

.msg-body > * + * {
  margin-top: var(--sp-2);
}

.msg [data-chips] {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--sp-2);
}

.sheet h2[tabindex="-1"]:focus,
h1[tabindex="-1"]:focus {
  outline: none;
}

.banner {
  background: var(--warn-bg);
  color: var(--warn-text);
  padding: var(--sp-3);
  border-radius: var(--r-block);
  font-size: var(--fs-status);
}

.code-field {
  font-family: var(--font-mono);
  font-size: var(--fs-code);
  letter-spacing: 0.05em;
  width: 100%;
  text-align: center;
  min-height: var(--tap-big);
  border: 1px solid var(--line);
  border-radius: var(--r-button);
  background: var(--surface);
}

.code-field[aria-invalid="true"] {
  border-color: var(--danger);
}

.toast {
  position: fixed;
  bottom: calc(var(--sp-6) + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-chip);
  font-size: var(--fs-status);
  z-index: 30;
}

.skeleton {
  height: 4rem;
  background: var(--surface-2);
  border-radius: var(--r-bubble);
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.55;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
  }
}

.recovery-code {
  font-family: var(--font-mono);
  font-size: var(--fs-code);
  word-break: break-all;
  text-align: center;
  padding: var(--sp-4);
  background: var(--surface-2);
  border-radius: var(--r-block);
}

/* EN / VI as a small segmented control (0.7.4: a big outlined box next to bare text). */
.lang-switch {
  display: inline-flex;
  align-self: flex-start;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-2);
}

.lang-switch .btn {
  min-height: 44px;
  min-width: 64px;
  padding: 0 var(--sp-4);
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font-weight: 600;
}

.lang-switch .btn.selected {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.screen form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.system-line {
  text-align: center;
  font-size: var(--fs-label);
  color: var(--text-muted);
}

.muted {
  color: var(--text-muted);
  font-size: var(--fs-status);
}

.sealed-bubble {
  touch-action: none;
  cursor: pointer;
}
.private-held-overlay {
  position: fixed;
  left: var(--sp-3);
  right: var(--sp-3);
  bottom: calc(var(--composer-h, 4.5rem) + var(--sp-3));
  max-height: 50dvh;
  overflow-y: auto;
  padding: var(--sp-3);
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 20;
}
.sealed-label {
  font-weight: 600;
  text-align: center;
  margin: 0.25rem 0;
}
.sealed-open-body {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.sealed-open-img {
  max-width: 100%;
  border-radius: 8px;
  display: block;
  margin: 0.25rem auto;
}

.hidden {
  display: none !important;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: var(--sp-2) 0;
}

.chip.selected {
  outline: 2px solid var(--focus);
}

.dictation-panel {
  display: grid;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border-top: 1px solid var(--line);
}

.block-other.block-dashed {
  opacity: 0.5;
}

.memory-chips {
  margin-top: var(--sp-2);
}

.memory-chip-block {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.memory-chip-action {
  font-size: var(--fs-status);
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
}

.memory-delete-note {
  margin: var(--sp-2) 0;
}

.memory-list-row {
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--line);
}

.memory-list-title {
  margin: 0 0 var(--sp-1);
  font-size: var(--fs-body);
}

.memory-list-status {
  margin: 0 0 var(--sp-2);
}

.memory-list-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.memory-edit-field {
  display: grid;
  gap: var(--sp-1);
  margin-bottom: var(--sp-3);
}

.memory-edit-field input {
  min-height: var(--tap);
  padding: var(--sp-2);
  border: 1px solid var(--line);
  border-radius: var(--r-block);
  font-size: var(--fs-body);
}

.update-banner .update-banner-wait {
  margin: var(--sp-2) 0 0;
  color: var(--text-muted);
  font-size: var(--fs-status);
}

.update-banner-done {
  cursor: pointer;
}

.privacy-body {
  display: grid;
  gap: var(--sp-3);
  max-height: min(70vh, 32rem);
  overflow-y: auto;
  text-align: start;
  font-size: var(--fs-body);
  line-height: 1.45;
}

.privacy-heading {
  margin: var(--sp-2) 0 0;
  font-size: var(--fs-title);
  font-weight: 600;
}

.privacy-intro,
.privacy-law {
  color: var(--text-muted);
}

.privacy-body p {
  margin: 0;
}

.media-file-input,
.media-camera-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.media-pick {
  position: relative;
  display: flex;
  align-items: stretch;
}

.media-frame,
.media-pending-frame,
.media-preview-frame {
  margin-bottom: var(--sp-2);
}

/* The whole picture, at most 40% of the screen high, so Caption and Send stay on screen for any shape. */
.media-preview-frame .media-img {
  height: auto;
  max-height: 40dvh;
  object-fit: contain;
}

.media-open {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 0;
  border: none;
  background: var(--surface-2);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: var(--media-ar, 4 / 3);
  cursor: pointer;
}

.media-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 48px;
  padding: var(--sp-3);
  text-align: center;
}

.media-off-box {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border-radius: var(--radius);
  margin-bottom: var(--sp-2);
}

.media-caption-label {
  display: grid;
  gap: var(--sp-2);
}

.media-pending-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.media-viewer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-3);
}

.media-viewer {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  width: min(100%, 36rem);
  max-height: 100%;
  min-height: 0;
}

.media-viewer-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  gap: var(--sp-3);
  -webkit-overflow-scrolling: touch;
}

.media-viewer-img {
  width: 100%;
  max-height: min(80vh, 32rem);
  object-fit: contain;
  background: #000;
  -webkit-touch-callout: default;
}

.media-viewer-actions {
  display: flex;
  gap: var(--sp-2);
}

.media-viewer-actions .btn {
  width: auto;
  flex: 1;
}

.media-export-link {
  display: inline-block;
  margin-bottom: var(--sp-2);
}

.voice-record-panel {
  padding: var(--sp-2) 0;
}

.voice-record-timer {
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
  margin: var(--sp-2) 0;
}

.voice-note {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--sp-2);
  align-items: center;
  margin-bottom: var(--sp-2);
}

.voice-play-btn {
  min-width: 2.5rem;
}

.voice-time {
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.voice-seek {
  grid-column: 1 / -1;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}

.voice-seek-fill {
  height: 100%;
  background: var(--accent);
}

.voice-review-words textarea {
  width: 100%;
  min-height: 5rem;
}

.reply-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
  padding: var(--sp-2);
  background: var(--surface-2);
  border-radius: var(--radius);
}

.reply-bar-excerpt {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-quote {
  display: block;
  width: 100%;
  margin-bottom: var(--sp-2);
  padding: var(--sp-2);
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  min-height: 48px;
}

.reply-quote:disabled {
  opacity: 0.85;
}

.reply-quote-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg.reply-highlight {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.reaction-row-wrap {
  margin: var(--sp-2) 0;
}

.reaction-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.reaction-pick {
  min-width: 48px;
  min-height: 48px;
  font-size: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.reaction-pick.selected {
  background: var(--surface-2);
  border-color: var(--accent);
}

.reaction-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.reaction-chip {
  min-height: 44px;
  padding: 0 var(--sp-2);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.reaction-chip.mine {
  border-color: var(--accent);
  background: var(--surface-2);
}

.inbox-screen {
  padding: var(--sp-4);
}

.inbox-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.inbox-title {
  font-size: var(--fs-large);
  font-weight: 700;
  line-height: var(--lh-large);
  margin: 0;
}

.inbox-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.inbox-row {
  width: 100%;
  text-align: left;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: var(--sp-2) 0;
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.inbox-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.inbox-row-line1,
.inbox-row-line2 {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}

.inbox-row-name {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-name);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inbox-row-time {
  font-size: var(--fs-secondary);
  color: var(--text-muted);
  flex-shrink: 0;
}

.inbox-row-time.unread {
  color: var(--accent);
  font-weight: 600;
}

.inbox-row-line2 {
  font-size: var(--fs-secondary);
  color: var(--text-muted);
}

.inbox-row-unread {
  margin-left: auto;
  min-width: 1.5rem;
  text-align: center;
  background: var(--btn);
  color: var(--on-accent);
  border-radius: 999px;
  padding: 0 var(--sp-1);
  font-size: var(--fs-label);
  font-weight: 600;
}

.inbox-row-muted {
  margin-left: auto;
  color: var(--text-muted);
}

.inbox-foot {
  margin-top: var(--sp-4);
  font-size: var(--fs-secondary);
}

.settings-group {
  background: var(--surface);
  border-radius: var(--r-card, 16px);
  overflow: hidden;
  flex-shrink: 0;
}

.settings-group:empty {
  display: none;
}

.settings-group .sheet-row {
  padding: 0 var(--sp-4);
  min-height: 52px;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-body);
  gap: var(--sp-3);
}

.settings-group .sheet-row:last-child {
  border-bottom: none;
}

.settings-group .sheet-row.info {
  cursor: default;
}

.settings-group .sheet-row:disabled {
  opacity: 1;
  cursor: default;
}

.settings-group .row-text {
  flex: 1;
  min-width: 0;
  padding: var(--sp-3) 0;
}

.settings-group .row-value {
  text-align: right;
  max-width: 55%;
  color: var(--text-2);
  font-size: var(--fs-secondary);
}

.settings-group .row-icon {
  display: inline-flex;
}

.settings-group .row-icon .look-dot {
  margin-right: 0;
}

.row-chevron {
  display: inline-flex;
  color: var(--text-3);
  margin-right: -6px;
}

.row-chevron svg {
  width: 18px;
  height: 18px;
}

.settings-group .sheet-row.accent {
  color: var(--accent);
  font-weight: 600;
}

.settings-group .sheet-row.danger {
  margin-top: 0;
  justify-content: center;
  font-weight: 600;
}

.settings-group .sheet-row.danger .row-text {
  flex: 0 1 auto;
}

.settings-group .sheet-row.info.stack {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding-top: var(--sp-3);
  padding-bottom: var(--sp-3);
}

.settings-group .sheet-row.info.stack .row-text {
  padding: 0;
}

.settings-group .sheet-row.info.stack .row-value {
  text-align: left;
  max-width: none;
}

.settings-head {
  margin: var(--sp-2) 0 calc(-1 * var(--sp-2)) var(--sp-1);
  font-size: var(--fs-caption, 0.8125rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-2);
}

.settings-note {
  margin: 0 var(--sp-1);
  font-size: var(--fs-secondary);
  line-height: 1.45;
  color: var(--text-2);
}

.settings-group + .settings-note {
  margin-top: calc(-1 * var(--sp-2));
}

.settings-version {
  margin: 0;
  text-align: center;
  font-size: var(--fs-secondary);
  color: var(--text-3);
}

.look-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: var(--sp-2);
}

.look-dot-teal {
  background: #0f766e;
}

.look-dot-rose {
  background: #b4235a;
}

.look-dot-blue {
  background: #1d5fd1;
}

.look-dot-classic {
  background: #1f6f6b;
}

.look-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.look-tile {
  border: 2px solid var(--line);
  border-radius: var(--r-card);
  padding: var(--sp-3);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  font: inherit;
  color: inherit;
}

.look-tile.selected {
  border-color: var(--accent);
}

.look-tile-bubbles {
  /* A tiny chat: one bubble from the partner, one from you (0.7.4: the tiles showed "…" text). */
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 10px;
  border-radius: 12px;
  background: var(--preview-bg);
}

.look-tile-bubbles[data-scheme="light"] {
  --preview-bg: #f6f3ee;
  --their: #ffffff;
  --text: #1c1915;
  --shadow: 0 1px 2px rgba(28, 25, 21, 0.1);
}

.look-tile-bubbles[data-scheme="dark"] {
  --preview-bg: #12110f;
  --their: #25221e;
  --text: #eee8df;
  --shadow: none;
}

.look-tile-bubbles[data-look="teal"][data-scheme="light"] {
  --own: #0f766e;
  --on-own: #ffffff;
}

.look-tile-bubbles[data-look="teal"][data-scheme="dark"] {
  --own: #11635c;
  --on-own: #ffffff;
}

.look-tile-bubbles[data-look="rose"][data-scheme="light"] {
  --own: #b4235a;
  --on-own: #ffffff;
}

.look-tile-bubbles[data-look="rose"][data-scheme="dark"] {
  --own: #93204d;
  --on-own: #ffffff;
}

.look-tile-bubbles[data-look="blue"][data-scheme="light"] {
  --own: #1d5fd1;
  --on-own: #ffffff;
}

.look-tile-bubbles[data-look="blue"][data-scheme="dark"] {
  --own: #1f4fa8;
  --on-own: #ffffff;
}

.look-tile-bubbles[data-look="classic"][data-scheme="light"] {
  --own: #ddedea;
  --on-own: #1c1915;
}

.look-tile-bubbles[data-look="classic"][data-scheme="dark"] {
  --own: #1f3533;
  --on-own: #eee8df;
}

.look-preview-bubble {
  display: block;
  height: 16px;
  border-radius: 8px;
}

.look-preview-bubble.their {
  width: 62%;
  align-self: flex-start;
  border-bottom-left-radius: 3px;
}

.look-preview-bubble.own {
  width: 52%;
  align-self: flex-end;
  border-bottom-right-radius: 3px;
}

.look-preview-bubble.their {
  background: var(--their);
  color: var(--text);
  box-shadow: var(--shadow);
}

.look-preview-bubble.own {
  background: var(--own);
  color: var(--on-own);
  box-shadow: none;
}

.segmented {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--r-button);
  padding: 2px;
  gap: 2px;
  margin-bottom: var(--sp-3);
}

.segmented-item {
  flex: 1;
  min-height: var(--tap);
  border: none;
  border-radius: calc(var(--r-button) - 2px);
  background: transparent;
  font: inherit;
  font-size: var(--fs-secondary);
  cursor: pointer;
  color: var(--text);
}

.segmented-item.selected {
  background: var(--surface);
  box-shadow: var(--shadow);
}

.section-head {
  font-size: var(--fs-caption);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 var(--sp-2);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: var(--sp-3) var(--sp-4);
}

.list-row {
  min-height: 52px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.toggle {
  position: relative;
  width: 51px;
  height: 31px;
  border-radius: 999px;
  border: none;
  background: var(--surface-2);
  cursor: pointer;
  flex-shrink: 0;
}

.toggle[aria-checked="true"] {
  background: var(--btn);
}

.toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform var(--motion-fade);
}

.toggle[aria-checked="true"]::after {
  transform: translateX(20px);
}

.day-pill {
  border: 0;
  font-family: inherit;
  /* Compact and centred in the thread (0.7.3 audit: full-width bars). */
  align-self: center;
  width: auto;
  margin: var(--sp-3) auto var(--sp-1);
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-chip);
  background: var(--surface-2);
  font-size: var(--fs-caption);
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: var(--lh-caption);
  color: var(--text);
}

.day-pill.action {
  background: var(--soft);
  color: var(--accent);
  min-height: 44px;
  padding: 0 var(--sp-4);
  letter-spacing: 0;
  cursor: pointer;
}

.look-foot {
  font-size: var(--fs-secondary);
}

.top-bar-back {
  margin-right: var(--sp-2);
  position: relative;
}

.top-bar-back-dot::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

/* r7b avatar begin */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--avatar-px, 36px);
  height: var(--avatar-px, 36px);
  border-radius: var(--r-chip, 999px);
  background: var(--surface-2, var(--surface));
  color: var(--text, inherit);
  flex-shrink: 0;
  overflow: hidden;
  -webkit-touch-callout: none;
  user-select: none;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  -webkit-touch-callout: none;
  user-select: none;
  pointer-events: none;
}

.avatar-img-photo {
  max-width: none;
}

.avatar-initials {
  font-size: var(--fs-label, 0.8125rem);
  font-weight: 600;
  line-height: 1;
  user-select: none;
}

.top-bar-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}

.top-bar-title h1 {
  margin: 0;
  min-width: 0;
}

.inbox-row-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
}

.inbox-row-avatar {
  flex-shrink: 0;
}

.settings-profile-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  min-height: var(--tap-row);
  padding: var(--sp-2) var(--sp-4);
  margin: 0;
  border: none;
  background: var(--surface);
  color: var(--text);
  text-align: start;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}

.settings-profile-text {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  min-width: 0;
}

.settings-profile-title {
  font-size: var(--fs-label);
  color: var(--text-muted);
}

.settings-profile-name {
  font-size: var(--fs-body);
}

.settings-profile-partner {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-4) var(--sp-3);
  border-bottom: 1px solid var(--line);
}

.avatar-sheet-hint {
  margin: 0 0 var(--sp-3);
}

.avatar-sheet-preview-row {
  display: flex;
  justify-content: center;
  padding: var(--sp-3) 0 var(--sp-4);
}

.photo-place {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: var(--sp-4, 16px);
  padding-top: max(var(--sp-4, 16px), env(safe-area-inset-top));
  padding-bottom: max(var(--sp-6, 32px), env(safe-area-inset-bottom));
  background: #0e0d0c;
  color: #f2ebe3;
}

.photo-place-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--sp-2, 8px);
  margin-bottom: var(--sp-2, 8px);
}

.photo-place-cancel {
  justify-self: start;
  min-height: var(--tap-row, 44px);
  padding: var(--sp-2, 8px);
  border: none;
  background: transparent;
  color: #f2ebe3;
  font-size: var(--fs-body, 1rem);
  cursor: pointer;
}

.photo-place-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
}

.photo-place-head-spacer {
  width: 1px;
  justify-self: end;
}

.photo-place-hint {
  margin: 0 0 var(--sp-3, 12px);
  text-align: center;
  font-size: var(--fs-secondary, 0.875rem);
  color: #c9bfb3;
}

.photo-place-stage-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.photo-place-stage {
  position: relative;
  overflow: hidden;
  border-radius: var(--sp-2, 8px);
  background: #1a1816;
}

.photo-place-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  -webkit-touch-callout: none;
  user-select: none;
  touch-action: none;
}

.photo-place-mask {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 50%;
  box-shadow: 0 0 0 9999px rgba(14, 13, 12, 0.55);
}

.photo-place-size {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2, 8px);
  margin: var(--sp-4, 16px) 0;
  color: #f2ebe3;
}

.photo-place-size-label {
  font-size: var(--fs-secondary, 0.875rem);
  font-weight: 600;
}

.photo-place-size input[type="range"] {
  width: 100%;
}

.photo-place-actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2, 8px);
}

.photo-place-err {
  margin: var(--sp-2, 8px) 0 0;
  color: var(--warn, #f2b866);
  text-align: center;
}
/* r7b avatar end */

/* r7c location begin */
.loc-composer-btn {
  color: var(--text, var(--text-muted));
}

.loc-map {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background: var(--surface-2, var(--surface));
}

.loc-map--card {
  width: 244px;
  max-width: 100%;
  height: 104px;
}

.loc-map--partner {
  width: 100%;
  height: 120px;
}

.loc-map-grid {
  position: absolute;
  inset: 0;
  background-color: var(--surface-2, var(--surface));
  background-image:
    linear-gradient(var(--line, var(--border)) 1px, transparent 1px),
    linear-gradient(90deg, var(--line, var(--border)) 1px, transparent 1px);
  background-size: 16px 16px;
}

.loc-map-tile {
  position: absolute;
  display: block;
  pointer-events: none;
  user-select: none;
}

.loc-map-pin-center {
  position: absolute;
  transform: translate(-50%, -65%);
  pointer-events: none;
}

.loc-map-pin {
  width: 28px;
  height: 34px;
  color: var(--accent, var(--own));
}

.loc-map-accuracy-ring {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid var(--accent, var(--own));
  opacity: 0.35;
  pointer-events: none;
  box-sizing: border-box;
}

.loc-map-credit {
  position: absolute;
  right: var(--sp-1, 4px);
  bottom: var(--sp-1, 4px);
  padding: 2px var(--sp-1, 4px);
  border-radius: 999px;
  font-size: 10px;
  line-height: 1.2;
  color: var(--text-2, var(--text-muted));
  background: color-mix(in srgb, var(--surface, var(--bg)) 80%, transparent);
  text-decoration: none;
  z-index: 2;
}

.loc-pin {
  flex-shrink: 0;
  color: var(--accent, var(--own));
}

.loc-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2, 8px);
  max-width: 244px;
}

.loc-card-title {
  font-weight: 600;
  color: var(--text, var(--text-muted));
}

.loc-card-accuracy {
  font-size: 0.875rem;
}

.loc-open-maps-chip {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: var(--sp-1, 4px) var(--sp-2, 8px);
  border-radius: 999px;
  border: 1px solid var(--line, var(--border));
  color: var(--accent, var(--own));
  text-decoration: none;
  font-size: 0.875rem;
}

.loc-ask-card {
  margin-bottom: var(--sp-2, 8px);
  padding: var(--sp-2, 8px);
  border-radius: var(--radius, 12px);
  border: 1px solid var(--line, var(--border));
  background: var(--surface, var(--bg));
}

.loc-ask-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2, 8px);
  margin-top: var(--sp-2, 8px);
}

.loc-partner-section {
  margin-top: var(--sp-3, 12px);
  padding-top: var(--sp-2, 8px);
  border-top: 1px solid var(--line, var(--border));
  display: flex;
  flex-direction: column;
  gap: var(--sp-2, 8px);
}

.loc-partner-lastseen-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.loc-partner-lastseen-time {
  font-weight: 600;
}

.loc-partner-quiet {
  min-height: 0.5rem;
  margin: var(--sp-2, 8px) 0;
}

.loc-setting-block {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1, 4px);
}

.loc-setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-2, 8px);
}

.loc-setting-foot {
  font-size: 0.875rem;
}

.loc-sheet-err {
  margin-top: var(--sp-1, 4px);
}

.loc-sheet-denied {
  margin-bottom: var(--sp-2, 8px);
}
/* r7c location end */

/* r7 lead: a profile picture and a map picture are never draggable or savable by long-press (contract 2.16) */
.avatar-img,
.loc-map-tile {
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  user-select: none;
}
/* r7 lead end */
/* face to face (talk) */
.talk-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-height: 100dvh;
  background: var(--bg);
}

.talk-halves {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.talk-halves--flipped .talk-half--partner {
  transform: rotate(180deg);
}

.talk-half {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
}

.talk-half--partner {
  background: var(--surface-2);
}

.talk-half--user {
  background: var(--surface);
}

.talk-half-who {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.talk-half-who-line {
  font-size: var(--fs-body);
  font-weight: 600;
}

.talk-initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
  flex-shrink: 0;
  border: 1px solid var(--line);
}

.talk-half-hint {
  font-size: var(--fs-label);
  margin: 0;
}

.talk-half-other-words {
  font-size: 1.75rem; /* UX_v2: Face to face type */
  line-height: 1.3;
  font-weight: 600;
  margin: 0;
  flex: 1 1 auto;
}

.talk-half-own-words {
  font-size: var(--fs-label);
  margin: 0;
  color: var(--text-muted);
}

.talk-half-hear {
  width: auto;
  min-height: 44px;
  font: inherit;
  padding: 0 var(--sp-3);
  align-self: flex-start;
}

.talk-pill {
  min-height: 64px;
  width: 100%;
  border-radius: 999px;
  border: 2px solid var(--accent);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-body);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  margin-top: auto;
}

.talk-pill:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.talk-pill--recording {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--surface);
}

.talk-pill-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
}

.talk-middle {
  flex: 0 0 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: 0 var(--sp-3);
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.talk-middle-saved {
  font-size: var(--fs-label);
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  flex: 1 1 auto;
}

.talk-close,
.talk-turn-btn {
  min-height: 48px;
  min-width: 48px;
  font: inherit;
  cursor: pointer;
}

/* The way out of face to face must be unmistakable: a filled button with an X and the word Close. */
.talk-close {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 0 var(--sp-4) 0 var(--sp-3);
  border: 0;
  border-radius: var(--r-chip);
  background: var(--btn);
  color: var(--on-own);
  font-weight: 600;
  font-size: var(--fs-body);
}

.talk-close-icon {
  display: inline-flex;
}

.talk-turn-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  padding: 0;
}

.talk-turn-btn[aria-pressed="true"] {
  background: var(--soft);
  color: var(--accent);
  border-color: var(--accent);
}

.talk-empty {
  color: var(--warn-text);
  background: var(--warn-bg);
  border-radius: var(--r-block);
  padding: var(--sp-3);
  margin: var(--sp-3) var(--sp-4);
}

.talk-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  width: 100%;
}

.talk-card-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-label);
  font-weight: 600;
  /* The card sits on the own bubble (white text on the accent fill) or the their bubble: inherit, never a fixed colour. */
  color: inherit;
  margin: 0 0 var(--sp-1);
}

.talk-card-turns {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.talk-card-turn-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-1);
}

.talk-card-turn-who {
  font-weight: 600;
  font-size: var(--fs-body);
}

.talk-card-turn-text {
  font-size: var(--fs-body);
  margin: 0;
  line-height: var(--lh);
}

.talk-card-turn-orig {
  font-size: var(--fs-label);
  margin: var(--sp-1) 0 0;
  color: inherit;
  opacity: 0.85;
}

.talk-card-more {
  border: none;
  background: none;
  color: inherit;
  text-decoration: underline;
  font: inherit;
  font-weight: 600;
  min-height: 44px;
  text-align: left;
  padding: 0;
  cursor: pointer;
}

.conversation-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  background: var(--bg);
}

.conversation-panels {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.conv-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  /* Together and You are taller than the screen: they scroll INSIDE the panel, so the tab bar stays at the bottom
     (0.7.2 on the iPhone: the whole page scrolled and the tab bar ended up in the middle of the Together cards). */
  overflow-y: auto;
  overscroll-behavior: contain;
}

.conv-panel[hidden] {
  display: none !important;
}

.thread-in-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.thread-in-shell .thread {
  flex: 1;
}

.tab-bar {
  display: flex;
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.tab-bar-btn {
  flex: 1;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-2);
  background: transparent;
  border: 0;
  font-size: 11px;
  font-weight: 600;
}

.tab-bar-btn.active {
  color: var(--accent);
}

.tab-bar-icon svg {
  width: 24px;
  height: 24px;
}

.you-tab {
  padding: var(--sp-3) var(--sp-4);
  overflow-y: auto;
}

.you-version {
  margin-top: var(--sp-4);
}

.partner-sheet-head {
  text-align: center;
  margin-bottom: var(--sp-4);
}

.partner-sheet-name {
  font-size: var(--fs-title);
  font-weight: 700;
  margin: var(--sp-2) 0 0;
}

.partner-sheet-reads {
  margin-top: var(--sp-2);
}

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-2);
}

.cal-month {
  font-size: var(--fs-title);
  font-weight: 700;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: var(--fs-caption);
  color: var(--text-2);
  margin-bottom: var(--sp-1);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: var(--sp-3);
}

.cal-day {
  height: 46px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: var(--r-button);
  position: relative;
}

.cal-day.out {
  color: var(--text-3);
}

.cal-day.today {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.cal-day.chosen {
  background: var(--btn);
  color: var(--on-own);
}

.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 2px;
}

.cal-dot.skel {
  background: var(--surface-2);
}

.cal-chips {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.chip-btn {
  flex: 1;
  min-height: var(--tap);
  border-radius: var(--r-chip);
  background: var(--surface-2);
  border: 0;
  font-weight: 600;
}

.day-nav-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.day-nav-back {
  flex: 1;
  min-height: 44px;
  position: relative;
  /* Filled accent pill (0.7.4: it had no style and showed as a grey system button). */
  border: 0;
  border-radius: 999px;
  background: var(--btn);
  color: var(--on-accent);
  font-weight: 600;
  font-size: var(--fs-body);
  cursor: pointer;
}

.day-nav-back.has-dot::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.day-nav-side {
  min-width: 72px;
  font-family: inherit;
  cursor: pointer;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: var(--fs-secondary);
}

.history-empty-today {
  text-align: center;
  margin: var(--sp-1) 0 var(--sp-2);
}

.day-pill-icon {
  display: inline-flex;
}

.day-pill-icon svg {
  width: 16px;
  height: 16px;
}

/* r7 integration slots begin */
.you-photo-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1, 4px);
  padding: var(--sp-3, 12px) 0 var(--sp-4, 16px);
}

.you-photo-avatar-btn {
  position: relative;
  display: inline-flex;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 999px;
  min-width: 44px;
  min-height: 44px;
}

.you-photo-badge {
  position: absolute;
  right: 0;
  bottom: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--own);
  color: var(--on-own);
  border: 2px solid var(--bg);
}

.you-photo-badge svg {
  width: 18px;
  height: 18px;
}

.you-photo-name {
  margin: var(--sp-2, 8px) 0 0;
  font-size: var(--fs-title);
  font-weight: 700;
}

.you-photo-line {
  margin: 0;
  font-size: var(--fs-secondary);
  text-align: center;
}

.you-photo-soft-btn {
  min-height: 44px;
  padding: 0 var(--sp-4, 16px);
  margin-top: var(--sp-2, 8px);
  border: 0;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent);
  font-size: var(--fs-secondary);
  font-weight: 600;
}

.loc-attach {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1, 4px);
}

.loc-you-switch {
  margin-top: var(--sp-3, 12px);
}

.loc-ask-slot {
  margin: 0 var(--sp-3, 12px);
}
/* r7 integration slots end */
.talk-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Together tab (couple manager), UX_v2 7.7. Redesigned 2026-11-14 after the owner's iPhone check ("all puzzled up"):
   16 px gutter, an accent countdown card, sheets for every form, token colours for every control in light and dark. */
.tg-page {
  padding: var(--sp-3) var(--sp-4) var(--sp-6);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.tg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin: var(--sp-2) 0 var(--sp-1);
}

.tg-head .large-title {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
}

.tg-avatars {
  display: flex;
  flex-shrink: 0;
}

.tg-avatar {
  display: inline-flex;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--bg);
}

.tg-avatar + .tg-avatar {
  margin-left: -8px;
}

.tg-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-2);
  box-shadow: var(--shadow);
}

.tg-caption {
  margin: 0;
  font-size: var(--fs-caption);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-2);
}

.tg-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

.tg-muted {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--text-2);
}

/* Countdown: the accent card. */
.tg-count {
  background: var(--btn);
  border: 0;
  color: #ffffff;
  gap: var(--sp-1);
}

.tg-count-num {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
}

.tg-count-n {
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1;
}

.tg-count-word {
  font-size: 1.25rem;
  font-weight: 600;
  text-transform: lowercase;
}

.tg-count-until,
.tg-count-today {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.35;
  opacity: 0.95;
}

.tg-count-today {
  font-size: 1.25rem;
  font-weight: 700;
}

.tg-count-actions {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

/* Buttons used in this tab (auto width, never browser grey). */
.tg-btn {
  min-height: 48px;
  padding: 0 var(--sp-4);
  border-radius: var(--r-chip);
  border: 0;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  text-align: center;
}

.tg-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.tg-btn-primary {
  background: var(--btn);
  color: #ffffff;
}

.tg-btn-quiet {
  background: var(--soft);
  color: var(--accent);
  min-height: 44px;
}

.tg-btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--line);
}

.tg-btn-onaccent {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  min-height: 44px;
}

.tg-btn-icon {
  width: 44px;
  padding: 0;
}

.tg-btn-block {
  width: 100%;
  margin-top: var(--sp-2);
}

.tg-link {
  min-height: 44px;
  padding: 0 var(--sp-1);
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  cursor: pointer;
}

.tg-link-icon {
  display: inline-flex;
}

.tg-link-icon svg {
  width: 20px;
  height: 20px;
}

.tg-icon-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.tg-icon-btn svg {
  width: 20px;
  height: 20px;
}

.tg-section-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tg-h {
  min-height: 0;
}

/* Lists (Coming up, To-do). */
.tg-list {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
}

.tg-list > li + li {
  border-top: 1px solid var(--line);
}

.tg-item {
  width: 100%;
  min-height: 56px;
  padding: var(--sp-2) 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  cursor: pointer;
}

.tg-date {
  width: 44px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
}

.tg-date-day {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

.tg-date-wd {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
}

.tg-item-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tg-item-title {
  font-size: 1.0625rem;
  line-height: 1.35;
  color: var(--text);
  overflow-wrap: anywhere;
}

.tg-item-sub {
  font-size: 0.875rem;
  color: var(--text-2);
}

.tg-chev {
  display: inline-flex;
  color: var(--text-3);
}

.tg-todo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 56px;
  padding: var(--sp-1) 0;
}

.tg-check {
  width: 26px;
  height: 26px;
  margin: 9px;
  flex-shrink: 0;
  border-radius: 8px;
  border: 2px solid var(--text-2);
  background: transparent;
  color: #ffffff;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.tg-check-on {
  background: var(--btn);
  border-color: var(--btn);
}

.tg-check-on svg {
  width: 16px;
  height: 16px;
}

.tg-todo-done .tg-item-title {
  text-decoration: line-through;
  color: var(--text-2);
}

/* Fields: token colours, 16 px text (no iOS zoom), never a white box in dark mode. */
.tg-input {
  width: 100%;
  min-height: 48px;
  box-sizing: border-box;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  color-scheme: light dark;
}

.tg-input::placeholder {
  color: var(--text-2);
}

.tg-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.tg-textarea {
  resize: vertical;
  min-height: 96px;
  line-height: 1.45;
}

.tg-field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  width: 100%;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-2);
}

.tg-field-row {
  display: flex;
  gap: var(--sp-2);
  width: 100%;
}

.tg-field-row .tg-field {
  flex: 1 1 0;
  min-width: 0;
}

.tg-add {
  display: flex;
  gap: var(--sp-2);
  width: 100%;
}

.tg-add .tg-input {
  flex: 1 1 auto;
  min-width: 0;
}

.tg-add-btn {
  flex-shrink: 0;
}

.tg-add-date-toggle {
  min-height: 44px;
  font-size: 0.9375rem;
}

/* Today's question. */
.tg-moods {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  width: 100%;
  margin: var(--sp-2) 0;
}

.tg-mood {
  flex: 1 1 0;
  min-width: 56px;
  min-height: 44px;
  padding: 0 var(--sp-2);
  border-radius: var(--r-chip);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
}

.tg-mood.mgr-mood-on {
  background: var(--btn);
  border-color: var(--btn);
  color: #ffffff;
}

.tg-counter {
  font-size: 0.8125rem;
}

.tg-answer {
  width: 100%;
  box-sizing: border-box;
  padding: var(--sp-3);
  border-radius: 12px;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-1);
}

.tg-answer-who {
  margin: 0;
  font-size: var(--fs-caption);
  font-weight: 600;
  color: var(--text-2);
}

.tg-answer-text {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.45;
  color: var(--text);
  overflow-wrap: anywhere;
}

.tg-mood-tag {
  display: inline-flex;
  padding: 2px var(--sp-2);
  border-radius: var(--r-chip);
  background: var(--soft);
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 600;
}

.tg-row-actions {
  display: flex;
  gap: var(--sp-2);
}

.tg-notice {
  width: 100%;
  box-sizing: border-box;
  margin-top: var(--sp-1);
  padding: var(--sp-3);
  border-radius: 12px;
  background: var(--warn-bg);
  color: var(--warn);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-2);
}

.tg-notice p {
  margin: 0;
  font-size: 0.9375rem;
}

/* Hooks kept for other code and tests (the old .mgr-* names). */
.mgr-hit {
  min-height: 44px;
}

.mgr-note {
  font-size: 0.875rem;
}
