/* Design pass 2 (15.11.2026) — one design system for every page.
   Loaded last. Tokens first, shared components second, pages after that.
   Phone (≈393pt) is the primary layout; desktop rules are at the end of each block. */

/* ============================== 1. tokens ============================== */
:root {
  /* colour */
  --c-bg: #f4f7fa; --c-surface: #ffffff; --c-sunk: #f1f5f8;
  --c-ink: #182b43; --c-ink-2: #3a5067; --c-muted: #627488; --c-faint: #93a2b0;
  --c-line: #e3e9ef; --c-line-strong: #d2dce5;
  --c-brand: #087f87; --c-brand-strong: #066c74; --c-brand-soft: #e6f3f2; --c-brand-line: #c4e2df;
  --c-ok: #1d7355; --c-ok-soft: #e4f4ec;
  --c-warn: #8a5a10; --c-warn-soft: #fff1d9; --c-warn-line: #f0dcb4;
  --c-danger: #a83645; --c-danger-soft: #fdeef0;
  --c-info: #2a5d9a; --c-info-soft: #e9f1fb;
  /* type scale */
  --t-xs: 11px; --t-sm: 12px; --t-base: 14px; --t-md: 15px; --t-lg: 17px; --t-xl: 21px; --t-2xl: 26px;
  /* spacing: 4 / 8 rhythm */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px;
  /* shape and depth */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-pill: 999px;
  --sh-1: 0 1px 2px #1122380a, 0 4px 14px #11223808;
  --sh-2: 0 2px 6px #11223812, 0 14px 34px #1122380f;
  --sh-3: 0 30px 90px #112b3c2b;
  --tap: 44px;
  --ease: .16s ease;
}

/* ======================== 2. shared components ========================= */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Page header: the same on every page. */
.ux-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-4); }
.ux-head h1 { margin: 0; }
.ux-head .subtitle { margin: var(--s-1) 0 0; }
.ux-head > .primary, .ux-head > button { flex: 0 0 auto; }

/* Filter chips: compact, sized to fit one row on a phone; they wrap rather than run off
   the screen, so no filter is ever hidden to the right. */
.ux-chips { display: flex; flex-wrap: nowrap; gap: 6px; min-width: 0; }
.ux-chip { display: inline-flex; align-items: center; justify-content: center; gap: 5px; flex: 0 1 auto; min-width: 0; max-width: 100%; overflow: hidden; min-height: 36px; padding: 6px 11px; border: 1px solid var(--c-line); border-radius: var(--r-pill); background: var(--c-surface); color: var(--c-ink-2); font-size: var(--t-sm); font-weight: 600; white-space: nowrap; position: relative; }
.ux-chip { overflow-x: clip; overflow-y: visible; }
.ux-chip > * { flex: 0 0 auto; }
.ux-chip::after { content: ""; position: absolute; inset: -4px 0; } /* 44px touch height */
.ux-chip.active, .ux-chip[aria-pressed="true"] { background: var(--c-brand); border-color: var(--c-brand); color: #fff; }
.ux-chip-count { min-width: 18px; padding: 1px 5px; border-radius: var(--r-pill); background: #1122380f; color: inherit; font-size: 10px; font-weight: 700; line-height: 1.5; text-align: center; font-variant-numeric: tabular-nums; }
.ux-chip.active .ux-chip-count { background: #ffffff38; }
select.ux-chip { width: 100%; min-width: 0; appearance: none; -webkit-appearance: none; justify-content: flex-start; padding-right: 24px; font-size: var(--t-sm); text-overflow: ellipsis; background: var(--c-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23627488' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center / 12px; }
select.ux-chip.is-set { background-color: var(--c-brand-soft); border-color: var(--c-brand-line); color: var(--c-brand-strong); }
/* A row of dropdown filters that always fits the width. */
.ux-select-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; min-width: 0; margin: 0 0 var(--s-3); }
#dos-selects { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ux-search-with-button { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; min-width: 0; }
.ux-filter-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border-radius: var(--r-md); color: var(--c-ink-2); font-size: var(--t-sm); white-space: nowrap; }
.ux-filter-toggle svg { width: 17px; height: 17px; }
.ux-filter-toggle.is-set, .ux-filter-toggle[aria-expanded="true"] { border-color: var(--c-brand-line); background: var(--c-brand-soft); color: var(--c-brand-strong); }
.ux-filter-panel { display: none; }
.ux-filter-panel.is-open { display: grid; }
.ux-sticky .ux-select-row { margin: 0; }
.ux-clear { min-height: 32px; padding: 2px 4px; color: var(--c-brand-strong); font-size: var(--t-sm); font-weight: 600; position: relative; }
.ux-clear::after { content: ""; position: absolute; inset: -6px 0; }

/* Sticky tool strip under the app bar (search + filters always at hand). */
.ux-sticky { position: sticky; top: var(--header-height); z-index: 15; margin: 0 calc(-1 * var(--s-4)) var(--s-3); padding: var(--s-2) var(--s-4); background: var(--c-bg); display: grid; gap: var(--s-2); box-shadow: 0 6px 8px -8px #11223826; }
.ux-sticky input[type="search"], .ux-sticky input:not([type]) { width: 100%; max-width: none; min-height: 44px; border-radius: var(--r-md); }
.ux-count-line { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); margin: 0 0 var(--s-2); color: var(--c-muted); font-size: var(--t-sm); }
.ux-more { display: block; width: 100%; margin: var(--s-3) 0 0; min-height: 46px; border: 1px dashed var(--c-line-strong); background: var(--c-surface); color: var(--c-brand-strong); font-size: var(--t-sm); }

/* Status pills share one palette everywhere. */
.ux-pill { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 2px 8px; border-radius: var(--r-pill); background: var(--c-sunk); color: var(--c-ink-2); font-size: var(--t-xs); font-weight: 600; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ux-pill.ok { background: var(--c-ok-soft); color: var(--c-ok); }
.ux-pill.warn { background: var(--c-warn-soft); color: var(--c-warn); }
.ux-pill.danger { background: var(--c-danger-soft); color: var(--c-danger); }
.ux-pill.info { background: var(--c-info-soft); color: var(--c-info); }
.ux-pill.brand { background: var(--c-brand-soft); color: var(--c-brand-strong); }
.ux-pill.off { background: #eef1f4; color: #6a7888; }

/* Square icon button with a full-size touch target. */
.ux-icon-btn { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 var(--tap); width: var(--tap); min-width: var(--tap); height: var(--tap); min-height: var(--tap); padding: 0; border-radius: var(--r-md); color: var(--c-ink-2); }
.ux-icon-btn svg { width: 20px; height: 20px; }

/* Action pair/triple: equal-width buttons in one row. */
.ux-actions { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: var(--s-2); }
.ux-actions > button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; min-height: var(--tap); padding: 8px 10px; font-size: var(--t-sm); line-height: 1.25; }
.ux-actions > button svg { width: 16px; height: 16px; }

/* Definition facts (label above value). */
.ux-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3) var(--s-4); margin: 0 0 var(--s-4); }
.ux-facts > div { min-width: 0; }
.ux-facts dt { margin: 0 0 2px; color: var(--c-muted); font-size: var(--t-xs); font-weight: 600; letter-spacing: .2px; }
.ux-facts dd { margin: 0; color: var(--c-ink); font-size: var(--t-base); overflow-wrap: anywhere; }
.ux-sheet-title { display: flex; align-items: center; gap: var(--s-2); margin: var(--s-5) 0 var(--s-1); font-size: var(--t-base); }

/* Toast: readable, never under the notch. */
#toast { border-radius: var(--r-md); }

/* Search dialog. */
.ux-search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-2); }
.ux-search-row input { min-height: 46px; }
.ux-more-filters { border: 1px solid var(--c-line); border-radius: var(--r-md); padding: 0 var(--s-3); }
.ux-more-filters summary { min-height: var(--tap); display: flex; align-items: center; cursor: pointer; color: var(--c-ink-2); font-size: var(--t-sm); font-weight: 600; }
.ux-more-filters[open] { padding-bottom: var(--s-3); }
.ux-search-hint { margin: var(--s-3) 0 var(--s-2); font-size: var(--t-sm); }
.search-hit { display: block; width: 100%; margin-bottom: var(--s-2); text-align: left; border-radius: var(--r-md); }

/* The global "back to top" button never sits on top of the composer. */
.conversation-open .scroll-top { display: none !important; }
main[data-view="chat"] ~ .scroll-top, body:has(main[data-view="chat"]) .scroll-top { display: none !important; }

/* ====================== 3. conversations: the list ====================== */
.chat-list h3 small { font-variant-numeric: tabular-nums; }
.chat-list .chat-filters.ux-chips { margin: 0 7px 10px; padding: 0; }
.chat-item.ux-chat { align-items: center; gap: 12px; min-height: 68px; padding: 10px; margin: 0; border-radius: var(--r-md); text-align: left; }
.ux-chat .grow { display: grid; gap: 2px; min-width: 0; }
.ux-chat-top, .ux-chat-bottom { display: flex; align-items: baseline; gap: var(--s-2); min-width: 0; }
.ux-chat-top strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c-ink); font-size: var(--t-base); font-weight: 600; word-break: normal; overflow-wrap: normal; }
.ux-chat-top time { flex: 0 0 auto; color: var(--c-muted); font-size: var(--t-xs); font-variant-numeric: tabular-nums; }
.ux-chat-bottom { align-items: center; }
.ux-chat-preview { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c-muted); font-size: 13px; line-height: 1.45; font-weight: 400; }
.ux-you { color: var(--c-faint); }
.ux-chat.is-unread .ux-chat-top strong { font-weight: 720; }
.ux-chat.is-unread .ux-chat-top time { color: var(--c-brand-strong); font-weight: 650; }
.ux-chat.is-unread .ux-chat-preview { color: var(--c-ink-2); font-weight: 500; }
.ux-chat .count { flex: 0 0 auto; min-width: 21px; min-height: 20px; border-radius: var(--r-pill); font-size: 11px; }
.ux-wait-dot { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: #e0a23a; box-shadow: 0 0 0 3px #e0a23a26; }
.ux-chat-country { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #4d7d78; font-size: var(--t-xs); font-weight: 600; line-height: 1.4; }
.chat-item.ux-chat .avatar { width: 46px; height: 46px; font-size: 13px; }

/* ==================== 4. conversations: open thread ==================== */
.inbox .chat-head.ux-chat-head { gap: var(--s-2); }
.ux-head-title { display: block; width: 100%; min-height: var(--tap); padding: 2px 4px; border: 0; background: transparent; text-align: left; border-radius: var(--r-sm); }
.ux-head-title:hover { background: var(--c-sunk); }
.inbox .chat-head .ux-head-title h3 { display: block; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--t-md); font-weight: 680; line-height: 1.3; overflow-wrap: normal; -webkit-line-clamp: unset; }
.inbox .chat-head .ux-head-title small { display: block; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c-muted); font-size: var(--t-xs); font-weight: 400; }
.inbox .chat-head > button.small { display: inline-flex; align-items: center; justify-content: center; }
.inbox .chat-head > button.small svg { width: 21px; height: 21px; }

.inbox .messages { padding: var(--s-3) var(--s-3) var(--s-4); }
.messages > .ux-history { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); margin: 0 0 var(--s-1); }
.messages > .ux-history button { min-height: 40px; padding: 6px 10px; font-size: var(--t-sm); background: var(--c-surface); }
.ux-history-note { margin: 0 0 var(--s-2); text-align: center; }
.ux-history-note small { font-size: var(--t-xs); color: var(--c-muted); }
.ux-day { display: flex; justify-content: center; margin: var(--s-3) 0 var(--s-2); pointer-events: none; }
.ux-day span { padding: 3px 11px; border-radius: var(--r-pill); background: #e3ebf1f2; color: var(--c-ink-2); font-size: var(--t-xs); font-weight: 650; box-shadow: 0 1px 2px #11223812; }

.inbox .message.ux-msg { width: fit-content; min-width: 0; max-width: 88%; margin: var(--s-3) 0 0; }
.inbox .message.ux-msg.is-grouped { margin-top: 3px; }
.inbox .message.ux-msg.out { margin-left: auto; }
.inbox .message.ux-msg:last-child { margin-bottom: 0; }
.ux-msg-head { display: flex; padding: 0 var(--s-2) 2px; }
.ux-msg.out .ux-msg-head { justify-content: flex-end; }
.ux-msg-head button.link, .ux-msg-head span { min-height: 0; padding: 0; border: 0; background: transparent; color: var(--c-brand-strong); font-size: var(--t-sm); font-weight: 650; line-height: 1.5; text-align: left; position: relative; overflow-wrap: anywhere; }
.ux-msg-head button.link::after { content: ""; position: absolute; inset: -9px -6px -4px; }
.ux-msg.note .ux-msg-head span { color: #7c6328; }
.ux-msg .bubble { padding: 8px 11px 5px; border-radius: 4px 16px 16px 16px; font-size: var(--t-md); line-height: 1.45; }
.ux-msg.out .bubble { border-radius: 16px 4px 16px 16px; }
.ux-msg.is-grouped .bubble { border-radius: 16px; }
.ux-msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.ux-quote { display: block; width: 100%; min-height: 0; margin: 0 0 5px; padding: 3px 8px; border: 0; border-left: 3px solid var(--c-brand); border-radius: 4px; background: #0f7f870f; color: var(--c-brand-strong); font-size: var(--t-sm); font-weight: 600; text-align: left; position: relative; }
.ux-quote::after { content: ""; position: absolute; inset: -8px 0; }
.ux-media { margin: 6px 0 0; }
.ux-media a { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 5px 10px; border: 1px solid var(--c-line); border-radius: var(--r-sm); background: #ffffffb8; color: var(--c-brand-strong); font-size: var(--t-sm); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.ux-media a svg { width: 15px; height: 15px; }
.ux-msg-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 2px var(--s-3); margin-top: 3px; min-height: 24px; }
.ux-msg-foot time { display: inline-flex; align-items: center; gap: 3px; margin-left: auto; color: var(--c-muted); font-size: var(--t-xs); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ux-msg.out .ux-msg-foot time { color: #4b7a73; }
.ux-sent svg { width: 13px; height: 13px; stroke-width: 2.4; }
.ux-msg-foot.ux-msg-tools { justify-content: flex-start; gap: 0 var(--s-3); }
.ux-msg-tools .ux-tool, .ux-msg-tools .info-button, .ux-msg-tools summary { position: relative; display: inline-flex; align-items: center; gap: 4px; min-width: 0; min-height: 24px; height: 24px; width: auto; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--c-brand-strong); font-family: inherit; font-size: var(--t-sm); font-weight: 600; line-height: 1; cursor: pointer; }
.ux-msg-tools .ux-tool::after, .ux-msg-tools .info-button::after, .ux-msg-tools summary::after { content: ""; position: absolute; inset: -10px -6px; } /* 44px touch height */
.ux-msg-tools .ux-tool svg { width: 14px; height: 14px; }
.ux-msg-tools .info-button { justify-content: center; width: 20px; height: 20px; min-height: 20px; border: 1.5px solid currentColor; border-radius: 50%; font-family: Georgia, serif; font-size: 12px; font-weight: 700; font-style: italic; }
.ux-msg.out .ux-msg-tools .ux-tool, .ux-msg.out .ux-msg-tools .info-button, .ux-msg.out .ux-msg-tools summary { color: #2c6a63; }
.ux-msg-tools details { min-width: 0; font-size: var(--t-sm); }
.ux-msg-tools details > summary { list-style: none; }
.ux-msg-tools details > summary::-webkit-details-marker { display: none; }
.ux-msg-tools details > summary::before { content: "▸"; font-size: 10px; margin-right: 1px; }
.ux-msg-tools details[open] > summary::before { content: "▾"; }
.ux-msg-tools details[open] { flex: 1 1 100%; order: 9; margin: 2px 0 4px; padding: 6px 9px; border-radius: var(--r-sm); background: #1122380a; color: var(--c-ink-2); font-size: var(--t-base); line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.ux-msg-tools .translation-warning { flex: 0 1 auto; padding: 0; background: transparent; color: var(--c-warn); }
.ux-msg-tools .translation-warning > summary { color: var(--c-warn); }
.ux-msg-tools .translation-warning[open] { background: var(--c-warn-soft); padding: 6px 9px; }
.ux-msg-tools .translation-warning p { margin: 4px 0 0; }
.ux-msg-tools .translation-status { flex: 1 1 100%; font-size: var(--t-xs); }
.ux-msg-text .translation-status { color: var(--c-muted); font-size: var(--t-sm); font-style: italic; }
.ux-outbox-state { font-size: var(--t-xs); font-weight: 600; color: var(--c-muted); }
.ux-outbox-state.failed, .ux-outbox-state.unknown { color: var(--c-danger); }
.ux-msg.is-flash .bubble { animation: ux-flash 1.5s ease; }
@keyframes ux-flash { 0%, 40% { box-shadow: 0 0 0 3px #e0a23a; } 100% { box-shadow: 0 0 0 3px transparent; } }

.ux-latest-anchor { position: relative; height: 0; flex: 0 0 0; z-index: 3; }
.ux-latest { position: absolute; right: var(--s-3); bottom: var(--s-3); display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); min-height: var(--tap); padding: 0; border: 1px solid var(--c-line-strong); border-radius: 50%; background: var(--c-surface); color: var(--c-brand-strong); box-shadow: var(--sh-2); }
.ux-latest svg { width: 22px; height: 22px; }

/* Composer: everything within thumb reach, one row to type and send. */
.inbox .composer.ux-composer, .keyboard-open .inbox .composer.ux-composer { padding: 6px var(--s-3) calc(8px + env(safe-area-inset-bottom)); }
.ux-composer-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); margin-bottom: 6px; min-width: 0; }
.inbox .ux-composer .tabs.ux-segment, .keyboard-open .inbox .ux-composer .tabs.ux-segment { display: inline-flex; flex: 0 0 auto; gap: 2px; margin: 0; padding: 2px; border-radius: var(--r-sm); background: var(--c-sunk); }
.inbox .ux-composer .tabs.ux-segment button, .keyboard-open .inbox .ux-composer .tabs.ux-segment button { position: relative; min-height: 30px; padding: 4px 11px; border: 0; border-radius: 6px; background: transparent; color: var(--c-muted); font-size: var(--t-sm); font-weight: 600; white-space: nowrap; }
.inbox .ux-composer .tabs.ux-segment button::after { content: ""; position: absolute; inset: -7px 0; }
.inbox .ux-composer .tabs.ux-segment button.active { background: var(--c-surface); color: var(--c-brand-strong); box-shadow: 0 1px 3px #1122381f; }
.ux-lang { display: inline-flex; align-items: center; gap: 6px; min-width: 0; flex: 0 1 auto; color: var(--c-muted); font-size: var(--t-xs); }
.ux-lang > span { flex: 0 0 auto; }
.inbox .ux-composer .ux-lang select, .keyboard-open .inbox .ux-composer .ux-lang select { flex: 0 1 150px; width: 150px; min-width: 0; max-width: 100%; min-height: 34px; height: 34px; padding: 3px 24px 3px 9px; border-radius: var(--r-sm); background-color: var(--c-surface); font-size: 13px; text-overflow: ellipsis; }
.ux-composer-row { display: flex; align-items: flex-end; gap: 6px; min-width: 0; }
.inbox .ux-composer .ux-composer-row textarea, .keyboard-open .inbox .ux-composer .ux-composer-row textarea { flex: 1 1 auto; width: auto; min-width: 0; height: 44px; min-height: 44px; max-height: 132px; padding: 10px 12px; border-radius: 14px; font-size: 16px; line-height: 1.4; resize: none; }
.inbox .ux-composer .ux-icon-btn { border-color: var(--c-line); background: var(--c-surface); }
.inbox .ux-composer .ux-send { display: inline-flex; align-items: center; justify-content: center; gap: 5px; flex: 0 0 auto; min-height: var(--tap); height: var(--tap); padding: 0 14px; border-radius: 14px; font-size: 13px; white-space: nowrap; }
.inbox .ux-composer .ux-send svg { width: 17px; height: 17px; }
.inbox .ux-composer .reply-label { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); margin: 0 0 6px; padding: 2px 4px 2px 10px; border-left: 3px solid var(--c-brand); border-radius: 4px; background: var(--c-brand-soft); color: var(--c-brand-strong); font-size: var(--t-sm); font-weight: 600; }
.inbox .ux-composer .reply-label:empty { display: none; }
.inbox .ux-composer .reply-label button.link { min-height: 36px; padding: 4px 8px; }
.inbox .ux-composer .status-line { margin-top: 5px; }

@media (max-width: 700px) {
  .inbox .chat-head.ux-chat-head, .keyboard-open .inbox .chat-head.ux-chat-head { min-height: calc(56px + env(safe-area-inset-top)); padding: calc(6px + env(safe-area-inset-top)) 6px 6px 2px; gap: 6px; }
  .inbox .chat-head.ux-chat-head .avatar { display: flex; width: 36px; height: 36px; flex: 0 0 36px; }
  .inbox .ux-composer .status-line { display: none; }
  .keyboard-open .inbox .chat-head .ux-head-title small { display: none; }
  .keyboard-open .ux-composer-top { margin-bottom: 4px; }
  .chat-list .chat-filters.ux-chips { margin: 0 5px 8px; }
  .inbox .chat-list { padding-top: 14px; }
  .chat-list h3 { margin-bottom: 10px; }
}
@media (max-width: 360px) {
  .ux-lang > span { display: none; }
  .inbox .ux-composer .ux-send span { display: none; }
  .inbox .ux-composer .ux-send { padding: 0; width: var(--tap); }
}
@media (min-width: 701px) {
  .ux-sticky { margin: 0 0 var(--s-4); padding: 0; position: static; background: transparent; box-shadow: none; }
  .inbox .message.ux-msg { max-width: min(76%, 720px); }
  .inbox .messages { padding: var(--s-4) var(--s-5); }
  .inbox .composer.ux-composer { padding: 10px var(--s-4) 12px; }
  .inbox .ux-composer .ux-lang select { flex-basis: 230px; width: 230px; }
  .chat-item.ux-chat .avatar { width: 40px; height: 40px; }
  .chat-item.ux-chat { min-height: 62px; }
}

/* Desktop: the conversation context (dossier, facts, tasks) gets its own column. */
@media (min-width: 1280px) {
  .inbox.has-chat { grid-template-columns: clamp(260px, 24%, 340px) minmax(0, 1fr) 300px; }
  .inbox.has-chat .conversation { border-radius: 0; }
  .inbox.has-chat .chat-detail { display: block; min-width: 0; min-height: 0; padding: var(--s-5); overflow-y: auto; border-left: 0; border-radius: 0 var(--r-lg) var(--r-lg) 0; scrollbar-width: thin; font-size: var(--t-sm); }
  .chat-detail h3 { margin: 0 0 var(--s-2); font-size: var(--t-base); }
  .chat-detail hr { margin: var(--s-4) 0; border: 0; border-top: 1px solid var(--c-line); }
  .chat-detail dl { margin: var(--s-2) 0; }
  .chat-detail dt { margin-top: var(--s-2); color: var(--c-muted); font-size: var(--t-xs); font-weight: 600; }
  .chat-detail dd { margin: 1px 0 0; font-size: var(--t-base); overflow-wrap: anywhere; }
  .chat-detail > .avatar, .chat-detail > .avatar + h3 { display: none; }
  .chat-detail button { width: 100%; margin-top: var(--s-2); }
  .chat-detail p { font-size: var(--t-sm); line-height: 1.5; overflow-wrap: anywhere; }
}

/* ===================== 5. shared: lists, groups, dialogs ===================== */
.ux-skeleton { display: grid; gap: var(--s-2); }
.ux-skeleton i { display: block; height: 64px; border-radius: var(--r-md); background: linear-gradient(90deg, #e9eef3 25%, #f3f6f9 50%, #e9eef3 75%); background-size: 200% 100%; animation: ux-shimmer 1.3s linear infinite; }
@keyframes ux-shimmer { to { background-position: -200% 0; } }
.ux-none { color: var(--c-faint); }
.ux-chip-clear { color: var(--c-danger); border-color: #f0d5d9; }

/* Collapsible group with a count (Чакащи, reminders…). */
.ux-group { margin: 0 0 var(--s-3); }
.ux-group > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); min-height: var(--tap); padding: 0 var(--s-1); cursor: pointer; list-style: none; color: var(--c-ink); font-size: var(--t-base); font-weight: 680; }
.ux-group > summary::-webkit-details-marker { display: none; }
.ux-group > summary > span:first-child::before { content: "▸"; display: inline-block; width: 16px; color: var(--c-muted); font-size: 12px; }
.ux-group[open] > summary > span:first-child::before { content: "▾"; }
.ux-hint { margin: var(--s-4) 0 0; padding: 0 var(--s-3); border: 1px solid var(--c-line); border-radius: var(--r-md); background: var(--c-surface); }
.ux-hint summary { min-height: var(--tap); display: flex; align-items: center; cursor: pointer; color: var(--c-muted); font-size: var(--t-sm); font-weight: 600; }
.ux-hint p { margin: 0 0 var(--s-3); color: var(--c-muted); font-size: var(--t-sm); line-height: 1.55; }

/* Dialogs: the frame never scrolls, the content does. So the close button is always
   reachable and a form's main action stays pinned to the bottom edge. */
dialog { --dlg-x: 30px; --dlg-t: 30px; --dlg-b: 30px; }
#dialog[open] { display: flex; flex-direction: column; padding: 0 !important; overflow: hidden; }
#dialog-content { flex: 1 1 auto; min-height: 0; padding: var(--dlg-t) var(--dlg-x) var(--dlg-b); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
#dialog > .close { position: absolute; top: 10px; right: 10px; z-index: 6; width: 40px; min-width: 40px; height: 40px; min-height: 40px !important; border-radius: 50%; box-shadow: 0 0 0 4px #ffffffe6; }
dialog h2 { padding-right: 44px; overflow-wrap: anywhere; }
.ux-dialog-foot { position: sticky; bottom: calc(-1 * var(--dlg-b)); z-index: 5; display: flex; justify-content: flex-end; gap: var(--s-2); margin: var(--s-4) calc(-1 * var(--dlg-x)) calc(-1 * var(--dlg-b)); padding: var(--s-3) var(--dlg-x) calc(var(--s-3) + env(safe-area-inset-bottom)); border-top: 1px solid var(--c-line); background: #fff; }
.ux-dialog-foot > button { min-height: 46px; min-width: 110px; }
.ux-dialog-foot > button.primary { flex: 1 1 auto; max-width: 320px; }
.ux-sheet .profile-heading h2 { padding-right: 0; }

/* ================================ 6. dossiers ================================ */
.ux-dossier-list { display: grid; gap: var(--s-2); }
.ux-dos-head { display: none; }
.ux-dossier { display: flex; flex-wrap: wrap; align-items: center; gap: 6px var(--s-2); width: 100%; min-height: 0; padding: var(--s-3) 14px; border: 1px solid var(--c-line); border-radius: var(--r-md); background: var(--c-surface); text-align: left; font-weight: 400; box-shadow: var(--sh-1); }
.ux-dossier:hover { border-color: var(--c-brand-line); background: #fbfefd; }
.ux-dos-cell { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; color: var(--c-ink-2); font-size: var(--t-sm); line-height: 1.4; }
.ux-dos-cell.is-title { flex: 1 1 100%; }
.ux-dos-cell.is-title strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; color: var(--c-ink); font-size: var(--t-base); font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
.ux-dos-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--s-2); flex: 1 1 100%; min-width: 0; }
.ux-dos-line.is-empty { display: none; }
.ux-dos-line:has(.is-stage) { flex-wrap: nowrap; }
.ux-dos-cell.is-stage { flex: 0 0 auto; }
.ux-dos-cell.is-country { flex: 1 1 0; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; font-weight: 600; }
.ux-dos-cell.is-roles, .ux-dos-cell.is-deal { flex: 0 1 auto; }
.ux-dos-cell.is-cats { flex: 1 1 100%; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c-muted); font-size: var(--t-xs); }
.ux-dos-cell:has(> .ux-none:only-child) { display: none; }
.ux-dos-cell.is-country:has(> .ux-none:only-child) { display: block; visibility: hidden; }

.ux-dossier-view h2 { margin-bottom: var(--s-1); }
.ux-dos-where { margin: 0 0 var(--s-2); color: var(--c-ink-2); font-size: var(--t-base); font-weight: 600; }
.ux-dos-meta { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 var(--s-4); }
.ux-dos-meta .ux-pill { white-space: normal; overflow: visible; }
.ux-dos-section { margin: 0 0 var(--s-3); padding: var(--s-3) 14px; border: 1px solid var(--c-line); border-radius: var(--r-md); background: #fbfcfd; }
.ux-dos-section h3 { margin: 0 0 var(--s-1); color: var(--c-muted); font-size: var(--t-xs); font-weight: 700; letter-spacing: .4px; text-transform: uppercase; }
.ux-dos-section p { margin: 0; color: var(--c-ink); font-size: var(--t-base); line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.ux-dos-section.is-next { border-color: var(--c-warn-line); background: #fffaf0; }
.ux-dos-section.is-next h3 { color: var(--c-warn); }
.ux-dos-updated { margin: var(--s-2) 0 0; font-size: var(--t-xs); }
#dossier-form .chip-set { padding: var(--s-2) var(--s-3) var(--s-3); }
#dossier-form .chip-check { margin: 3px 4px 3px 0; border-radius: var(--r-pill); }
#dossier-form .chip-check:has(input:checked) { background: var(--c-brand-soft); border-color: var(--c-brand-line); color: var(--c-brand-strong); font-weight: 600; }
#dossier-form textarea { line-height: 1.5; }

/* ================================ 7. contacts ================================ */
.ux-contact-list { display: grid; gap: var(--s-2); }
.ux-contact { display: flex; align-items: center; gap: var(--s-1); min-width: 0; padding: 4px 6px 4px 4px; border: 1px solid var(--c-line); border-radius: var(--r-md); background: var(--c-surface); box-shadow: var(--sh-1); }
.ux-contact-main { display: flex; align-items: center; gap: var(--s-3); flex: 1 1 auto; min-width: 0; min-height: 56px; padding: 6px 8px; border: 0; border-radius: var(--r-sm); background: transparent; text-align: left; font-weight: 400; }
.ux-contact-main .grow { display: grid; gap: 1px; min-width: 0; }
.ux-contact-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c-ink); font-size: var(--t-base); font-weight: 650; }
.ux-contact-meta, .ux-contact-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c-muted); font-size: var(--t-sm); }
.ux-contact-note { color: var(--c-warn); font-size: var(--t-xs); }
.ux-contact .avatar { width: 42px; height: 42px; flex: 0 0 42px; }
.ux-contact .ux-icon-btn { border: 0; background: var(--c-sunk); color: var(--c-brand-strong); }

/* ================================ 8. awaiting ================================ */
.ux-ops-grid { display: grid; gap: var(--s-2); }
.panel.ops-card.ux-ops { margin: 0; padding: 0; overflow: hidden; border-radius: var(--r-md); box-shadow: var(--sh-1); }
.panel.ops-card.ux-ops { display: flex; flex-direction: column; }
.ux-ops-main { display: grid; align-content: start; flex: 1 1 auto; gap: 3px; width: 100%; min-height: 0; padding: var(--s-3) 14px var(--s-2); border: 0; border-radius: 0; background: transparent; text-align: left; font-weight: 400; }
.ux-ops-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); min-width: 0; }
.ux-ops-top strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c-ink); font-size: var(--t-base); font-weight: 650; }
.ux-ops-top .ux-pill { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.ux-ops-preview { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; color: var(--c-ink-2); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.ux-ops-preview b { font-weight: 600; color: var(--c-ink); }
.ux-ops-meta { color: var(--c-muted); font-size: var(--t-xs); }
.ux-ops .ux-actions { gap: 0; border-top: 1px solid var(--c-line); }
.ux-ops .ux-actions > button { border: 0; border-radius: 0; background: #fafcfd; color: var(--c-ink-2); font-weight: 600; }
.ux-ops .ux-actions > button + button { border-left: 1px solid var(--c-line); }
.ux-ops .ux-actions > button:hover { background: var(--c-brand-soft); color: var(--c-brand-strong); }
.ux-reminders { padding: 2px 14px; }
.ux-reminders .task-row { min-height: 60px; padding: 10px 0; }

/* ================================= 9. tasks ================================= */
.task-filters.ux-chips { margin: 0; }
.kanban.ux-kanban { gap: var(--s-3); }
.ux-kanban .column { min-height: 0; padding: var(--s-3); }
.ux-kanban .column h3 { display: flex; align-items: center; justify-content: space-between; margin: 0 2px var(--s-2); }
.ux-kanban .column.is-empty > p { margin: 0; font-size: var(--t-sm); }
.task.ux-task { display: flex; align-items: center; gap: var(--s-1); margin: 0 0 6px; padding: 2px 4px 2px 2px; border: 1px solid var(--c-line); border-left: 3px solid var(--c-line-strong); border-radius: var(--r-sm); background: var(--c-surface); }
.task.ux-task.is-overdue { border-left-color: #d9924a; }
.ux-task-main { display: grid; gap: 2px; flex: 1 1 auto; min-width: 0; min-height: 52px; padding: 7px 10px; border: 0; border-radius: 6px; background: transparent; text-align: left; font-weight: 400; }
.ux-task-main strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; color: var(--c-ink); font-size: var(--t-base); font-weight: 600; line-height: 1.35; }
.ux-task-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c-muted); font-size: var(--t-xs); }
.ux-task-meta .overdue { color: #a45a25; font-weight: 600; }
.ux-task .ux-icon-btn { border: 0; background: transparent; color: var(--c-brand-strong); }
.ux-task .ux-icon-btn svg { width: 18px; height: 18px; }

@media (max-width: 700px) {
  dialog { --dlg-x: 20px; --dlg-t: 26px; --dlg-b: 22px; }
  #dialog:has(.workspace-menu) { --dlg-b: calc(19px + env(safe-area-inset-bottom)); }
  .ux-dialog-foot > button { flex: 1 1 0; min-width: 0; }
  .ux-dialog-foot > button.primary { max-width: none; flex: 1.4 1 0; }
  .ux-head .subtitle { display: none; }
  .ux-head { margin-bottom: var(--s-2); min-height: var(--tap); }
  main:not([data-view="chat"]):not([data-view="home"]) { padding-top: var(--s-4); }
}
@media (min-width: 701px) {
  dialog:has(.ux-dossier-view), dialog:has(#dossier-form) { width: min(760px, calc(100vw - 32px)); }
  .ux-contact-list { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: var(--s-3); }
  .ux-kanban[data-columns="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ux-sticky.ops-filters, .ux-sticky.dossier-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
  .ux-sticky.ops-filters > input, .ux-sticky.dossier-toolbar > input { flex: 0 1 340px; width: auto; }
  .ux-sticky .ux-chips { flex: 0 1 auto; }
  .ux-select-row { max-width: 760px; }
  .ux-sticky.ops-filters .ux-select-row { flex: 0 1 420px; }
  .ux-settings-nav select.ux-chip { max-width: 320px; }
  .ux-sticky > input[type="search"] { max-width: 420px; }
}
@media (min-width: 1100px) {
  .ux-ops-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
  /* Dossiers become a real table: sticky header, one line per person. */
  .ux-dossier-list { gap: 0; border: 1px solid var(--c-line); border-radius: var(--r-lg); background: var(--c-surface); box-shadow: var(--sh-1); }
  .ux-dos-head, .ux-dossier { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(0, 1.5fr) minmax(0, 1.3fr) minmax(0, 1.5fr) minmax(0, .9fr) minmax(0, 1.1fr); grid-template-areas: none; gap: var(--s-4); align-items: center; padding: 11px var(--s-5); }
  .ux-dos-head { position: sticky; top: var(--header-height); z-index: 4; border-bottom: 1px solid var(--c-line); border-radius: var(--r-lg) var(--r-lg) 0 0; background: #f8fafcf5; color: var(--c-muted); font-size: var(--t-xs); font-weight: 700; letter-spacing: .4px; text-transform: uppercase; }
  .ux-dos-line, .ux-dos-line.is-empty { display: contents; }
  .ux-dossier .ux-pill { white-space: normal; overflow: visible; text-align: left; }
  .ux-dossier { border: 0; border-bottom: 1px solid var(--c-line); border-radius: 0; box-shadow: none; }
  .ux-dossier:last-of-type { border-bottom: 0; }
  .ux-dossier .ux-dos-cell, .ux-dossier .ux-dos-cell:has(> .ux-none:only-child) { display: flex; visibility: visible; flex: initial; justify-content: flex-start; text-align: left; white-space: normal; }
  .ux-dossier .ux-dos-cell.is-country, .ux-dossier .ux-dos-cell.is-cats { display: block; white-space: normal; }
  .ux-dossier-list > .ux-more { margin: var(--s-3); width: calc(100% - 2 * var(--s-3)); }
  .ux-dossier-list > .empty, .ux-dossier-list > .ux-skeleton { margin: var(--s-4); }
}

/* ================================= 10. home ================================= */
.ux-home-head { margin-bottom: var(--s-4); }
.ux-home-head .subtitle { display: block; margin-top: var(--s-1); }
.ux-home-head .subtitle::first-letter { text-transform: uppercase; }
.metric.metric-accent { border-color: var(--c-warn-line); background: #fffaf0; }
.metric.metric-accent .metric-value { color: var(--c-warn); }
.metric.metric-accent .metric-icon { background: var(--c-warn-soft); color: var(--c-warn); }
.quick-stats.ux-stats .metric:first-child:not(.metric-accent) { border-color: #dfe8ed; background: #fff; }
.quick-stats.ux-stats .metric:first-child:not(.metric-accent) .metric-value { color: #18354b; }
.home-grid .conversation-row .grow > strong { font-weight: 650; }
.home-grid .conversation-row { min-height: 64px; padding: 10px 0; }
.home-grid .task-row { min-height: 60px; padding: 10px 0; }
.home-grid .row-meta .ux-pill { font-variant-numeric: tabular-nums; }
.home-grid .ux-skeleton { padding: var(--s-2) 0 var(--s-4); }
.home-grid .ux-skeleton i { height: 52px; }

/* ============================ 11. accounts & money ============================ */
/* Bookmaker chips: one row of the most used; the round button unfolds the rest. */
.money-chips-wrap { display: flex; align-items: flex-start; gap: 6px; min-width: 0; }
.money-chips-wrap .money-chips { flex: 1 1 auto; flex-wrap: wrap; max-height: 38px; overflow: hidden; padding: 0; margin: 0; }
.money-chips-wrap.is-open .money-chips { max-height: none; }
.money-chips .money-chip { min-height: 36px; position: relative; white-space: nowrap; max-width: 100%; }
.money-chips .money-chip::after { content: ""; position: absolute; inset: -4px 0; }
.money-chips-more { display: inline-flex; align-items: center; justify-content: center; gap: 3px; flex: 0 0 auto; min-width: 46px; min-height: 36px; height: 36px; padding: 0 9px; border: 1px solid var(--c-line); border-radius: var(--r-pill); background: var(--c-sunk); color: var(--c-ink-2); font-size: var(--t-sm); font-weight: 700; position: relative; }
.money-chips-more::after { content: ""; position: absolute; inset: -4px 0; }
.money-chips-more span::after { content: " ▾"; font-size: 10px; }
.money-chips-wrap.is-open .money-chips-more span::after { content: " ▴"; }
.money-toolbar { flex-wrap: nowrap; }
.money-toolbar .money-search { flex: 1 1 auto; }
.money-toolbar .money-toggle { flex: 0 0 auto; min-height: 46px; }
.money-wrap.is-transfers .money-toolbar { position: static; }

/* Balance: compact and always in view while reading the transfers. */
.money-balance { position: sticky; top: var(--header-height, 0px); z-index: 4; display: grid; gap: 0; border: 1px solid var(--c-line); border-radius: var(--r-md); background: #fffffff7; box-shadow: var(--sh-1); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.money-balance-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 0 var(--s-3); padding: 9px 14px; }
.money-balance-row + .money-balance-row { border-top: 1px solid var(--c-line); }
.money-balance-label { color: var(--c-muted); font-size: var(--t-xs); font-weight: 700; letter-spacing: .4px; text-transform: uppercase; }
.money-balance-row strong { font-size: 20px; font-weight: 720; letter-spacing: -.3px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.money-balance-row strong em { font-style: normal; font-size: 13px; font-weight: 600; color: var(--c-muted); }
.money-balance-row strong.pos { color: var(--c-ok); }
.money-balance-row strong.neg { color: var(--c-danger); }
.money-balance-row small { grid-column: 1 / -1; color: var(--c-ink-2); font-size: var(--t-xs); line-height: 1.5; }
.money-balance-row .warn-text { color: var(--c-warn); }

/* A transfer is one line; details unfold on tap. */
details.money-transfer { display: block; margin: 0; padding: 0; gap: 0; overflow: hidden; border-radius: var(--r-md); }
.money-wrap.is-transfers .money-list { grid-template-columns: minmax(0, 1fr); gap: var(--s-2); max-width: 920px; }
.money-transfer-line { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto 14px; align-items: center; gap: var(--s-2) 10px; min-height: 60px; padding: 8px 12px; cursor: pointer; list-style: none; }
.money-transfer-line::-webkit-details-marker { display: none; }
.money-transfer-line .money-dir { justify-content: center; width: 32px; height: 32px; padding: 0; border-radius: 50%; }
.money-transfer-when { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 var(--s-2); min-width: 0; }
.money-transfer-when .money-date { font-size: var(--t-base); font-variant-numeric: tabular-nums; }
.money-transfer-dir { color: var(--c-muted); font-size: var(--t-xs); white-space: nowrap; }
.money-transfer-line .money-transfer-amount { grid-column: auto; display: block; text-align: right; white-space: nowrap; }
.money-transfer-line .money-transfer-amount strong { font-size: 17px; letter-spacing: -.2px; font-variant-numeric: tabular-nums; }
.money-transfer-line .money-transfer-amount strong.pos { color: var(--c-ok); }
.money-transfer-line .money-transfer-amount strong.neg { color: var(--c-danger); }
.money-transfer-line .money-transfer-amount em { font-size: var(--t-xs); }
.money-transfer-line .money-transfer-badges { grid-column: auto; flex-wrap: nowrap; }
.money-transfer-caret::before { content: "▾"; color: var(--c-faint); font-size: 12px; display: inline-block; transition: transform var(--ease); }
details.money-transfer[open] .money-transfer-caret::before { transform: rotate(180deg); }
.money-transfer-body { display: grid; gap: var(--s-3); padding: var(--s-3) 14px 14px; border-top: 1px solid var(--c-line); background: #fbfcfd; }
.money-transfer-none { margin: 0; font-size: var(--t-sm); }

/* ================================ 12. settings ================================ */
.ux-settings-nav { margin-bottom: var(--s-3); }
.settings > section.panel { scroll-margin-top: calc(var(--header-height) + 60px); }
.settings .row > button.danger { border-color: #f0d5d9; }

/* ================================ 13. "Още" menu ================================ */
.menu-grid button.active { border-color: var(--c-brand-line); background: var(--c-brand-soft); color: var(--c-brand-strong); }
.ux-menu-status { display: flex; align-items: center; gap: 6px; }
.ux-menu-status .dot { display: inline-block; flex: 0 0 auto; border-radius: 50%; }

@media (max-width: 700px) {
  .money-toolbar .money-toggle span { font-size: var(--t-sm); }
}
@media (max-width: 700px) {
  .money-transfer-line { grid-template-columns: auto minmax(0, 1fr) auto 14px; grid-template-areas: "icon when amount caret" "icon badges badges caret"; gap: 2px 10px; }
  .money-transfer-line .money-dir { grid-area: icon; }
  .money-transfer-line .money-transfer-when { grid-area: when; }
  .money-transfer-line .money-transfer-amount { grid-area: amount; }
  .money-transfer-line .money-transfer-badges { grid-area: badges; }
  .money-transfer-line .money-transfer-caret { grid-area: caret; }
}
@media (min-width: 701px) {
  .money-balance { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .money-balance-row + .money-balance-row { border-top: 0; border-left: 1px solid var(--c-line); }
  .money-transfer-line { grid-template-columns: auto 190px minmax(0, 1fr) auto 14px; padding: 8px 18px; }
  .money-transfer-line .money-transfer-amount { text-align: left; }
  .ux-settings-nav { position: sticky; top: var(--header-height); z-index: 15; padding: var(--s-2) 0; background: var(--c-bg); }
}

/* Failed-to-load state with a way out. */
.ux-retry { margin-top: var(--s-3); }

/* Phone: dropdowns keep 16px text (iOS zooms the page on smaller form text). */
@media (max-width: 700px) {
  select.ux-chip { min-height: 44px; padding: 8px 28px 8px 13px; border-radius: var(--r-md); font-size: 16px; font-weight: 500; background-position: right 10px center; }
  select.ux-chip::after { content: none; }
  .chat-list .chat-filters.ux-chips { margin: 0 5px 8px; gap: 5px; }
  .chat-list .chat-filters .ux-chip { padding: 6px 9px; }
}
@media (max-width: 360px) {
  .ux-chips { flex-wrap: wrap; }
}
@media (min-width: 701px) {
  .ux-filter-toggle { display: none; }
  .ux-search-with-button { display: block; flex: 0 1 340px; }
  .ux-filter-panel, .ux-filter-panel.is-open { display: grid; }
  #dos-selects { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Wider screens have room: chips wrap onto a second line instead of squeezing. */
@media (min-width: 701px) {
  .ux-chips { flex-wrap: wrap; }
  .ux-chip { flex: 0 0 auto; }
}
