:root {
  color-scheme: light;
  --ink: #172e29;
  --body: #344c46;
  --muted: #637872;
  --accent: #087f68;
  --accent-dark: #06634f;
  --accent-soft: #e5f4ed;
  --line: #e4eae7;
  --surface: #fff;
  --danger: #b03a3a;
  --seen: #1a8fd1;
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Noto Sans Bengali', 'Nirmala UI', sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html { min-width: 280px; }
body { margin: 0; color: var(--body); font-size: 14px; line-height: 1.5; background: linear-gradient(#107963 0 116px, #e5e9e7 116px); }
button, input, select, textarea { font: inherit; }
button, input, select, textarea, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; transition: background-color .15s ease, color .15s ease, border-color .15s ease; }
button:disabled { opacity: .48; cursor: not-allowed; }
button, input, select, textarea { outline: none; }
:focus-visible { outline: 3px solid #37bba0; outline-offset: 2px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, p { margin: 0; }
svg { display: block; flex: 0 0 auto; width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.hidden, [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.muted, .source-note { color: var(--muted); }
.small, .muted.small { font-size: 11px; }
.source-note { font-size: 11px; line-height: 1.5; }
.eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }
.hint { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.brand-mark { display: grid; place-items: center; flex: 0 0 auto; width: 36px; height: 36px; background: var(--accent); color: white; border-radius: 12px; font-size: 23px; font-weight: 650; }

/* ------------------------------------------------------------ loading & sign-in */
.boot { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 16px; padding: 24px; text-align: center; background: #eef4f1; color: var(--muted); z-index: 50; }
.boot .brand-mark { width: 64px; height: 64px; border-radius: 20px; font-size: 38px; animation: breathe 1.6s ease-in-out infinite; }
.boot p { max-width: 420px; }
.auth { min-height: 100dvh; display: grid; place-items: start center; padding: clamp(16px, 6vh, 64px) 16px 40px; }
.auth-card { width: min(460px, 100%); padding: 28px; border-radius: 18px; background: white; box-shadow: 0 16px 60px #182f2926; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; color: var(--ink); font-size: 24px; font-weight: 750; letter-spacing: -1px; }
.auth h1 { color: var(--ink); font-size: 24px; line-height: 1.25; letter-spacing: -.5px; font-weight: 700; }
.auth-lead { margin-top: 8px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.auth-form { display: grid; gap: 16px; margin-top: 22px; }
.auth-form .form-field label, .auth-form .field-label { display: block; color: #3e5a50; font-size: 13px; font-weight: 650; margin-bottom: 6px; }
.auth-form input:not([type='checkbox']):not([type='radio']), .auth-form select { width: 100%; min-height: 46px; font-size: 16px; padding: 10px 12px; border-radius: 10px; }
.auth-foot { margin-top: 18px; color: var(--muted); font-size: 12px; line-height: 1.6; }
/* Create account, Forgot password?, Send a new code... under the sign-in form. */
.auth-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin-top: 14px; }
.auth-legal { margin: -6px 0 0; font-size: 13px; text-align: center; }
.auth-form .code-input { letter-spacing: 0.3em; font-size: 22px; text-align: center; font-variant-numeric: tabular-nums; }
/* Cloudflare's "I am a person" box, shown only when Cloudflare is unsure. */
.auth-form .robot-field:not([hidden]) { display: flex; justify-content: center; }
.password-row { display: flex; align-items: center; gap: 6px; }
.password-row input { flex: 1; }
.password-row .text-button { flex: 0 0 auto; min-width: 52px; }
.wide { width: 100%; }
.primary-button.wide, .secondary-button.wide { min-height: 48px; font-size: 15px; }
.auth-card > .secondary-button.wide { margin-top: 18px; }
.choice-field { margin: 0; padding: 0; border: 0; display: grid; gap: 8px; }
.choice-field legend { padding: 0; margin-bottom: 8px; color: #3e5a50; font-size: 13px; font-weight: 650; line-height: 1.45; }
.choice { display: flex; align-items: flex-start; gap: 10px; padding: 12px 13px; border: 1px solid #d6e4dc; border-radius: 12px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); }
.choice strong, .choice small { display: block; }
.choice strong { color: var(--ink); font-size: 14px; }
.choice small { color: var(--muted); font-size: 12px; margin-top: 2px; }
.problem-list { display: grid; gap: 10px; margin: 18px 0; padding-left: 20px; color: var(--body); font-size: 13px; line-height: 1.6; }
.check-field { display: flex; align-items: flex-start; gap: 10px; margin-top: 10px; font-size: 13px; line-height: 1.5; cursor: pointer; }
.check-field input[type='checkbox'] { width: 20px; height: 20px; min-width: 20px; margin: 0; accent-color: var(--accent); }
.loading { position: relative; color: transparent !important; }
.loading::after { content: ''; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; border: 2px solid #fff8; border-top-color: white; border-radius: 50%; animation: spin .8s linear infinite; }

/* phone / email input */
.identity-field { display: grid; gap: 8px; }
.identity-field .field-label { margin-bottom: 0; }
.phone-row { display: flex; gap: 6px; min-width: 0; }
/* The country picker stays compact; the number box takes the rest of the row. */
.phone-row > select { flex: 0 0 136px; width: 136px !important; min-width: 0; }
.phone-row > input { flex: 1 1 0; width: auto !important; min-width: 0; }
.identity-field > input { width: 100%; }
.segment-control { display: flex; gap: 5px; padding: 4px; border-radius: 9px; background: #eef3ed; }
.segment-control button { flex: 1; min-height: 34px; border: 0; border-radius: 7px; background: transparent; color: #627566; font-size: 13px; }
.segment-control button.active { background: white; color: #2c7249; box-shadow: 0 1px 4px #33453218; font-weight: 650; }
.segment-control.small { justify-self: start; min-width: 190px; }

/* ------------------------------------------------------------ app shell */
.app-shell { display: grid; grid-template-columns: 340px minmax(0,1fr); width: calc(100% - 32px); max-width: 1680px; height: calc(100dvh - 32px); min-height: 460px; margin: 16px auto; overflow: hidden; border-radius: 10px; background: white; box-shadow: 0 12px 50px #182f291a; }
.chat-sidebar { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: white; border-right: 1px solid #dce3df; z-index: 2; }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 70px; padding: 15px 16px 10px 20px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 25px; line-height: 1.1; font-weight: 750; letter-spacing: -1px; }
.brand:hover { text-decoration: none; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 20px 12px; }
.sidebar-heading h1 { font-size: 24px; letter-spacing: -.65px; color: var(--ink); font-weight: 700; }
.chat-search { display: flex; align-items: center; gap: 10px; margin: 0 16px 10px; padding: 0 12px; border-radius: 9px; background: #f0f3f1; color: #73867e; min-height: 40px; }
.chat-search svg { width: 17px; height: 17px; }
.chat-search input { width: 100%; min-width: 0; padding: 10px 0; border: 0 !important; background: transparent !important; color: var(--ink); font-size: 14px; }
.chat-search.in-dialog { margin: 0 0 10px; }
.chat-filters { display: flex; align-items: center; gap: 7px; padding: 0 16px 12px; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 5px 12px; border: 0; border-radius: 20px; background: #f0f3f1; color: var(--muted); font-size: 13px; }
.filter-chip.active { background: #ddf3e5; color: #176b42; font-weight: 650; }
.chip-count:empty { display: none; }
.chip-count { min-width: 18px; padding: 0 5px; border-radius: 9px; background: #ffffffb0; font-size: 11px; text-align: center; }
.chat-list { flex: 1; min-height: 0; overflow: auto; }
.chat-list-item { display: flex; align-items: center; gap: 12px; width: 100%; min-width: 0; padding: 12px 16px; text-align: left; border: 0; border-bottom: 1px solid #f0f2f0; background: white; color: var(--ink); }
.chat-list-item:hover { background: #f6f8f6; }
.chat-list-item.active { background: #eaf2ed; }
.chat-list-item .avatar { width: 48px; height: 48px; font-size: 18px; }
.chat-list-copy { flex: 1; min-width: 0; display: grid; gap: 3px; }
.chat-list-top, .chat-list-bottom { display: flex; align-items: center; gap: 8px; min-width: 0; }
.chat-list-top strong { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 15px; font-weight: 650; }
.chat-list-top time { flex: 0 0 auto; color: var(--muted); font-size: 11px; }
.chat-list-item.unread .chat-list-top time { color: var(--accent); font-weight: 650; }
.chat-list-bottom small { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); font-size: 13px; }
.chat-list-item.unread .chat-list-bottom small { color: var(--ink); }
.chat-list-bottom small.typing { color: var(--accent); font-style: italic; }
.unread-badge { flex: 0 0 auto; min-width: 21px; height: 21px; padding: 0 6px; border-radius: 11px; background: #1fae78; color: white; font-size: 11px; font-weight: 700; line-height: 21px; text-align: center; }
.notify-card { margin: 6px 14px 10px; padding: 12px 14px; border: 1px solid #cfe7d8; border-radius: 12px; background: #f1f9f4; font-size: 13px; }
.notify-card .button-row { margin-top: 8px; }
.list-empty { padding: 28px 22px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.6; }
.list-empty strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 6px; }
.list-empty .primary-button { margin-top: 14px; }
.sidebar-footer { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 12px 18px; border-top: 1px solid var(--line); background: #fafcfb; }
.sidebar-footer strong { display: block; color: var(--ink); font-size: 13px; font-weight: 650; }
.sidebar-footer small { display: block; color: var(--muted); font-size: 11px; }
.avatar { display: grid; place-items: center; flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; background: #d5eae0; color: #24795d; font-weight: 700; font-size: 16px; }
.avatar.group { background: #e1e4f4; color: #4d5aa3; }
.avatar.small { width: 34px; height: 34px; font-size: 14px; }
.avatar.large { width: 96px; height: 96px; font-size: 40px; }

.conversation { display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
.conversation-header { display: flex; align-items: center; gap: 12px; min-height: 70px; padding: 10px 20px; border-bottom: 1px solid #dfe6e1; background: #f5f7f5; }
.conversation-heading { flex: 1; min-width: 0; padding: 4px 0; border: 0; background: transparent; text-align: left; color: inherit; }
.conversation-heading h2 { color: var(--ink); font-size: 16px; font-weight: 650; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.conversation-heading p { color: var(--muted); font-size: 12px; margin-top: 1px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.conversation-heading p.typing { color: var(--accent); font-style: italic; }
.header-actions { display: flex; align-items: center; gap: 4px; }
.mobile-back { display: none !important; }
#global-notice { flex: 0 0 auto; margin: 0; border-radius: 0; border-width: 0 0 1px; font-size: 12px; }
.chat-messages { display: flex; flex-direction: column; align-items: stretch; flex: 1; gap: 6px; min-height: 110px; overflow: auto; overscroll-behavior: contain; padding: 22px clamp(14px,5vw,80px); background-color: #eeeae1; background-image: radial-gradient(#93a38c25 .85px,transparent .85px),radial-gradient(#fff8 .7px,transparent .7px); background-size: 28px 28px,36px 36px; background-position: 0 0,12px 14px; }
.chat-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; min-height: 180px; padding: 26px 20px; text-align: center; color: var(--muted); }
.chat-empty.small { flex: 0 0 auto; min-height: 0; margin: auto 0; }
.welcome-mark { display: grid; place-items: center; width: 68px; height: 68px; margin-bottom: 16px; border-radius: 22px; background: var(--accent); color: white; font-size: 40px; font-weight: 650; }
.chat-empty h3 { color: #29493b; font-size: 22px; line-height: 1.35; font-weight: 650; letter-spacing: -.5px; max-width: 440px; }
.chat-empty p { max-width: 420px; margin-top: 10px; font-size: 14px; line-height: 1.7; color: #5d7066; }
.button-row.center { justify-content: center; margin-top: 18px; }
.loading-line { margin: auto; }
.day-label { align-self: center; margin: 8px 0 4px; padding: 4px 10px; border-radius: 7px; background: #fffdf8e6; color: #66766b; box-shadow: 0 1px 1px #23392a0d; font-size: 11px; }
.system-line { align-self: center; max-width: 85%; margin: 4px 0; padding: 5px 12px; border-radius: 8px; background: #fdf6dc; color: #6e6233; font-size: 12px; text-align: center; }
.load-earlier { align-self: center; min-height: 30px; font-size: 12px; }
.message-bubble { position: relative; max-width: min(78%, 620px); padding: 7px 10px 5px; border-radius: 0 10px 10px; background: white; color: #1f3a30; box-shadow: 0 1px 1.5px #2b3e2e1a; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; cursor: pointer; }
.message-bubble.incoming { align-self: flex-start; }
.message-bubble.outgoing { align-self: flex-end; border-radius: 10px 0 10px 10px; background: #d9f6c8; }
.message-bubble.incoming::before { content: ''; position: absolute; top: 0; left: -7px; border-top: 8px solid white; border-left: 8px solid transparent; }
.message-bubble.outgoing::before { content: ''; position: absolute; top: 0; right: -7px; border-top: 8px solid #d9f6c8; border-right: 8px solid transparent; }
.message-bubble.pending { opacity: .8; }
.message-bubble.failed { background: #fbe6e1; }
.message-bubble.failed::before { border-top-color: #fbe6e1; }
.message-sender { display: block; color: #22856a; font-size: 12px; font-weight: 650; margin-bottom: 1px; }
.message-text { white-space: pre-wrap; }
.message-meta { display: flex; align-items: center; justify-content: flex-end; gap: 3px; margin-top: 1px; color: #6a7c70; font-size: 11px; line-height: 1.3; }
.tick { width: 16px; height: 16px; stroke-width: 2; }
.tick.seen { color: var(--seen); }
.failed-label { color: var(--danger); font-weight: 650; }
.retry { min-height: 26px; padding: 0; color: var(--danger); font-size: 12px; }
.message-original { margin-top: 5px; padding-top: 5px; border-top: 1px solid #6a806724; color: #5d7262; font-size: 12px; }
.message-original summary { cursor: pointer; }
.message-original p { margin-top: 3px; white-space: pre-wrap; }
.message-translation { margin-top: 5px; padding: 5px 8px; border-left: 3px solid #8ccfae; border-radius: 4px; background: #f2faf6; color: #29563f; font-size: 14px; white-space: pre-wrap; }
.message-bubble.outgoing .message-translation { background: #ecfbe2; }
.message-tools { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; padding-top: 4px; border-top: 1px solid #00000010; }
.message-tools .text-button { min-height: 30px; padding: 2px 0; font-size: 13px; }
/* Reply, react, edit, delete for everyone (as in WhatsApp). */
.reaction-row { display: flex; flex-wrap: wrap; gap: 2px; width: 100%; }
.reaction-choice { min-width: 38px; min-height: 38px; border: 0; border-radius: 50%; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; }
.reaction-choice:hover, .reaction-choice.chosen { background: #00000012; }
.message-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction-chip { min-height: 26px; padding: 1px 8px; border: 1px solid #00000018; border-radius: 999px; background: #ffffffb3; color: inherit; font-size: 13px; cursor: pointer; }
.reaction-chip.mine { border-color: var(--accent); background: #21b58f1f; }
.message-quote { display: block; width: 100%; margin: 1px 0 5px; padding: 5px 8px; border: 0; border-inline-start: 3px solid var(--accent); border-radius: 7px; background: #0000000d; color: inherit; font: inherit; font-size: 13px; line-height: 1.35; text-align: start; cursor: pointer; }
.message-quote strong { display: block; color: var(--accent-dark, #1c9c7b); font-size: 12px; }
.message-quote span { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: pre-wrap; }
.message-deleted { color: #6a7c70; font-style: italic; }
.message-edited { margin-inline-end: 4px; font-style: italic; }
.message-bubble.flash { animation: message-flash 1.4s ease; }
@keyframes message-flash { 0%, 40% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 1px 1.5px #2b3e2e1a; } }
.reply-bar { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; padding: 6px 8px 6px 10px; border-inline-start: 3px solid var(--accent); border-radius: 8px; background: #0000000a; }
.reply-copy { flex: 1; min-width: 0; font-size: 13px; line-height: 1.35; }
.reply-copy strong { display: block; color: var(--accent-dark, #1c9c7b); font-size: 12px; }
.reply-copy span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* Block, report, and the warning about a chat a stranger started. */
.safety-banner { margin: 8px 12px 0; padding: 10px 12px; border: 1px solid #f0c674; border-radius: 12px; background: #fff7e0; color: #5c4300; font-size: 14px; }
.safety-banner p { margin: 0 0 8px; }
.safety-banner .button-row { gap: 8px; }
.blocked-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-top: 1px solid #00000014; color: #4d6157; font-size: 14px; }
.report-reasons { display: grid; gap: 6px; }
.choice.compact { align-items: center; padding: 9px 12px; }
.report-row .person-copy { min-width: 0; }
.report-row.urgent { border-inline-start: 3px solid var(--danger, #d9534f); padding-inline-start: 8px; }
.report-row.closed { opacity: 0.65; }
.report-note, .report-quote { margin: 4px 0 0; font-size: 13px; white-space: pre-wrap; }
.report-quote { padding: 4px 8px; border-inline-start: 2px solid #00000022; color: #4d6157; }

/* ------------------------------------------------------------ composer */
.composer { flex: 0 0 auto; min-width: 0; background: #f4f6f4; border-top: 1px solid #dfe6df; padding: 8px 16px 10px; }
.composer-tools { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 0 0 8px; overflow-x: auto; scrollbar-width: none; }
.tool-button { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; gap: 6px; min-height: 34px; padding: 6px 12px; border: 1px solid #dce6de; border-radius: 18px; background: white; color: #4e6a5c; font-size: 13px; }
.tool-button svg { width: 16px; height: 16px; }
.tool-button:hover { background: #e9f2eb; color: #16754f; }
.tool-button.active { background: #dcf0e2; border-color: #b4ddc3; color: #186c45; font-weight: 650; }
.tool-tray { max-height: 290px; overflow: auto; overscroll-behavior: contain; padding: 12px 14px; margin-bottom: 8px; background: white; border: 1px solid #dbe7dd; border-radius: 12px; }
.tray-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.tray-heading strong { color: var(--ink); font-size: 14px; font-weight: 650; }
.tray-heading .icon-button { width: 30px; height: 30px; }
.tool-panel > label { display: block; color: #4e6a5c; font-size: 12px; font-weight: 650; margin: 0 0 5px; }
.tool-panel .message-input { min-height: 70px; padding: 9px 11px; font-size: 14px; }
.tool-panel .source-note { margin-top: 7px; }
.draft-context { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; margin: 0 0 7px; background: #e4f1dd; border-radius: 8px; color: #46653a; font-size: 12px; }
.draft-context button { flex: 0 0 auto; font-size: 12px; min-height: 26px; padding: 0; }
.message-form { display: flex; align-items: flex-end; gap: 8px; min-width: 0; }
.message-field { display: flex; align-items: flex-end; flex: 1; min-width: 0; border: 1px solid #dfe8df; border-radius: 22px; background: white; }
.message-field:focus-within { border-color: #5fae88; box-shadow: 0 0 0 3px #37bba026; }
#source-text:focus-visible { outline: none; }
#source-text { width: 100%; flex: 1; min-width: 0; min-height: 46px; max-height: 140px; padding: 12px 4px 12px 16px; border: 0; border-radius: 22px; background: transparent; color: var(--ink); font-size: 16px; line-height: 1.4; resize: none; overflow-y: hidden; }
.message-field .icon-button { height: 44px; width: 34px; color: #9aa79a; }
.message-field .icon-button svg { width: 16px; height: 16px; }
.round-button { display: grid; place-items: center; flex: 0 0 auto; width: 48px; height: 48px; padding: 0; border: 0; border-radius: 50%; }
.round-button svg { width: 22px; height: 22px; }
.round-button.send { background: var(--accent); color: white; }
.round-button.send:hover:not(:disabled) { background: var(--accent-dark); }
.round-button.voice { background: white; border: 1px solid #cfe2d6; color: var(--accent); }
.round-button.voice.recording { background: #d9483b; border-color: #d9483b; color: white; animation: pulse 1.4s infinite; }
.round-button.voice.working { background: #eaf3ee; animation: breathe 1.2s ease-in-out infinite; }
.composer-foot { display: flex; align-items: center; gap: 8px; justify-content: space-between; margin: 5px 6px 0; min-height: 16px; color: #6d7f72; font-size: 12px; }
.composer-foot span { min-width: 0; }
#source-count { flex-shrink: 0; }
#composer-error { margin-top: 6px; }
.language-row { display: flex; align-items: flex-end; gap: 10px; min-width: 0; }
.language-control { flex: 1; min-width: 0; }
.language-control label { display: block; color: #4e6a5c; font-weight: 650; font-size: 12px; margin-bottom: 4px; }
.language-control select { width: 100%; min-width: 0; }
.language-row > .primary-button { flex: 0 0 auto; }
.swap-button { display: grid; place-items: center; flex: 0 0 auto; width: 32px; height: 38px; padding: 0; background: transparent; border: 0; color: var(--accent); }
.translation-preview { margin-top: 12px; padding: 11px 12px; border-radius: 10px; background: #f1f8ef; border: 1px solid #e1ecd8; }
.preview-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #577949; font-size: 11px; letter-spacing: .3px; font-weight: 650; }
#preview-empty { color: #6b7d64; font-size: 13px; padding: 8px 0 2px; }
.preview-text { width: 100%; min-height: 55px; max-height: 140px; padding: 8px 0; margin-top: 4px; border: 0; background: transparent; color: #234a2c; font-size: 15px; line-height: 1.5; resize: vertical; }
.preview-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 6px; }
.preview-actions .text-button svg { width: 15px; height: 15px; }
.preview-actions .primary-button { margin-left: auto; }
.samples { font-size: 12px; color: var(--muted); margin-top: 10px; }
.samples summary { cursor: pointer; }
.sample-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sample-pills button { padding: 6px 10px; border: 1px solid #dfe9df; background: #f9fbf8; color: #4a6e41; border-radius: 15px; font-size: 13px; }
.assistant-toolbar { display: flex; align-items: center; gap: 10px; margin: 10px 0 8px; }
.assistant-toolbar label { color: #4e6a5c; font-size: 12px; font-weight: 650; }
.assistant-toolbar select { flex: 1; min-width: 0; }
.assistant-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.assistant-actions button { min-height: 34px; font-size: 13px; }
.assistant-result { padding: 10px 12px; margin-top: 10px; border: 1px solid #dceadd; border-radius: 9px; background: #f2f8ef; color: #2f4d2b; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.reminder-form { display: grid; grid-template-columns: minmax(0,1.3fr) minmax(0,1fr) auto; gap: 10px; align-items: end; }
.reminder-form > .notice { grid-column: 1 / -1; }
.reminder-list { margin-top: 8px; }
.reminder-item { display: flex; align-items: flex-start; gap: 9px; border-top: 1px solid var(--line); padding: 9px 0; }
.reminder-content { flex: 1; min-width: 0; }
.reminder-item strong { display: block; color: #3f6447; font-size: 13px; overflow-wrap: anywhere; }
.reminder-item small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.reminder-item.completed strong { color: #849180; text-decoration: line-through; }
.reminder-item.overdue small { color: #a27545; }
.reminder-actions { display: flex; gap: 10px; }
.reminder-empty { color: #7d8d78; font-size: 13px; padding: 8px 0; }

/* ------------------------------------------------------------ controls */
.icon-button { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #557064; }
.icon-button:hover { background: #e6eee8; color: var(--accent); }
.primary-button, .secondary-button, .text-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; max-width: 100%; min-height: 40px; padding: 8px 14px; border: 1px solid transparent; border-radius: 9px; font-size: 14px; font-weight: 600; line-height: 1.3; text-decoration: none; }
.primary-button { background: var(--accent); border-color: var(--accent); color: white; }
.primary-button:hover:not(:disabled) { background: var(--accent-dark); border-color: var(--accent-dark); text-decoration: none; }
.secondary-button { border-color: #d5e2d7; background: white; color: #356a4b; }
.secondary-button:hover:not(:disabled) { background: #edf6ed; border-color: #c4dac8; text-decoration: none; }
.text-button { padding: 6px 2px; color: var(--accent); background: transparent; border: 0; }
.text-button:hover { color: var(--accent-dark); text-decoration: underline; }
.danger, .text-button.danger { color: var(--danger) !important; }
.secondary-button.danger { border-color: #ecd0ca; }
.button-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.button-row.stretch > * { flex: 1 1 160px; }
.button-row svg, .primary-button svg, .secondary-button svg { width: 17px; height: 17px; }
.field-label { display: block; color: #4e6a5c; font-size: 12px; font-weight: 650; margin: 0 0 5px; }
input, select, .message-input { color: var(--ink); min-width: 0; max-width: 100%; }
input:not([type='checkbox']):not([type='radio']), select { border: 1px solid #d7e2d9; border-radius: 9px; background: #fbfdfa; min-height: 42px; padding: 8px 10px; font-size: 15px; }
input::placeholder, textarea::placeholder { color: #859488; opacity: 1; }
input:focus, select:focus, textarea:focus { border-color: #6fb391; }
.message-input { display: block; width: 100%; padding: 11px 12px; min-height: 90px; border: 1px solid #dde7de; border-radius: 9px; background: #fbfdfa; resize: vertical; line-height: 1.55; }
.notice { padding: 10px 13px; border: 1px solid #e8ddb6; border-radius: 9px; color: #7c6531; background: #fff8e5; font-size: 13px; overflow-wrap: anywhere; }
.notice[role='alert'], .notice.error { color: #9a3d30; background: #fcefe9; border-color: #efd5c8; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border: 1px solid #dce8d9; border-radius: 15px; background: #f1f7eb; color: #657d50; font-size: 11px; white-space: nowrap; }
.status-pill::before { content: ''; flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%; background: #b0b8a6; }
.status-pill.connected { color: #2c7852; background: #e6f7e8; border-color: #cbe8ce; }
.status-pill.connected::before { background: #36a573; }
.status-pill.offline { color: #937340; background: #fdf4e1; border-color: #ecddb9; }
.status-pill.offline::before { background: #c79a45; }
.form-field { min-width: 0; }
.form-field label { display: block; color: #4e6a5c; font-size: 12px; font-weight: 650; margin-bottom: 5px; }
.form-field input, .form-field select { width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; align-items: end; margin-top: 10px; }
.form-grid > .notice, .form-grid > button { grid-column: 1 / -1; justify-self: start; }

/* ------------------------------------------------------------ dialogs */
dialog { width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: white; color: var(--body); box-shadow: 0 18px 90px #182e2938; }
dialog::backdrop { background: #20382f6b; backdrop-filter: blur(2px); }
.wide-dialog { width: min(640px, calc(100vw - 24px)); }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
dialog h2 { font-size: 21px; letter-spacing: -.4px; color: var(--ink); font-weight: 650; line-height: 1.3; }
dialog h3 { color: var(--ink); font-size: 15px; font-weight: 650; }
dialog p { font-size: 14px; line-height: 1.6; }
dialog .eyebrow { font-size: 10px; margin-bottom: 2px; }
dialog form > .form-field, dialog form > .field-label { margin-top: 12px; }
dialog .notice { margin: 12px 0 0; }
dialog .primary-button.wide { margin-top: 14px; }
.person-list { display: grid; gap: 2px; max-height: 300px; overflow-y: auto; margin: 6px 0 12px; }
.person-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 8px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); text-align: left; }
button.person-row:hover, label.person-row:hover { background: #f0f6f2; }
.person-row.selectable { cursor: pointer; }
.person-row.selectable input { width: 20px; height: 20px; accent-color: var(--accent); }
.person-copy { flex: 1; min-width: 0; display: grid; }
.person-copy strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 15px; font-weight: 600; }
.person-copy small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.empty-note { padding: 10px 8px; font-size: 13px; }
.find-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.find-form > p { margin: 3px 0 10px; font-size: 13px; }
.inline-form { display: flex; gap: 8px; margin-bottom: 10px; }
.inline-form input { flex: 1; }
.privacy-line { display: flex; gap: 8px; margin-top: 14px; font-size: 12px !important; }
.privacy-line svg { width: 16px; height: 16px; margin-top: 2px; }
.invite-card { display: grid; gap: 12px; padding: 16px; border: 1px solid #d5e7dc; border-radius: 14px; background: #f6fbf8; }
.invite-card.result { background: #eef8f2; border-color: #b9dcc7; }
.invite-card > p { font-size: 13px; }
#invite-link { width: 100%; font-size: 13px; color: #355c48; background: white; }
.section-title { display: flex; align-items: baseline; gap: 8px; margin: 20px 0 4px; }
.section-title small { color: var(--muted); font-size: 12px; font-weight: 500; }
.family-row { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-bottom: 1px solid #f0f3f1; }
.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px 12px; }
.row-actions .text-button { min-height: 32px; font-size: 13px; }
.settings-dialog { width: min(620px, calc(100vw - 24px)); }
.setting-row { padding: 16px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row h3 { margin-bottom: 4px; }
.setting-row > p { font-size: 13px; margin-top: 4px; }
.setting-row > .button-row, .setting-row > .secondary-button, .setting-row > .form-field { margin-top: 10px; }

/* ------------------------------------------------------------ incoming call */
.incoming-call { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; background: #0d221cd9; backdrop-filter: blur(6px); animation: fade-in .2s ease; }
.incoming-card { display: grid; justify-items: center; gap: 10px; width: min(360px, 100%); padding: 34px 24px 26px; border-radius: 24px; background: #143128; color: #eaf5ef; text-align: center; box-shadow: 0 20px 80px #0008; }
.incoming-card .avatar { background: #3d7a62; color: white; animation: ring 1.6s ease-in-out infinite; }
.incoming-card h2 { margin-top: 10px; font-size: 22px; color: white; line-height: 1.3; }
.incoming-card p { color: #a9cfbe; font-size: 14px; }
.incoming-actions { display: flex; gap: 72px; margin-top: 26px; }
.incoming-actions .round-button { width: 66px; height: 66px; color: white; }
.incoming-actions .round-button svg { width: 28px; height: 28px; }
.round-button.accept { background: #22b86f; }
.round-button.decline { background: #e0473f; }
.round-button.decline svg { transform: rotate(135deg); }
.incoming-labels { display: flex; gap: 72px; color: #a9cfbe; font-size: 12px; }
.incoming-labels span { width: 66px; }

.toast { position: fixed; z-index: 100; bottom: 22px; left: 50%; transform: translateX(-50%); width: max-content; max-width: min(520px, calc(100vw - 28px)); padding: 12px 17px; border-radius: 10px; background: #245a41; color: white; box-shadow: 0 5px 25px #182b2933; font-size: 14px; line-height: 1.5; animation: toast-in .2s ease; }
.toast.error { background: #8f4537; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px #d9483b33; } }
@keyframes breathe { 50% { transform: scale(1.06); } }
@keyframes spin { to { transform: rotate(1turn); } }
@keyframes ring { 0%, 100% { box-shadow: 0 0 0 0 #22b86f66; } 50% { box-shadow: 0 0 0 18px #22b86f00; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes toast-in { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }

@media (min-width: 1600px) { .app-shell { margin-top: 24px; height: calc(100dvh - 48px); } }
@media (max-width: 1100px) { .app-shell { grid-template-columns: 300px minmax(0,1fr); } .reminder-form { grid-template-columns: 1fr 1fr; } .reminder-form > .primary-button { grid-column: 1 / -1; justify-self: start; } }
@media (max-width: 760px) {
  body { background: white; }
  .auth { padding: 0; place-items: stretch; }
  .auth-card { width: 100%; min-height: 100dvh; padding: 24px 18px max(28px, env(safe-area-inset-bottom)); border-radius: 0; box-shadow: none; }
  .app-shell { display: flex; width: 100%; height: 100dvh; min-height: 400px; margin: 0; border-radius: 0; box-shadow: none; }
  .chat-sidebar { display: none; width: 100%; border: 0; padding-top: env(safe-area-inset-top); }
  .conversation { width: 100%; flex: 1; padding-top: env(safe-area-inset-top); }
  body.mobile-chats .chat-sidebar { display: flex; }
  body.mobile-chats .conversation { display: none; }
  .mobile-back { display: inline-flex !important; }
  .conversation-header { min-height: 60px; padding: 6px 6px 6px 2px; gap: 6px; }
  .conversation-header > .avatar { width: 38px; height: 38px; font-size: 15px; }
  .header-actions { gap: 0; }
  .chat-messages { padding: 14px 12px; }
  .message-bubble { max-width: 86%; }
  .composer { padding: 6px 8px max(8px, env(safe-area-inset-bottom)); }
  .message-form { gap: 6px; }
  .round-button { width: 46px; height: 46px; }
  .tool-tray { max-height: min(300px, 42dvh); padding: 10px 11px; }
  .language-row { flex-wrap: wrap; gap: 6px; }
  .language-control { flex-basis: calc(50% - 22px); }
  .language-row > .primary-button { width: 100%; }
  .reminder-form { grid-template-columns: 1fr; }
  .preview-actions .primary-button { margin-left: 0; width: 100%; }
  dialog { width: 100vw; max-width: 100vw; max-height: 100dvh; height: auto; margin: auto 0 0; padding: 18px 16px max(18px, env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; }
  .call-dialog { height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .incoming-actions, .incoming-labels { gap: 56px; }
  /* On phones the toast sits just under the chat header so it covers neither the name nor the message box. */
  .toast { top: calc(max(0px, env(safe-area-inset-top)) + 70px); bottom: auto; }
}
@media (max-width: 380px) { .phone-row > select { flex-basis: 108px; width: 108px !important; } .segment-control.small { min-width: 0; justify-self: stretch; } }
@media (display-mode: standalone) { .app-shell { height: 100dvh; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }

/* ------------------------------------------------------------ 0.5: languages, voice messages, photos */
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 22px; }
.auth-top .auth-brand { margin-bottom: 0; }
.language-switch { display: inline-flex; padding: 3px; border-radius: 9px; background: #eef3ed; }
.language-switch button { min-height: 32px; padding: 4px 12px; border: 0; border-radius: 7px; background: transparent; color: #5f7366; font-size: 13px; }
.language-switch button.active { background: white; color: #1f6b46; font-weight: 650; box-shadow: 0 1px 4px #33453218; }
.send-in-chip { position: relative; display: inline-flex; align-items: center; flex: 0 0 auto; gap: 6px; min-height: 34px; padding: 4px 6px 4px 11px; border: 1px solid #dce6de; border-radius: 18px; background: white; color: #4e6a5c; font-size: 13px; cursor: pointer; }
.send-in-chip svg { width: 16px; height: 16px; }
.send-in-chip select { min-height: 26px !important; padding: 0 22px 0 4px !important; border: 0 !important; background-color: transparent !important; color: inherit; font-size: 13px !important; font-weight: 650; cursor: pointer; max-width: 150px; field-sizing: content; }
.send-in-chip.active { background: #dcf0e2; border-color: #9fd0b2; color: #166b43; }
.recording-bar { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 8px 6px 14px; margin-bottom: 6px; border: 1px solid #f1c9c2; border-radius: 26px; background: #fff5f3; color: #8e3b30; }
.recording-bar strong { font-variant-numeric: tabular-nums; font-size: 16px; }
.recording-hint { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: #d9483b; animation: blink 1s ease-in-out infinite; }
.recording-bar .primary-button { border-radius: 22px; }
.photo-preview { display: flex; gap: 12px; padding: 10px; margin-bottom: 8px; border: 1px solid #d5e5da; border-radius: 14px; background: white; }
.photo-preview img { width: 120px; height: 120px; flex: 0 0 auto; object-fit: cover; border-radius: 10px; background: #eef2ef; }
.photo-side { flex: 1; min-width: 0; display: grid; gap: 8px; align-content: start; }
.photo-side .message-input { min-height: 56px; }
.message-bubble.photo { padding: 4px 4px 5px; }
.message-bubble.photo .message-text, .message-bubble.photo .message-meta, .message-bubble.photo .message-tools, .message-bubble.photo .message-translation, .message-bubble.photo .message-sender { margin-left: 6px; margin-right: 6px; }
.message-photo { display: block; width: auto; max-width: min(320px, 100%); height: auto; max-height: 360px; border-radius: 8px; object-fit: cover; background: #e8ece9; cursor: zoom-in; }
.message-bubble.photo .message-text { margin-top: 5px; }
.voice-player { display: flex; align-items: center; gap: 10px; min-width: 210px; padding: 2px 0; }
.voice-play { display: grid; place-items: center; flex: 0 0 auto; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 50%; background: var(--accent); color: white; }
.voice-play svg { width: 18px; height: 18px; fill: currentColor; }
.voice-bar { position: relative; flex: 1; height: 5px; border-radius: 3px; background: #c9dccf; overflow: hidden; }
.message-bubble.outgoing .voice-bar { background: #b6dca2; }
.voice-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent); border-radius: 3px; }
.voice-time { flex: 0 0 auto; color: #5f7366; font-size: 12px; font-variant-numeric: tabular-nums; }
.message-text.transcript { margin-top: 6px; font-size: 14px; color: #30493c; }
.failed-reason { margin-top: 4px; color: var(--danger); font-size: 12px; }
.message-translation.explanation { border-left-color: #b9a1e0; background: #f6f2fc; color: #3f3560; }
.catchup-card { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid #e4dcf2; background: #f6f2fc; color: #3f3560; }
.catchup-card strong { display: block; font-size: 13px; }
.catchup-card p { margin-top: 4px; font-size: 14px; white-space: pre-wrap; }
.catchup-card .button-row { flex-wrap: nowrap; }
.lightbox { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 16px; background: #0b1512ee; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; object-fit: contain; }
.lightbox .icon-button { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; background: #ffffff22; color: white; }
.tool-button span { pointer-events: none; }
/* Font size (Settings → Chats) is in theme.css. */
@keyframes blink { 50% { opacity: .25; } }
@media (max-width: 760px) {
  .photo-preview { flex-direction: column; }
  .photo-preview img { width: 100%; height: 180px; }
  .send-in-chip select { max-width: 112px; }
  .voice-player { min-width: 180px; }
  .catchup-card { padding: 8px 12px; }
}

/* ------------------------------------------------------------ 0.6: medicine helper */
.medicine-list { display: grid; gap: 10px; margin: 4px 0 14px; }
.medicine-list > .section-title { margin: 8px 0 0; }
.medicine-empty { padding: 16px; border: 1px dashed #cfe0d3; border-radius: 12px; color: #5f7366; text-align: center; }
.medicine-card { display: grid; gap: 6px; padding: 12px 14px; border: 1px solid #dde9df; border-radius: 14px; background: #fbfdfb; }
.medicine-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.medicine-head strong { font-size: 16px; }
.medicine-head small { color: #4e6a5c; font-size: 13px; }
.medicine-notes { color: #3f5a4c; }
.dose-heading { margin-top: 2px; color: #4e6a5c; font-weight: 650; }
.dose-list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.dose { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px 10px; border-radius: 10px; background: #f1f6f2; font-size: 14px; }
.dose-time { min-width: 74px; font-weight: 650; font-variant-numeric: tabular-nums; }
.dose.status-taken { background: #e3f4e7; color: #1f6b46; }
.dose.status-missed { background: #fdecea; color: #8f3b30; }
.dose.status-due, .dose.status-snoozed { background: #fff4dd; color: #7a5200; }
.dose.status-skipped { color: #6b7a70; }
.dose > .text-button { margin-left: auto; }
.dose > .text-button + .text-button { margin-left: 0; }
.medicine-actions { display: flex; justify-content: flex-end; }
.medicine-editor { display: grid; gap: 10px; }
.medicine-editor > .form-grid { margin-top: 0; }
#medicine-rows { display: grid; gap: 10px; }
.medicine-row { display: grid; gap: 8px; min-width: 0; margin: 0; padding: 12px; border: 1px solid #dde9df; border-radius: 14px; background: #fbfdfb; }
.medicine-row .form-grid { grid-template-columns: 1fr 1fr; margin-top: 0; }
.medicine-row > .text-button { justify-self: start; }
.time-list { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
/* Times or days the prescription did not state clearly, until the person sets them. */
.medicine-row .form-field.unsure { padding: 6px 8px; border-radius: 10px; background: #fff4d6; box-shadow: inset 0 0 0 1px #e0a92b; }
.unsure-note { display: block; margin-top: 4px; color: #8a5a00; font-size: 12px; font-weight: 650; }
.time-item { display: inline-flex; align-items: center; gap: 2px; padding: 2px 2px 2px 6px; border: 1px solid #d5e5da; border-radius: 10px; background: white; }
.time-item input { width: auto; min-height: 36px !important; padding: 4px !important; border: 0 !important; }
.icon-button.small { width: 30px; height: 30px; font-size: 18px; line-height: 1; }
.medicine-due { position: fixed; z-index: 90; top: max(12px, env(safe-area-inset-top)); left: 50%; display: flex; align-items: center; gap: 12px; width: min(560px, calc(100vw - 24px)); padding: 12px 14px; border: 2px solid #f0c36d; border-radius: 16px; background: #fffaf0; color: #4d3800; box-shadow: 0 10px 30px #33280f33; transform: translateX(-50%); animation: toast-in .2s ease-out; }
.medicine-due-icon { font-size: 30px; }
.medicine-due-copy { flex: 1; min-width: 0; }
.medicine-due-copy strong { display: block; font-size: 15px; }
.medicine-due-copy p { margin-top: 2px; font-size: 15px; overflow-wrap: anywhere; }
.medicine-due-copy small { color: #7a6a3c; }
.medicine-due-actions { display: flex; flex-direction: column; gap: 6px; }
.medicine-due-actions .primary-button { min-height: 44px; font-size: 16px; }
@media (max-width: 760px) {
  .medicine-row .form-grid { grid-template-columns: 1fr; }
  .medicine-due { flex-wrap: wrap; }
  .medicine-due-actions { flex-direction: row; width: 100%; }
  .medicine-due-actions button { flex: 1; }
}
/* The save button stays in reach while a long list of medicines scrolls. */
.medicine-editor > .button-row:last-child { position: sticky; bottom: 0; z-index: 1; margin: 0 -4px; padding: 10px 4px 4px; background: inherit; box-shadow: 0 -10px 12px -12px #0000002e; }
#medicine-form { background: var(--panel, #fff); }
@media (max-width: 760px) { body.medicine-due-open .toast { top: calc(max(0px, env(safe-area-inset-top)) + 190px); } }

/* ------------------------------------------------------------ 0.19: a button row that fits every phone, videos and
   documents, pinned, muted and archived chats, search, and the call history */
/* The row above the message box always fits: when the message box is narrow (any phone, or a small window),
   its buttons show only their pictures; their names stay for screen readers and as tooltips. */
.composer { position: relative; z-index: 4; container: composer / inline-size; }
.send-in-chip { flex: 0 1 auto; min-width: 0; }
.send-in-chip select { flex: 0 1 auto; min-width: 0; text-overflow: ellipsis; }
@container composer (max-width: 640px) {
  .composer-tools .tool-button { width: 40px; height: 36px; padding: 0; }
  .composer-tools .tool-button svg { width: 19px; height: 19px; }
  .composer-tools .tool-button > span, .send-in-label { display: none; }
  .send-in-chip { padding-inline-start: 10px; }
  .send-in-chip select { max-width: 140px; }
}
/* The narrowest (a small phone with the largest text): the language's name keeps the room of the globe. */
@container composer (max-width: 300px) {
  .composer-tools { gap: 4px; }
  .composer-tools .tool-button { width: 37px; }
  .send-in-chip { padding-inline-start: 4px; }
  .send-in-chip > svg { display: none; }
}
/* Phones too old for the rule above (it needs iOS 16 or Chrome 105). */
@supports not (container-type: inline-size) {
  @media (max-width: 640px) {
    .composer-tools .tool-button { width: 40px; height: 36px; padding: 0; }
    .composer-tools .tool-button > span, .send-in-label { display: none; }
    .send-in-chip select { max-width: 140px; }
  }
}
/* 📎 Attach and ✨ AI and more open just above their buttons. */
.tool-menu { position: absolute; bottom: calc(100% + 4px); left: 8px; z-index: 6; display: grid; min-width: 210px; max-width: calc(100% - 16px); padding: 6px; border: 1px solid #dbe7dd; border-radius: 14px; background: white; box-shadow: 0 12px 34px #1a2e2433; animation: menu-in .14s ease-out; }
.tool-menu button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 8px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); font-size: 15px; text-align: start; }
.tool-menu button:hover, .tool-menu button:focus-visible { background: #eef6f0; outline: none; }
.tool-menu button svg { width: 21px; height: 21px; color: var(--accent); }
.tool-menu button.active { background: #dcf0e2; font-weight: 650; }
@keyframes menu-in { from { opacity: 0; translate: 0 6px; } to { opacity: 1; translate: 0 0; } }
/* A video or document waiting to be sent. */
.attach-preview { display: flex; gap: 12px; padding: 10px; margin-bottom: 8px; border: 1px solid #d5e5da; border-radius: 14px; background: white; }
.attach-preview video { width: 150px; height: 150px; flex: 0 0 auto; object-fit: cover; border-radius: 10px; background: #0d1a15; }
.file-card { display: flex; align-items: center; gap: 10px; flex: 0 1 240px; min-width: 0; align-self: flex-start; padding: 12px; border-radius: 12px; background: #f0f6f2; }
.file-card svg { width: 32px; height: 32px; color: var(--accent); }
.file-card > div { min-width: 0; }
.file-card strong { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--ink); font-size: 14px; }
.file-card small { color: var(--muted); font-size: 12px; }
@media (max-width: 760px) {
  .attach-preview { flex-direction: column; }
  .attach-preview video { width: 100%; height: 200px; object-fit: contain; }
  .file-card { flex: 0 0 auto; align-self: stretch; }
}
/* Videos and documents in a chat. */
.message-video { position: relative; display: grid; place-items: center; width: min(300px, 64vw); aspect-ratio: 16 / 9; max-height: 380px; overflow: hidden; border-radius: 8px; background: #16241e; }
.message-video > * { grid-area: 1 / 1; }
.message-video .video-poster { width: 100%; height: 100%; object-fit: cover; }
.video-play { position: relative; display: grid; place-items: center; width: 54px; height: 54px; padding: 0; border: 0; border-radius: 50%; background: #000000a0; color: white; }
.video-play svg { width: 22px; height: 22px; margin-left: 3px; fill: currentColor; }
.video-play:disabled { opacity: .85; cursor: progress; }
.message-video.loading .video-play { animation: breathe 1.1s ease-in-out infinite; }
.video-length { position: absolute; left: 8px; bottom: 7px; padding: 1px 7px; border-radius: 8px; background: #00000090; color: white; font-size: 12px; font-variant-numeric: tabular-nums; }
.message-video.playing { background: #000; }
.message-video-player { width: 100%; height: 100%; max-height: 380px; background: #000; }
.upload-progress { position: absolute; left: 10px; right: 10px; bottom: 10px; width: auto; height: 6px; accent-color: var(--accent); }
.message-file { display: flex; align-items: center; gap: 10px; width: min(300px, 64vw); padding: 10px 12px; border-radius: 9px; background: #0000000b; color: inherit; text-decoration: none; }
.message-file:hover { text-decoration: none; background: #00000014; }
.message-file .file-icon { width: 34px; height: 34px; color: var(--accent); }
.file-copy { flex: 1; min-width: 0; display: grid; gap: 1px; }
.file-copy strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--ink); font-size: 14px; font-weight: 600; }
.file-copy small { color: var(--muted); font-size: 12px; }
.file-copy .upload-progress { position: static; width: 100%; margin-top: 4px; }
.message-file .file-get { width: 20px; height: 20px; color: var(--accent); }
.message-bubble.file .message-text { margin-top: 5px; }
/* The chat list: chips that scroll on a narrow phone, pinned and muted chats, Archived, and search. */
.chat-filters { overflow-x: auto; scrollbar-width: none; }
.chat-filters::-webkit-scrollbar { display: none; }
.filter-chip { flex: 0 0 auto; }
.chip-count.missed { background: var(--danger); color: white; }
.chat-flag { width: 16px; height: 16px; color: #8a9a92; }
.unread-badge.muted { background: #a7b5ae; }
.archived-row .archive-mark { background: transparent; color: var(--accent); }
.archived-row .archive-mark svg { width: 22px; height: 22px; }
.archived-count { flex: 0 0 auto; color: var(--accent); font-size: 12px; font-weight: 700; }
.list-heading { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 16px; border: 0; border-bottom: 1px solid #f0f2f0; background: white; color: var(--ink); font-size: 15px; text-align: start; }
.list-heading:hover { background: #f6f8f6; }
.list-note { padding: 10px 18px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.list-section { padding: 16px 16px 6px; color: var(--accent-dark); font-size: 12px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; }
.search-result { display: grid; gap: 2px; width: 100%; min-width: 0; padding: 10px 16px; border: 0; border-bottom: 1px solid #f0f2f0; background: white; color: var(--ink); text-align: start; }
.search-result:hover { background: #f6f8f6; }
.result-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.result-top strong { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 14px; font-weight: 650; }
.result-top time { flex: 0 0 auto; color: var(--muted); font-size: 11px; }
.search-result small { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: var(--body); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
mark { padding: 0 1px; border-radius: 3px; background: #ffe58f; color: inherit; }
/* A chat's choices (pin, mute, archive), and search in one chat. */
.sheet-dialog { width: min(440px, calc(100vw - 24px)); }
.sheet-dialog .dialog-header { margin-bottom: 8px; }
.option-list { display: grid; gap: 2px; }
.option-list > p { margin: 0 6px 6px; font-size: 13px; }
.option-row { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 50px; padding: 10px 12px; border: 0; border-radius: 12px; background: transparent; color: var(--ink); font-size: 15px; text-align: start; }
.option-row:hover { background: #f0f6f2; }
.option-row svg { width: 22px; height: 22px; color: var(--accent); }
.option-row span { flex: 1; min-width: 0; }
.option-row small { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.search-form .chat-search { margin: 0 0 8px; }
.search-results { display: grid; max-height: min(56dvh, 460px); overflow-y: auto; margin: 0 -8px; }
.search-results .search-result { padding: 9px 10px; border-bottom: 0; border-radius: 10px; }
#search-note { margin-top: 8px; font-size: 13px; }
#search-more { margin-top: 10px; }
/* Back to the newest messages: it floats over the bottom of the chat and takes no room of its own. */
.latest-pill { position: relative; z-index: 3; align-self: flex-end; display: inline-flex; align-items: center; gap: 6px; height: 36px; margin: -48px 16px 12px 0; padding: 0 14px 0 10px; border: 1px solid #d5e2d7; border-radius: 18px; background: white; color: var(--accent-dark); font-size: 13px; font-weight: 650; box-shadow: 0 4px 14px #1a2e2426; }
.latest-pill svg { width: 18px; height: 18px; }
/* Calls: the call history. */
.call-row { display: flex; align-items: center; gap: 12px; padding: 10px 8px 10px 16px; border-bottom: 1px solid #f0f2f0; background: white; }
.call-row .avatar { width: 46px; height: 46px; font-size: 17px; }
.call-open { flex: 1; min-width: 0; display: grid; gap: 2px; padding: 2px 0; border: 0; background: transparent; color: var(--ink); text-align: start; }
.call-open:disabled { opacity: 1; cursor: default; }
.call-open strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 15px; font-weight: 650; }
.call-row.missed .call-open strong { color: var(--danger); }
.call-detail { display: flex; align-items: center; gap: 5px; min-width: 0; color: var(--muted); font-size: 12.5px; }
.call-detail span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.call-detail svg { width: 15px; height: 15px; stroke-width: 2.2; }
.call-good { color: #1fae78; }
.call-bad { color: var(--danger); }
.call-back { color: var(--accent); }
.calls-clear { display: flex; margin: 14px auto 18px; }

/* Removal requests and reports to act on within 48 hours (the TAKE IT DOWN Act). */
.urgent-note { display: block; color: var(--danger, #d9534f); font-weight: 600; }
.takedown-hint { margin: -4px 0 6px; font-size: 13px; }
/* New chat → Choose from my contacts: the picked people, each with Chat or Invite. */
.pick-contacts { margin-top: 10px; }
.picked-contacts { margin-top: 12px; }
.picked-contacts > h3 { margin: 0 0 4px; font-size: 15px; }
.picked-contacts .family-row .secondary-button { flex: 0 0 auto; min-height: 36px; padding: 6px 12px; font-size: 13px; }
.picked-note { margin: 6px 0 0; font-size: 12px; }
#find-invite { margin-top: 8px; }
/* Inside Messenger or Facebook: how to open Kotha in the browser. */
.inapp-note { display: grid; gap: 10px; margin-top: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--accent-soft); color: var(--body); font-size: 13px; line-height: 1.55; }
.inapp-note p { margin: 0; }
.inapp-note .secondary-button { justify-self: start; text-decoration: none; }
