/* Text-only scaling within chat. Other app screens keep their own layout. */
:root { --chat-font-size: 15px; }
#messages, #waitingMessages, .chat-text-size-preview { font-size: var(--chat-font-size); }
#messages .bubble, #waitingMessages .compact-chat, .chat-text-size-preview .bubble {
  font-size: inherit; line-height: 1.5; min-width: 0;
  overflow-wrap: anywhere; word-break: normal;
}
#chatScreen .bubble-content, #messages .notification-body,
#messages .commute-notification-body, #messages .reminder-notification-copy,
#messages .reminder-notification-copy b, #messages .reminder-notification-copy .notice-heading,
#messages .chat-component, #messages .chat-list-collection b, #messages .chat-list-item b,
#messages .attachment-message-copy span { font-size: 1em; line-height: 1.5; }
#messages .notice-aside, #messages .reminder-notification-copy .notice-aside { font-size: .92em; line-height: 1.5; }
#messages .meta, #messages .notification-time, #messages .attachment-message-copy b,
#messages .chat-component header small, #messages .chat-component footer small,
#messages .chat-list-collection small, #messages .chat-component-more,
#messages .chat-component-empty, #messages .chat-component-loading,
#messages .chat-component-error { font-size: .8em; line-height: 1.45; }
#messages .notification-title { font-size: 1em; line-height: 1.35; min-width: 0; }
#messages .notification-header { flex-wrap: wrap; align-items: start; }
#messages .notification-time { white-space: normal; }
#messages .notification-body, #messages .reminder-notification-copy,
#messages .commute-notification-copy, #messages .chat-component-host,
#messages .chat-component header span, #messages .chat-list-collection span { min-width: 0; overflow-wrap: anywhere; }
#messages .notification-card, #messages .chat-component-host { max-width: 100%; }
#messages .chat-component header, #messages .chat-component footer { flex-wrap: wrap; }
#messages .chat-component header b { font-size: 1.2em; line-height: 1.35; overflow-wrap: anywhere; }
#messages .chat-component header em { font-size: .8em; white-space: normal; }
#messages .chat-list-add { grid-template-columns: minmax(0, 1fr) auto; }
#messages .chat-list-add input { font-size: max(16px, var(--chat-font-size)); }
#messages .chat-list-add button { width: auto; height: auto; }
#messages button, .chat-text-size-settings button {
  min-height: 44px; min-width: 44px; max-width: 100%; height: auto;
  font-size: 1em; line-height: 1.35; white-space: normal; overflow-wrap: anywhere;
}
#messages .reminder-card-actions, #messages .commute-card-actions,
#messages .air-next-moves { flex-wrap: wrap; min-width: 0; }
#messages .attachment-message-copy b { white-space: normal; overflow: visible; text-overflow: clip; }
#chatScreen .bubble-content a { overflow-wrap: anywhere; }
#chatScreen { touch-action: pan-x pan-y; }
.chat-text-size-slider { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.chat-text-size-slider > span:first-child { font-size: 14px; }
.chat-text-size-slider > span:last-child { font-size: 28px; }
.chat-text-size-slider input { width: 100%; min-width: 0; min-height: 44px; padding: 0; accent-color: var(--blue); }
.chat-text-size-preview { padding: 12px 0; }
.chat-text-size-preview .bubble { max-width: 100%; }
.chat-text-size-reset { padding: 8px 12px; color: var(--text); background: var(--surface2); border: 1px solid var(--line); border-radius: 8px; }
#messages { min-width: 0; max-width: 100%; }
#chatScreen .bubble-content h3 { font-size: 1.1em; line-height: 1.35; }
#messages .commute-notification-body p { font-size: inherit; }
#messages .reminder-card-status { font-size: .8em; line-height: 1.45; }
#chatScreen .dayline { font-size: calc(var(--chat-font-size) * .8); }
#composer { touch-action: pan-x pan-y; }
#composer #messageInput { font-size: max(16px, var(--chat-font-size)); overflow-y: auto; }
#messages .reminder-card-actions small { font-size: .8em; line-height: 1.45; white-space: normal; }
[data-chat-text-size-state]:empty { display: none; }

body:has(#chatScreen.active):not(:has(#detailScreen.active)) .app-shell { touch-action: pan-x pan-y; }
#composer { grid-template-columns: 44px minmax(0, 1fr) 44px; }
#composer .composer-btn { width: 44px; height: 44px; min-height: 44px; min-width: 44px; }

#chat-text-size-stops { display: none; }

/* Ordinary text bubbles only. Keep controls and delivery states on their own lines. */
#chatScreen .compact-chat { padding: 6px 10px; }
#chatScreen .compact-chat + .compact-chat { margin-block-start: -4px; }
#chatScreen .compact-chat .bubble-content { line-height: 1.4; }
#chatScreen .compact-chat.user { max-width: 88%; background: #34597a; color: #fff; }
:root[data-theme="light"] #chatScreen .compact-chat.user { background: #dce8f4; color: #19344d; }
#chatScreen .compact-chat.user a { color: inherit; text-decoration-color: currentColor; }
#chatScreen .chat-text-and-time { position: relative; }
#chatScreen .chat-text-and-time .meta, #chatScreen .chat-time-space {
  font: 400 max(11px, calc(var(--chat-font-size) * .733333)) / 1.3 var(--sans);
  letter-spacing: normal;
  white-space: nowrap;
}
#chatScreen .chat-time-space { display: inline-block; padding-inline-start: .65em; visibility: hidden; }
#chatScreen .chat-time-space::after { content: attr(data-time); }
#chatScreen .chat-text-and-time .meta { position: absolute; inset-inline-end: 0; inset-block-end: -2px; margin: 0; }
#chatScreen .compact-chat.user .meta { color: #e0eaf4; }
:root[data-theme="light"] #chatScreen .compact-chat.user .meta { color: #475d70; }
#chatScreen .compact-chat .bubble-content > :last-child { margin-block-end: 0; }

/* Settings and app text use the same scale as the chat text preference. */
#detailScreen .detail-head #detailTitle,
#lifeScreen .title-row h1,
#moreScreen .title-row h1 {
  font: 700 var(--ui-type-title)/1.2 var(--sans);
  overflow-wrap: anywhere;
}
#detailKicker { font-size: var(--ui-type-label); font-weight: 600; }
.settings-stack h2,
#detailContent :is(.notice-card h2, .lifeos-panel h2, .lifeos-panel h3,
  .mobile-money-shell .lifeos-panel h2, .pursuit-mobile-panel h2),
#detailContent .settings-form label[for="personality-voice"] {
  font: 650 var(--ui-type-heading)/1.35 var(--sans);
}
.settings-stack :is(.settings-note, .settings-card > p, .settings-choice small, .settings-menu-row small,
  .settings-avatar-note, .saved-instruction small, .personality-editor p),
:is(#lifeScreen,#moreScreen,#detailContent) :is(.life-tile small,.menu-copy small,.setup-card small,.help-row small),
#detailContent :is(.notice-card p,.lifeos-row small,.lifeos-summary-strip small,.lifeos-empty,
  .mobile-trip-row em,.commute-secondary,.package-secondary,.mobile-money-row small,
  .lifeos-item-secondary,.mobile-task-copy small,.pursuit-mobile small,.note-first-line),
#detailContent .wellness-shell :is(.wellness-row small,.wellness-note,.wellness-change),
#detailContent .reminders-shell .reminder-mobile-row small {
  font-size: var(--ui-type-secondary);
}
.settings-stack :is(.settings-choice b,.settings-menu-row b,.saved-instruction p),
:is(#lifeScreen,#moreScreen,#detailContent) :is(.life-tile b,.menu-copy b,.setup-card b,.help-row b),
#detailContent :is(.lifeos-row b,.lifeos-item-text,.mobile-trip-row b,.package-main,.commute-main) {
  font-size: var(--ui-type-body);
}
.settings-stack .settings-form label:not([for="personality-voice"]),
#detailContent :is(.lifeos-edit-form label,.reminder-mobile-form label,.reminder-mobile-weekdays legend,
  .commute-days legend,.mobile-money-shell .lifeos-edit-form label) {
  font-size: var(--ui-type-label);
  font-weight: 550;
}
#detailContent .lifeos-edit-form label small { font-size: inherit; }
.settings-stack .settings-form :is(input,textarea) { font-size: var(--ui-type-field); }
.settings-stack :is(.settings-form button,.settings-actions button,.danger-quiet),
#detailContent :is(.lifeos-segments button,.lifeos-edit-form > button,
  .lifeos-compose button,.detail-actions button,.detail-link,.commute-primary,.package-primary,
  .reminders-shell button:not(.reminder-mobile-open),.mobile-money-row button,.wellness-shell .wellness-primary,
  .wellness-shell .wellness-logged),
#detailContent .lifeos-filter-strip button {
  font-size: var(--ui-type-button);
  font-weight: 600;
}
#detailContent .wellness-shell {
  --wellness-type: var(--ui-type-body);
  --wellness-small: var(--ui-type-secondary);
}
#detailContent .lists-shell {
  --list-type: var(--ui-type-body);
  --list-small: var(--ui-type-secondary);
}
#detailContent .wellness-shell .wellness-nutrients small { font-size: var(--ui-type-secondary); }
#feedbackDialog h2 { font-size: var(--ui-type-heading); font-weight: 650; }
#feedbackDialog label { font-size: var(--ui-type-label); }
#feedbackDialog :is(input,textarea) { font-size: var(--ui-type-field); }
#feedbackDialog button:not(.close) { font-size: var(--ui-type-button); }

@media (max-width: 360px) {
  #lifeScreen .life-tile b { font-size: var(--ui-type-label); }
}

/* Metro compact, approved for chat cards. */
#messages .air-next-moves { max-width:100%; gap:4px; }
#messages .air-next-moves button { min-width:44px; min-height:44px; padding:4px 8px;
  font-size:var(--ui-type-button); line-height:1.2; border-radius:0; overflow-wrap:anywhere; }
#messages .notification-card .notification-header { padding:6px 9px; gap:6px; }
#messages .notification-card :is(.notification-title,.notification-time) {
  font-size:var(--ui-type-secondary); line-height:1.3;
}
#messages .notification-card .notification-body { padding:7px 9px 8px; font-size:var(--ui-type-body); line-height:1.3; }
#messages .notification-card :is(.notice-heading,.commute-notification-copy b) {
  font-size:var(--ui-type-body); line-height:1.3;
}
#messages .notification-card .notice-aside { margin-top:4px; font-size:var(--ui-type-secondary); line-height:1.3; }
#messages .notification-card .notification-body p { margin-bottom:4px; }
#messages .notification-card :is(.reminder-card-actions,.air-next-moves) {
  display:flex; flex-wrap:wrap; gap:4px; margin:4px 0 0; padding:0;
}
#messages .notification-card .reminder-card-status:empty { display:none; }
/* The invisible part of the button can use the card's bottom padding. */
#messages .notification-card .reminder-card-actions:has(> button:not([hidden])):has(> .reminder-card-status:empty) {
  margin-block:0 -8px;
}
#messages .notification-card .reminder-card-actions button { min-width:44px; min-height:44px; padding:4px 8px;
  font-size:var(--ui-type-button); line-height:1.2; border-radius:0; max-width:100%; }
#messages .notification-card .air-next-moves button { color:var(--nc-text); border-color:currentColor; }
