:root {
  color-scheme: light;
  font-family: "Segoe UI Variable", "Segoe UI", system-ui, "Microsoft YaHei", sans-serif;
  color: var(--navy);
  background: var(--page);
  --page: #f2f4f7;
  --surface: #fff;
  --panel: #eff2f6;
  --field: #f7f8fa;
  --hover: #e9edf3;
  --accent-surface: #edf3ff;
  --accent-line: #d3dff7;
  --navy: #202a39;
  --muted: #586578;
  --line: #dce2eb;
  --blue: #204af0;
  --blue-hover: #163acf;
  --link: #294bb3;
  --focus: #5579ea;
  --danger: #a33244;
  --online: #23794f;
  --paid-surface: #eaf7ee;
  --paid-line: #b9dfc4;
  --paid-badge: #d4eedc;
  --paid-ink: #236442;
  --ice: #f5f7fa;
  --warm-surface: #f8ebe4;
  --warm-text: #8b4c2d;
  --operator-accent: #dfb530;
  --operator-surface: #fff8d9;
  --operator-pulse: #ffefb5;
  --disabled: #e5e9f0;
  --shadow: 0 16px 38px #24324d12;
  --backdrop: #222f4a67;
  --window-scroll-thumb: #7788a6;
  --window-scroll-hover: #4e6490;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #20242c;
  --surface: #292f39;
  --panel: #353d4b;
  --field: #242a33;
  --hover: #3a4454;
  --accent-surface: #344563;
  --accent-line: #4a6082;
  --navy: #eff2f8;
  --muted: #b4becd;
  --line: #424c5b;
  --blue: #345bf3;
  --blue-hover: #4166f5;
  --link: #bdccff;
  --focus: #a4b9fd;
  --danger: #ffa9b4;
  --online: #65ca97;
  --paid-surface: #243b31;
  --paid-line: #416b55;
  --paid-badge: #355642;
  --paid-ink: #a5e6bc;
  --ice: #222832;
  --warm-surface: #43342e;
  --warm-text: #f1bfa3;
  --operator-accent: #f2c94d;
  --operator-surface: #383528;
  --operator-pulse: #49412c;
  --disabled: #3b4352;
  --shadow: 0 16px 38px #10141c30;
  --backdrop: #11141caa;
  --window-scroll-thumb: #8799b8;
  --window-scroll-hover: #a4b5d2;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
body:not(.payment-page) { display: flow-root; min-height: 100dvh; background: var(--page); }
button, textarea, input { font: inherit; }
.select-wrap { display: block; position: relative; min-width: 0; }
.select-wrap select { appearance: none; width: 100%; padding-inline-end: 42px; cursor: pointer; }
.select-wrap::after { content: ''; position: absolute; inset-inline-end: 17px; top: calc(50% - 6px); width: 8px; height: 8px; color: var(--muted); border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); pointer-events: none; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.workspace {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  max-width: 1336px;
  height: calc(100dvh - 80px);
  min-height: 400px;
  margin: 40px auto;
  width: calc(100% - 88px);
  overflow: hidden;
  isolation: isolate;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sidebar { display: flex; flex-direction: column; min-height: 0; padding: 21px 16px 14px; border-inline-end: 1px solid var(--line); background: var(--field); }
.sidebar:focus-visible { outline: none; }
.brand-mark { display: block; flex: none; border-radius: 12px; }
.sidebar-backdrop, #sidebar-toggle { display: none; }
.sidebar-label { flex: none; margin: 0 8px 6px; color: var(--muted); font-size: .81rem; font-weight: 650; }
.sidebar-search {
  display: flex; flex: none; align-items: center; gap: 8px; min-height: 42px; margin-bottom: 8px; padding-inline: 10px 4px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted);
}
.sidebar-search:focus-within { border-color: var(--focus); }
.sidebar-search .icon-search { width: 14px; height: 14px; border: 1.5px solid currentColor; border-radius: 50%; }
.icon-search::after { position: absolute; inset: auto -4px -2px auto; width: 6px; height: 1.5px; border-radius: 2px; background: currentColor; transform: rotate(45deg); content: ''; }
#sidebar-search { flex: 1; width: 100%; min-width: 0; padding: 8px 0 8px 2px; border: 0; outline: 0; background: transparent; color: var(--navy); font-size: .88rem; }
#sidebar-search::-webkit-search-cancel-button { display: none; }
#sidebar-search::placeholder { color: var(--muted); opacity: 1; }
.sidebar-search .plain-button { width: 33px; height: 33px; background: transparent; }
.sidebar-search .icon-close { transform: scale(.72); }
.sidebar-search-status { margin: 9px 7px; color: var(--muted); font-size: .84rem; }
#sidebar-search-results .contact-link { border-color: var(--line); background: var(--surface); }
#sidebar-search-results .contact-link:hover { border-color: var(--focus); background: var(--hover); }
.sidebar-lists { overflow: auto; min-height: 0; padding-bottom: 8px; overscroll-behavior: contain; scrollbar-width: thin; }
.sidebar-lists .sidebar-dialogs { overflow: visible; }
#sidebar-archive-empty { padding-inline: 8px; color: var(--muted); font-size: .84rem; }
.room-card { display: flex; flex: none; align-items: center; gap: 10px; padding: 9px; border: 1px solid var(--accent-line); border-inline-start: 3px solid var(--focus); border-radius: 10px; background: var(--accent-surface); color: inherit; text-decoration: none; }
.room-card:hover { border-color: var(--focus); }
.room-card:focus-visible { outline-offset: -3px; }
.room-icon { display: grid; flex: 0 0 34px; height: 34px; place-items: center; border-radius: 9px; background: var(--surface); color: var(--link); }
.room-copy { flex: 1; min-width: 0; }
.room-copy b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar b { display: block; font-size: .92rem; font-weight: 650; }
.sidebar small { display: block; color: var(--muted); }
.sidebar-room { display: flex; flex-direction: column; min-height: 0; }
.room-copy small { margin-top: 4px; font-size: .78rem; line-height: 1.25; }
.room-copy small:empty { display: none; }
.sidebar-dialogs { display: grid; gap: 2px; min-height: 0; margin-top: 5px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.sidebar-dialogs .contact-link { padding: 6px 8px; border-color: transparent; font-size: .88rem; }
.sidebar-archive { display: flex; width: 100%; align-items: center; gap: 10px; min-height: 42px; margin-top: 6px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; color: var(--link); background: var(--surface); text-align: start; font-size: .88rem; font-weight: 650; }
.sidebar-archive:not(:disabled):hover { background: var(--hover); }
.sidebar-archive .archive-unread { margin-inline-start: 0; }
.sidebar-archive::after { width: 7px; height: 7px; margin-inline: auto 6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); content: ''; }
.sidebar-archive[aria-expanded="true"]::after { transform: rotate(225deg); }
.sidebar-delivery-empty { margin: 9px 8px; color: var(--muted); font-size: .83rem; }
.sidebar-dialogs .delivery-queue-row.is-pending:not([aria-current]) { background: var(--accent-surface); border-color: var(--accent-line); }
.delivery-queue-row.is-complete:not([aria-current]) .contact-name { color: var(--muted); }
.icon-archive { width: 16px; height: 14px; border: 1.5px solid currentColor; border-radius: 3px; }
.icon-archive::before, .icon-archive::after { position: absolute; content: ''; }
.icon-archive::before { inset: 3px 0 auto; border-top: 1.5px solid currentColor; }
.icon-archive::after { inset: 7px 4px auto; border-top: 1.5px solid currentColor; }
.sidebar-profile { display: flex; flex: none; align-items: center; gap: 9px; margin-bottom: 12px; padding: 0 5px 9px; border-bottom: 1px solid var(--line); }
.sidebar-profile .avatar { width: 35px; height: 35px; border-radius: 10px; }
.sidebar-profile b { min-width: 0; font-size: .91rem; }
.sidebar-bottom { display: grid; flex: none; grid-template-columns: minmax(0, 1fr) 44px; gap: 8px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.sidebar-bottom .quiet-button { min-height: 44px; }
.sidebar-operator { grid-column: 1 / -1; justify-content: flex-start; }
.sidebar-operator .archive-unread { margin-inline-start: auto; }
.sidebar-operator.needs-attention {
  border-color: transparent; background: var(--operator-surface);
}
.sidebar-operator.needs-attention:hover { background: var(--operator-pulse); }
#sidebar-toggle.operator-attention { position: relative; }
#sidebar-toggle.operator-attention::after {
  content: ''; position: absolute; inset-block-start: 6px; inset-inline-end: 5px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--operator-accent);
}
@media (prefers-reduced-motion: no-preference) {
  .sidebar-operator.needs-attention:not(:hover) { animation: operator-attention-pulse 2.4s ease-in-out infinite; }
  #sidebar-toggle.operator-attention::after { animation: operator-dot-pulse 2.4s ease-in-out infinite; }
}
@keyframes operator-attention-pulse {
  50% { background-color: var(--operator-pulse); }
}
@keyframes operator-dot-pulse {
  50% { opacity: .55; }
}
.operator-reminder {
  position: fixed; z-index: 4; inset-block-start: max(12px, env(safe-area-inset-top)); inset-inline-end: 12px;
  width: min(370px, calc(100% - 24px)); padding: 12px; border: 1px solid var(--line);
  border-radius: 13px; background: var(--operator-surface); color: var(--navy); box-shadow: var(--shadow);
}
.operator-reminder p { margin: 0 0 8px; font-size: .9rem; font-weight: 650; }
.operator-reminder-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.supplier-payout-content { display: grid; gap: 12px; margin-block-start: 12px; }
.profile-fulfillment-form, .profile-fulfillment-fields { display: grid; gap: 12px; min-width: 0; }
.profile-fulfillment-fields label { display: grid; gap: 5px; min-width: 0; font-size: .88rem; font-weight: 650; }
.profile-fulfillment-fields :is(input, select, textarea) {
  width: 100%; min-height: 43px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--field); color: var(--navy); font: inherit; font-size: 1rem;
}
.profile-fulfillment-fields .select-wrap select { padding-inline-end: 42px; }
.profile-fulfillment-fields textarea { resize: vertical; }
.profile-fulfillment-fields .quiet-button { justify-self: start; }
.payout-instructions { display: grid; gap: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.payout-instructions a { color: var(--link); }
.supplier-payout-content .send, .supplier-payout-content .quiet-button { justify-self: start; white-space: normal; }
.supplier-qr-picker .supplier-qr-clip {
  width: 16px; height: 16px; fill: none; stroke: currentColor;
  stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round;
}
.sidebar .sidebar-add { justify-content: flex-start; padding-inline: 12px; border-color: var(--accent-line); background: var(--accent-surface); }
.sidebar .sidebar-add:not(:disabled):hover { background: var(--hover); }
.sidebar .sidebar-settings { padding: 0; }
.sidebar-settings-icon { font-size: 1.3rem; line-height: 1; }

.chat { display: grid; min-width: 0; min-height: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto; background: var(--surface); }
.chat-header { grid-row: 1; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 68px; padding: 10px 26px; border-bottom: 1px solid var(--line); }
.avatar { display: grid; place-items: center; width: 39px; height: 39px; flex-shrink: 0; overflow: hidden; border-radius: 13px; font-size: .76rem; font-weight: 750; line-height: 1; }
.avatar img, .contact-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.chat-peer-avatar { width: 42px; height: 42px; }
.avatar-ru { background: var(--accent-surface); color: var(--link); }
.avatar-zh { background: var(--warm-surface); color: var(--warm-text); font-size: 1.04rem; }
.country-flag { flex-shrink: 0; object-fit: cover; border-radius: 3px; outline: 1px solid #8c9ab355; outline-offset: -1px; }
.chat-heading { display: grid; flex: 1; gap: 4px; min-width: 0; }
.chat-heading-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat-heading-title h1 { min-width: 0; }
.chat-heading h1 { margin: 0; font-size: 1.25rem; font-weight: 750; letter-spacing: -.025em; }
.chat-heading p { margin: 0; color: var(--muted); font-size: .84rem; }
.chat-heading #channel-label { overflow-wrap: anywhere; }
.channel-avatar { background: var(--accent-surface); color: var(--link); font-size: .78rem; font-weight: 750; }
.delivery-feed-avatar { display: grid; place-items: center; }
.delivery-feed-avatar .delivery-icon { width: 20px; height: 20px; }
.channel-verified {
  display: inline-grid; flex: 0 0 14px; width: 14px; height: 14px; place-items: center;
  border-radius: 50%; background: var(--blue); color: #fff;
}
.channel-verified::before {
  content: ''; width: 7px; height: 4px; border: solid currentColor; border-width: 0 0 1.5px 1.5px;
  transform: translateY(-.5px) rotate(-45deg);
}
.contact-title-row { display: flex; min-width: 0; align-items: center; gap: 5px; }
.contact-title-row > :first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-pinned { display: grid; justify-self: start; gap: 2px; min-width: 0; max-width: 100%; padding: 4px 8px; border-inline-start: 2px solid var(--focus); color: var(--link); text-decoration: none; font-size: .78rem; }
.channel-pinned span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.channel-pinned:hover strong { text-decoration: underline; }
.chat-heading .country-pair { display: flex; align-items: center; gap: 5px; color: var(--link); font-weight: 600; overflow-wrap: anywhere; }
.country-pair-side { display: flex; align-items: center; min-width: 0; gap: 5px; }
.country-pair-arrow { position: relative; flex: 0 0 10px; border-top: 1px solid currentColor; }
.country-pair-arrow::before, .country-pair-arrow::after {
  position: absolute;
  top: -.5px;
  width: 4px;
  height: 4px;
  border: solid currentColor;
  border-width: 1px 0 0 1px;
  content: '';
}
.country-pair-arrow::before { left: .5px; transform: translateY(-50%) rotate(-45deg); }
.country-pair-arrow::after { right: .5px; transform: translateY(-50%) rotate(135deg); }
.chat-heading h1, .sidebar-profile b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-latest { order: 2; justify-self: start; min-height: 32px; padding: 0; border: 0; background: transparent; color: var(--link); font-size: .82rem; font-weight: 650; text-align: start; }
.history-latest:hover { text-decoration: underline; }
.order-icon { width: 17px; height: 15px; border: 1.5px solid currentColor; border-radius: 3px; position: relative; }
.order-icon::after { content: ''; position: absolute; top: 0; left: 5px; width: 5px; height: 6px; border: 1.5px solid currentColor; border-top: 0; }
.presence { display: flex; flex: none; gap: 6px; align-items: center; white-space: nowrap; }
.presence-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #78869d; }
.presence-dot.online { background: var(--online); animation: online-pulse 2.1s ease-out infinite; }
@keyframes online-pulse {
  0% { box-shadow: 0 0 0 0 #21a87580; }
  65%, 100% { box-shadow: 0 0 0 6px #21a87500; }
}
@media (prefers-reduced-motion: reduce) { .presence-dot.online { animation: none; } }
.quiet-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 43px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--link); font-size: .88rem; font-weight: 650; text-decoration: none; white-space: nowrap; }
.quiet-button:hover { background: var(--hover); }
.statusbar { grid-row: 2; display: flex; align-items: center; gap: 9px; min-height: 38px; padding: 5px 26px; background: var(--field); color: var(--muted); border-bottom: 1px solid var(--line); font-size: .83rem; font-weight: 600; }
.statusbar.is-ready { display: none; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #8493b4; flex-shrink: 0; }
.status-dot.offline { background: #df9c6f; }
.statusbar #connection { min-width: 0; }
.chat-blocked-notice { margin: 8px auto; padding: 11px 13px; width: min(100%, 880px); border: 1px solid var(--line); border-radius: 10px; background: var(--field); color: var(--muted); text-align: center; font-size: .88rem; }

.timeline { grid-row: 3; display: flex; flex-direction: column; overflow: auto; overscroll-behavior: contain; background: var(--ice); scrollbar-color: var(--line) transparent; }
.timeline:focus-visible { outline-offset: -3px; }
.timeline-inner { width: min(100%, 940px); margin: auto auto 0; padding: 18px 30px 24px; }
.empty, .chat-error { width: 100%; margin: auto; padding: 28px 24px; text-align: center; }
.empty h2 { margin: 15px 0 8px; font-size: clamp(1.44rem, 2.4vw, 1.8rem); font-weight: 760; letter-spacing: -.045em; }
.empty p, .chat-error p { margin: 0 auto; max-width: 365px; color: var(--muted); line-height: 1.52; }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.empty .empty-status { margin-top: 9px; color: var(--danger); }
.empty.has-history { margin-block: 0; padding-block: 14px; }
.empty.has-history .empty-art { display: none; }
.empty.has-history h2 { margin-top: 0; }
.chat-error a { display: inline-block; margin-top: 14px; padding: 8px; color: var(--link); }
.empty-art { position: relative; width: 163px; height: 114px; margin: 0 auto; }
.empty-tile { position: absolute; left: 36px; top: 12px; width: 91px; height: 85px; border: 1px solid var(--line); border-radius: 26px; transform: rotate(-10deg); background: var(--panel); }
.art-bubble { position: absolute; display: grid; place-items: center; width: 58px; height: 51px; border-radius: 16px; font-size: 1.58rem; font-weight: 750; box-shadow: var(--shadow); }
.art-bubble::after { position: absolute; bottom: -5px; width: 13px; height: 13px; transform: rotate(45deg); border-radius: 2px; background: inherit; content: ""; }
.art-ru { left: 20px; top: 20px; transform: rotate(-12deg); background: var(--blue); color: white; }
.art-ru::after { left: 12px; }
.art-zh { right: 17px; top: 49px; transform: rotate(12deg); background: var(--warm-surface); color: var(--warm-text); }
.art-zh::after { right: 13px; }
.spark { position: absolute; border-radius: 3px; transform: rotate(26deg); background: #8da3fc; }
.spark.one { top: 19px; right: 24px; width: 8px; height: 8px; }
.spark.two { bottom: 19px; left: 21px; width: 6px; height: 6px; background: #efaa8d; }

.message-list { display: flex; flex-direction: column; gap: 13px; }
.older { display: flex; margin: 0 auto 16px; }
.day { align-self: center; padding: 5px 12px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); color: var(--muted); font-size: .79rem; }
.message { display: flex; gap: 8px; align-items: end; width: 100%; }
.message.system-message { justify-content: center; }
.system-message .message-content {
  max-width: min(88%, 460px); padding: 8px 12px; border: 1px solid var(--paid-line);
  border-radius: 12px; background: var(--paid-surface); color: var(--paid-ink); text-align: center;
}
.system-message .message-meta { justify-content: center; }
:is(.shipment-message, .transfer-reported-message) .message-content { border-color: var(--accent-line); background: var(--accent-surface); color: var(--navy); }
.shipment-message .message-text { margin-block: 3px 6px; }
.shipment-message .delivery-icon { color: var(--link); }
.shipment-message-link { margin-bottom: 4px; }
.message.mine { justify-content: flex-end; }
.message .avatar { width: 33px; height: 33px; border-radius: 10px; }
.message-content { max-width: min(78%, 570px); min-width: 0; padding: 9px 12px 7px; border: 1px solid var(--line); border-radius: 12px 12px 12px 4px; background: var(--surface); }
.mine .message-content { border-color: var(--accent-line); border-radius: 12px 12px 4px 12px; background: var(--accent-surface); }
.message-search-hit .message-content { outline: 2px solid var(--focus); outline-offset: 3px; }
.message-search-hit:focus-visible { outline: none; }
.message-text { overflow-wrap: anywhere; white-space: pre-wrap; margin: 0; line-height: 1.5; }
.exchange-note { display: grid; gap: 3px; margin: 6px 0 0; padding: 5px 7px; border-left: 2px solid #85a9ff; color: var(--link); font-size: .8rem; line-height: 1.35; overflow-wrap: anywhere; }
.exchange-note span { font-weight: 650; }
.product-card { display: grid; gap: 6px; min-width: min(200px, 100%); }
.product-label { color: var(--muted); font-size: .74rem; font-weight: 680; }
.product-card h3, .order-title { margin: 0; color: var(--navy); font-size: 1.05rem; line-height: 1.34; overflow-wrap: anywhere; }
.product-price { display: block; color: var(--link); font-weight: 740; font-size: .91rem; overflow-wrap: anywhere; }
.product-meta { color: var(--muted); font-size: .78rem; margin: 0; }
.product-card button { justify-self: start; margin-top: 3px; min-height: 40px; }
.message-photo { display: block; width: min(260px, 100%); padding: 0; margin: 2px 0 7px; overflow: hidden; border: 0; border-radius: 8px; background: var(--panel); }
.message-photo img { display: block; width: 100%; max-height: 320px; min-height: 55px; object-fit: contain; }
.message-meta { display: flex; align-items: baseline; justify-content: end; flex-wrap: wrap; gap: 4px 10px; margin-top: 5px; color: var(--muted); font-size: .76rem; }
.message-meta button { border: 0; padding: 4px 2px; color: var(--link); background: transparent; font-size: .81rem; }
.message-meta button:hover { text-decoration: underline; }
.message-meta .message-action { min-height: 26px; padding-inline: 3px; color: var(--link); font-size: .76rem; }
.message-meta .message-action:focus-visible { border-radius: 4px; outline-offset: 1px; }
.message-meta .message-action[aria-disabled="true"] { color: var(--muted); cursor: default; text-decoration: none; }
.is-blocked .message-reply { display: none; }
.message-original, .message-reply-quote {
  margin: 5px 0; padding: 5px 8px; border-inline-start: 2px solid var(--accent-line);
  background: var(--field); color: var(--muted); border-radius: 5px; font-size: .8rem;
  overflow-wrap: anywhere;
}
.message-original { margin-top: 4px; }
.message-original .message-text { line-height: 1.4; }
.message-reply-quote { margin-top: 0; }
.message-reply-quote-label, .draft-reply-copy strong { color: var(--link); font-size: .76rem; font-weight: 650; }
.message-reply-quote .message-text, #draft-reply-text {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden; overflow-wrap: anywhere; line-height: 1.35;
}
.message-meta .failed { color: var(--danger); }
.message-envelope { display: inline-flex; align-self: center; flex: none; width: 15px; height: 15px; margin-inline-start: -5px; }
.message-envelope svg {
  width: 100%; height: 100%; fill: none; stroke: currentColor;
  stroke-width: 1.45; stroke-linecap: round; stroke-linejoin: round;
}
.message-envelope[data-read="true"] { color: var(--link); }
.message-envelope[data-read="true"] .envelope-closed,
.message-envelope[data-read="false"] .envelope-open { display: none; }
.channel-post .message-content { width: min(100%, 570px); }
.channel-post .message-meta { justify-content: start; }
.delivery-feed-update .message-content, .delivery-feed-welcome .message-content {
  max-width: min(100%, 570px); padding: 11px 13px; border-radius: 12px;
}
.delivery-feed-welcome .message-content { border-color: var(--accent-line); background: var(--accent-surface); }
.delivery-feed-welcome .delivery-feed-title { margin-block-end: 5px; }
.delivery-feed-card { display: grid; gap: 8px; min-width: 0; }
.delivery-feed-heading { display: flex; justify-content: space-between; align-items: start; flex-wrap: wrap; gap: 5px 12px; }
.delivery-feed-stage { display: flex; align-items: center; gap: 7px; color: var(--link); font-size: .87rem; }
.delivery-feed-reference { color: var(--muted); font-size: .79rem; font-weight: 700; }
.delivery-feed-title { margin: 0; font-size: 1rem; line-height: 1.32; overflow-wrap: anywhere; }
.delivery-feed-seller, .delivery-feed-payment { margin: 0; color: var(--muted); font-size: .83rem; line-height: 1.4; overflow-wrap: anywhere; }
.delivery-feed-card .delivery-feed-cost { margin: 0; padding: 7px 9px; border-radius: 8px; background: var(--field); }
.delivery-feed-cost > div:last-child { border-bottom: 0; padding-bottom: 0; }
.delivery-feed-order-link { justify-self: start; max-width: 100%; min-height: 40px; white-space: normal; }
.delivery-support-message .message-content { min-width: 0; }
.delivery-support-author { display: block; margin-bottom: 5px; color: var(--link); font-size: .79rem; overflow-wrap: anywhere; }
.delivery-support-context {
  margin: 0 0 6px; padding: 4px 7px; border-inline-start: 2px solid var(--focus);
  color: var(--muted); font-size: .79rem; overflow-wrap: anywhere;
}
.delivery-support-controls { min-width: 0; }
.delivery-support-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.delivery-support-actions button { min-height: 34px; padding-inline: 9px; font-size: .79rem; white-space: normal; }
#delivery-action-error { margin-top: 4px; color: var(--danger); overflow-wrap: anywhere; }
.delivery-support-order { display: flex; align-items: center; gap: 8px; padding-inline: 4px; color: var(--muted); font-size: .8rem; }
.delivery-support-order > span { flex: none; }
.delivery-support-order select {
  flex: 1; min-width: 0; max-width: 100%; min-height: 34px; padding: 4px 7px;
  border: 1px solid var(--line); border-radius: 7px; background: var(--field); color: var(--navy); text-overflow: ellipsis;
}
.channel-message-actions { display: flex; flex-wrap: wrap; gap: 3px 7px; margin-top: 5px; }
.channel-message-actions button { min-height: 44px; padding-inline: 8px; white-space: normal; text-align: start; }
.channel-attachment { display: inline-flex; max-width: 100%; min-height: 44px; align-items: center; gap: 8px; margin-block: 3px; white-space: normal; text-align: start; overflow-wrap: anywhere; }
.channel-attachment .icon { flex-shrink: 0; }
.is-channel .peer-activity, .is-channel #compose-chat-actions { display: none; }
.chat-footer { grid-row: 4; padding: 4px 30px 13px; border-top: 1px solid var(--line); background: var(--surface); }
.chat-footer:has(.compose-entry[hidden]) { padding-block: 8px; }
.chat-footer:has(.compose-entry[hidden]) :is(.peer-activity, .footer-meta) { display: none; }
.peer-activity { width: min(100%, 880px); min-height: 20px; margin: 0 auto 3px; padding-inline: 4px; color: var(--muted); font-size: .84rem; line-height: 20px; }
.composer { width: min(100%, 880px); margin: 0 auto; padding: 7px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.composer:has(.compose-entry[hidden]) { padding: 0; border: 0; }
.composer:has(.compose-entry[hidden]) .attachment { display: none; }
.composer:focus-within { border-color: var(--focus); }
.draft-reply {
  display: flex; align-items: center; gap: 7px; margin: 0 1px 4px; padding: 4px 4px 4px 8px;
  border-inline-start: 2px solid var(--focus); border-radius: 6px; background: var(--field);
}
.draft-reply-copy { flex: 1; min-width: 0; color: var(--muted); font-size: .8rem; }
#draft-reply-text { margin: 1px 0 0; white-space: pre-wrap; }
.draft-reply .close-button { width: 34px; height: 34px; }
.draft-reply .close-button .icon { transform: scale(.82); }
.compose-row, .compose-entry { display: flex; align-items: end; gap: 8px; }
.compose-entry { flex: 1; min-width: 0; }
.compose-row textarea { display: block; flex: 1 1 auto; min-width: 0; resize: none; border: 0; outline: none; padding: 11px 4px 10px; min-height: 46px; max-height: 140px; background: transparent; color: var(--navy); font-size: 1rem; line-height: 1.45; }
.compose-row textarea:focus { outline: none; }
.compose-row textarea::placeholder { opacity: 1; color: var(--muted); }
.plain-button { display: inline-grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; border: 0; border-radius: 10px; background: var(--panel); color: var(--link); }
.plain-button:not(:disabled):hover { background: var(--hover); }
.emoji-button { padding: 0; background: transparent; }
#compose-more:enabled:is(:hover, :focus-visible, :active),
.composer:has(#compose-actions:popover-open) #compose-more { background: var(--accent-surface); --dot-wave: compose-dot-wave; }
#emoji:enabled:is(:hover, :focus-visible, :active),
.composer:has(#emoji-picker:popover-open) #emoji {
  background: var(--accent-surface);
  --smile-turn: rotate(-9deg) scale(1.08);
  --smile-grin: scale(1.22, 1.35);
  --smile-fill: currentColor;
}
.compose-actions, .emoji-picker { position: fixed; margin: 0; padding: 6px; border: 1px solid var(--line); border-radius: 12px; color: var(--navy); background: var(--surface); box-shadow: var(--shadow); }
.compose-actions { inset: auto auto 95px 10px; width: 260px; overflow: auto; overscroll-behavior: contain; }
.compose-action-group { display: grid; gap: 2px; }
.compose-action-group:not([hidden]) + .compose-action-group { margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--line); }
#compose-actions-status { margin: 4px 9px; color: var(--danger); font-size: .82rem; }
.compose-action { display: flex; align-items: center; gap: 11px; min-height: 44px; padding: 7px 11px; border: 0; border-radius: 8px; background: transparent; color: var(--navy); font-size: .91rem; text-align: start; }
.compose-action :is(.icon, .invoice-icon) { flex-shrink: 0; color: var(--link); }
.compose-action:not(:disabled):hover { background: var(--accent-surface); }
.compose-action:disabled { color: var(--muted); opacity: .6; }
.emoji-picker { inset: auto 20px 95px auto; }
.emoji-picker:popover-open { display: grid; grid-template-columns: repeat(5, 44px); }
.emoji-picker button { background: var(--surface); font-size: 1.32rem; }
.send { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 9px; min-height: 44px; border: 0; border-radius: 10px; padding: 0 14px; background: var(--blue); color: white; font-weight: 650; font-size: .9rem; }
.send:not(:disabled):hover { background: var(--blue-hover); }
#send:enabled:is(:hover, :focus-visible, :active) {
  background: var(--blue-hover);
  box-shadow: 0 3px 8px color-mix(in srgb, var(--blue) 28%, transparent);
}
.send:disabled { background: var(--disabled); color: var(--muted); }
.footer-meta { width: min(100%, 880px); margin: 9px auto 0; color: var(--muted); font-size: .76rem; text-align: right; }
.footer-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 3px 10px; }
.geo-credit { color: var(--muted); text-decoration: none; }
.geo-credit:hover { text-decoration: underline; }
.composer-error { width: min(100%, 880px); margin: 0 auto 8px; font-size: .87rem; color: var(--danger); }
.attachment { display: flex; align-items: center; gap: 10px; width: fit-content; max-width: 100%; padding: 5px; margin: 0 0 6px; border-radius: 11px; background: var(--panel); color: var(--link); }
.attachment img { object-fit: cover; border-radius: 7px; }
.attachment span:not(.icon) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; }
.attachment .plain-button { background: transparent; }

.dialog { width: min(470px, calc(100% - 28px)); border: 1px solid var(--line); border-radius: 17px; padding: 20px; background: var(--surface); color: var(--navy); box-shadow: var(--shadow); }
dialog::backdrop { background: var(--backdrop); }
@media (forced-colors: none) {
  :is(dialog, [popover], .invite-scroll, .settings-scroll, #contacts-list, .archived-contacts-list, dialog textarea) {
    scrollbar-width: thin;
    scrollbar-color: var(--window-scroll-thumb) transparent;
  }
  @supports selector(::-webkit-scrollbar) {
    :is(dialog, [popover], .invite-scroll, .settings-scroll, #contacts-list, .archived-contacts-list, dialog textarea) {
      scrollbar-width: auto;
      scrollbar-color: auto;

      &::-webkit-scrollbar { width: 11px; height: 11px; }
      &::-webkit-scrollbar-track, &::-webkit-scrollbar-corner { background: transparent; }
      &::-webkit-scrollbar-thumb {
        background: var(--window-scroll-thumb);
        border: 2px solid transparent;
        border-radius: 999px;
        background-clip: padding-box;
      }
      &::-webkit-scrollbar-thumb:hover, &::-webkit-scrollbar-thumb:active {
        background-color: var(--window-scroll-hover);
      }
    }
  }
}
.dialog-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dialog h2 { margin: 0; font-size: 1.22rem; letter-spacing: -.02em; }
.dialog p { color: var(--muted); margin: 6px 0 17px; line-height: 1.45; }
#add-contact-dialog { width: min(350px, calc(100% - 28px)); max-height: calc(100dvh - 28px); }
.add-contact-actions { display: grid; gap: 8px; margin-top: 14px; }
.add-contact-actions .compose-action { min-height: 48px; border: 1px solid var(--line); background: var(--field); font-weight: 650; }
.add-contact-actions [data-contact-count]:not([data-contact-count="0"]) { padding-inline-end: 37px; }
.add-contact-actions [data-contact-count]:not([data-contact-count="0"])::after { inset-block: 0; inset-inline-end: 11px; margin-block: auto; }
.dialog .copy-status { min-height: 1.3em; margin: 8px 0 0; font-size: .84rem; }
#invite-dialog[open] {
  display: grid; grid-template-rows: auto auto minmax(0, 1fr);
  width: min(500px, calc(100% - 24px)); height: min(600px, calc(var(--visible-height, 100dvh) - 24px));
  max-width: none; max-height: none; padding: 0; overflow: hidden;
}
.invite-heading {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0;
  padding: 12px 16px 8px 20px; background: var(--surface);
}
.invite-heading h2 { overflow-wrap: anywhere; }
.invite-heading .plain-button { background: var(--field); }
.invite-heading .plain-button:hover { background: var(--hover); }
.invite-nav-wrap { padding: 4px 16px 12px; border-bottom: 1px solid var(--line); }
.invite-nav, .invite-method {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px;
  padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
}
.invite-nav button, .invite-method button {
  min-width: 0; min-height: 40px; padding: 5px 4px; border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--muted); font-size: .87rem; font-weight: 680; overflow-wrap: anywhere;
}
.invite-nav button:hover, .invite-method button:hover { color: var(--navy); background: var(--hover); }
.invite-nav [aria-selected="true"], .invite-nav [aria-pressed="true"], .invite-method [aria-pressed="true"] {
  border-color: var(--accent-line); background: var(--surface); color: var(--link);
}
.invite-nav button:focus-visible, .invite-method button:focus-visible { outline-offset: -3px; }
.invite-scroll {
  min-height: 0; min-width: 0; overflow: auto; overscroll-behavior: contain; padding: 14px 16px 18px;
}
.invite-page { min-width: 0; }
#invite-dialog .invite-intro {
  display: flex; align-items: center; gap: 11px; margin: 0 0 12px; padding: 12px;
  border: 1px solid var(--accent-line); border-radius: 12px; background: var(--accent-surface); color: var(--navy); font-size: .88rem;
}
.invite-emblem {
  display: grid; width: 34px; height: 34px; flex: none; place-items: center;
  border: 1px solid var(--accent-line); border-radius: 10px; background: var(--surface); color: var(--link);
}
#invite-form { display: grid; gap: 13px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--field); }
#invite-reusable { min-height: 44px; white-space: normal; }
.invite-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.invite-fields label { display: grid; align-content: end; gap: 7px; min-width: 0; }
#invite-limit:disabled { background: var(--panel); }
.invite-unlimited { padding-inline: 2px; color: var(--muted); font-size: .87rem; font-weight: 650; }
.invite-unlimited:has(input:checked), #invite-dialog .invite-unlimited-warning { color: var(--danger); }
#invite-dialog .invite-unlimited-warning { margin: 0; padding-inline: 2px; font-size: .85rem; line-height: 1.45; }
#invite-generate, #copy-link { width: 100%; text-align: center; }
#active-invite, #invite-share-controls { display: grid; gap: 10px; min-width: 0; }
.invite-current {
  display: flex; align-items: flex-start; gap: 10px; padding: 11px;
  border: 1px solid var(--accent-line); border-radius: 12px; background: var(--accent-surface);
}
.invite-current-text { flex: 1; min-width: 0; }
.invite-current-top { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; }
.invite-current-top strong { display: block; overflow-wrap: anywhere; font-size: .90rem; }
#invite-dialog .invite-current p { margin: 3px 0 0; color: var(--muted); font-size: .80rem; }
.invite-state {
  align-self: start; max-width: 120px; padding: 3px 7px; border-radius: 7px; background: var(--panel);
  color: var(--muted); font-size: .73rem; font-weight: 650; text-align: center; overflow-wrap: anywhere;
}
.invite-state[data-state="active"] { background: color-mix(in srgb, var(--online) 13%, var(--surface)); color: var(--online); }
.invite-state[data-state="revoked"] { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); color: var(--danger); }
.invite-link-panel { display: grid; gap: 7px; min-width: 0; }
.invite-email-panel { padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--field); }
#invite-dialog .invite-email-panel p { margin: 0 0 9px; font-size: .84rem; }
#invite-email-form { display: grid; gap: 7px; }
#invite-email-send, #invite-email-draft { width: 100%; margin-top: 3px; }
.invite-share-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.invite-share-actions .quiet-button, .invite-revoke { min-height: 42px; white-space: normal; text-align: center; }
.invite-qr { display: grid; justify-items: center; gap: 9px; min-width: 0; }
.invite-qr-frame {
  display: grid; width: min(208px, 100%); aspect-ratio: 1; place-items: center;
  overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff;
}
.invite-qr-frame img { display: block; width: 100%; height: auto; }
.invite-qr-frame[aria-busy="true"]::before {
  width: 22px; height: 22px; border: 2px solid #c8d5f2; border-top-color: #204af0; border-radius: 50%; content: '';
  animation: invite-spin .7s linear infinite;
}
@keyframes invite-spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { .invite-qr-frame[aria-busy="true"]::before { animation: none; } }
.invite-revoke { justify-self: start; color: var(--danger); }
#invite-dialog .invite-empty { margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--field); font-size: .88rem; }
.invite-history-list { display: grid; gap: 6px; padding: 0; margin: 0; list-style: none; }
.invite-history-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; width: 100%; gap: 4px 8px;
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; color: var(--navy);
  background: var(--field); text-align: start; font-size: .86rem;
}
.invite-history-row small { grid-column: 1 / -1; color: var(--muted); overflow-wrap: anywhere; }
.invite-history-row:hover { border-color: var(--focus); background: var(--hover); }
.invite-history-row[aria-current="true"] { border-color: var(--focus); background: var(--accent-surface); }
.invite-history-row:focus-visible { outline-offset: -3px; }
.dialog .invite-note { margin: 7px 0 0; font-size: .84rem; }
.link-label { display: inline-block; margin-bottom: 6px; font-size: .86rem; font-weight: 650; }
.dialog input, .dialog select { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 10px; color: var(--navy); background: var(--field); font: inherit; }
:is(#invite-mode, #invite-limit) { min-height: 46px; padding-inline-start: 13px; border-radius: 11px; font-weight: 650; }
:is(#invite-mode, #invite-limit):hover { background: var(--hover); }
:is(#invite-mode, #invite-limit):focus-visible { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 3px; }
@supports (appearance: base-select) and selector(select::picker(select)) {
  .invite-select::after { display: none; }
  #invite-mode { appearance: base-select; align-items: center; padding-inline-end: 15px; }
  #invite-mode::picker-icon {
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--link);
    border-bottom: 2px solid var(--link);
    transform: translateY(-2px) rotate(45deg);
    content: '';
  }
  #invite-mode:open::picker-icon { transform: translateY(2px) rotate(225deg); }
  #invite-mode::picker(select) {
    appearance: base-select;
    position-area: block-end;
    position-try-fallbacks: flip-block;
    position-try-order: normal;
    justify-self: anchor-center;
    width: anchor-size(width);
    margin-block: 7px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--navy);
    box-shadow: var(--shadow);
  }
  #invite-mode option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 42px;
    padding: 7px 11px;
    border-radius: 8px;
  }
  #invite-mode option:checked { background: var(--accent-surface); color: var(--link); font-weight: 650; }
  #invite-mode option:not(:checked):hover { background: var(--hover); }
  #invite-mode option:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
  #invite-mode option::checkmark { order: 1; color: var(--link); }
}
#invite-url {
  width: 100%; min-width: 0; resize: none; border: 1px solid var(--line); border-radius: 9px;
  padding: 10px; color: var(--navy); background: var(--field); font: inherit; font-size: .85rem; line-height: 1.45;
  overflow-wrap: anywhere;
}
#contacts-dialog { max-height: calc(100dvh - 28px); overflow: auto; }
.contact-form, #contacts-list { margin-top: 14px; }
.contact-row { display: flex; align-items: center; gap: 8px; }
.contact-row input { min-width: 0; }
.contact-row button { flex-shrink: 0; }
.contact-inbox { margin-top: 13px; }
.contact-inbox h3 { margin: 0 0 7px; font-size: .94rem; }
#contact-requests { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.contact-request { display: grid; gap: 8px; padding: 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--field); overflow-wrap: anywhere; }
.contact-request-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.contact-request-actions button { min-height: 38px; }
[data-contact-count]:not([data-contact-count="0"])::after { content: attr(data-contact-count); display: inline-grid; position: absolute; inset-block-start: -4px; inset-inline-end: -5px; place-items: center; min-width: 17px; height: 17px; padding-inline: 3px; border-radius: 20px; background: var(--blue); color: white; font-size: .67rem; }
[data-contact-count] { position: relative; }
#contacts-list, .archived-contacts-list { display: grid; gap: 4px; max-height: min(44dvh, 380px); overflow: auto; overscroll-behavior: contain; }
.contact-chat-row { display: flex; align-items: center; gap: 6px; }
.contact-chat-row .contact-link { flex: 1; min-width: 0; }
.contact-archive-action { flex: none; min-height: 37px; padding-inline: 8px; font-size: .78rem; }
.contacts-archive { margin-top: 11px; padding: 0 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--field); }
.contacts-archive summary { min-height: 44px; padding: 10px 5px; cursor: pointer; color: var(--link); font-size: .9rem; font-weight: 650; }
.contacts-archive[open] > :last-child { margin-bottom: 7px; }
.contacts-archive p { margin-inline: 5px; font-size: .86rem; }
.archive-unread { display: inline-grid; min-width: 18px; min-height: 18px; margin-inline-start: 8px; padding-inline: 4px; place-items: center; border-radius: 16px; background: var(--blue); color: #fff; font-size: .69rem; }
.contact-link { display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--navy); }
.contact-link:hover, .contact-link[aria-current] { background: var(--hover); }
.contact-link.has-unread { grid-template-columns: 32px minmax(0, 1fr) 8px; background: var(--accent-surface); }
.contact-unread { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.contact-link:focus-visible { outline-offset: -3px; }
.contact-avatar { display: grid; place-items: center; width: 32px; height: 32px; overflow: hidden; border-radius: 9px; background: var(--accent-surface); color: var(--link); font-size: .81rem; font-weight: 700; }
.contact-summary { display: grid; min-width: 0; gap: 3px; }
.contact-summary > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-name { font-weight: 650; }
.contact-link small { color: var(--muted); }
.exchange-summary { display: grid; gap: 4px; padding: 10px 12px; margin: 8px 0 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--hover); overflow-wrap: anywhere; }
.exchange-summary strong { color: var(--link); }
.exchange-summary small { color: var(--muted); }
#exchange-form { display: grid; gap: 10px; }
.exchange-fields { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
#exchange-form label { display: grid; gap: 5px; min-width: 0; font-size: .84rem; font-weight: 650; }
#exchange-form option { font-weight: 400; }
#exchange-form .dialog-actions { margin-top: 3px; }
.dialog .exchange-owner, .dialog .exchange-hint { font-size: .84rem; }
.commerce-dialog { width: min(510px, calc(100% - 28px)); }
.operator-payment-filters, #operator-payment-content { margin-top: 13px; }
.operator-payment-filters { display: flex; flex-wrap: wrap; gap: 7px; }
.operator-payment-filters [aria-pressed="true"] { border-color: var(--focus); background: var(--accent-surface); }
.operator-payment-filters button { max-width: 100%; text-align: start; white-space: normal; }
.operator-payment-filters button > span { min-width: 0; overflow-wrap: anywhere; }
.delivery-icon { width: 18px; height: 18px; flex: 0 0 18px; vertical-align: middle; }
.shipment-list-stage { display: flex; align-items: center; gap: 6px; }
.shipment-list-stage svg { width: 15px; height: 15px; flex-basis: 15px; }
.shipment-route { display: grid; gap: 7px; padding: 11px 12px; border: 1px solid var(--accent-line); border-radius: 12px; background: var(--accent-surface); }
.shipment-current { display: flex; align-items: center; gap: 10px; min-width: 0; }
.shipment-current > .delivery-icon { width: 23px; height: 23px; flex-basis: 23px; color: var(--link); }
.shipment-current div { display: grid; gap: 2px; overflow-wrap: anywhere; }
.shipment-current small { color: var(--muted); }
.shipment-route-details summary, #operator-payment-content .shipment-route-details summary {
  margin: 0; padding-block: 5px; color: var(--link); cursor: pointer; font-size: .86rem;
}
.shipment-route-details ol { list-style: none; margin: 4px 0 1px; padding: 0; }
.shipment-route-details li { display: flex; gap: 9px; align-items: center; padding: 6px 4px; color: var(--muted); font-size: .87rem; }
.shipment-route-details li.is-past { color: var(--navy); }
.shipment-route-details li.is-current { border-radius: 7px; background: var(--surface); color: var(--link); font-weight: 700; }
.shipment-route-details li:has(.shipment-check) { padding: 0; }
.shipment-check {
  display: flex; flex: 1; min-width: 0; min-height: 36px; align-items: center; gap: 9px;
  padding: 5px 7px; border-radius: 7px; overflow-wrap: anywhere;
}
.dialog .shipment-check input {
  flex: none; width: 17px; height: 17px; padding: 0; margin: 0; accent-color: var(--online);
}
.shipment-check:has(input:enabled) { background: var(--surface); color: var(--link); font-weight: 700; cursor: pointer; }
.shipment-check:has(input:enabled):hover { background: var(--hover); }
@media (max-width: 540px) {
  .operator-payment-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .operator-payment-filters button { justify-content: start; min-width: 0; padding: 6px 9px; }
}
.operator-payment-list, #operator-payment-content { display: grid; gap: 9px; }
.operator-template-editor, .operator-template-list { display: grid; gap: 10px; }
.operator-template-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px; border-radius: 10px; background: var(--field); }
.operator-template-row > div { display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.operator-template-row small { color: var(--muted); }
#operator-payment-content summary { margin-block: 6px 10px; color: var(--link); cursor: pointer; }
.order-detail > a.quiet-button { white-space: normal; overflow-wrap: anywhere; }
.operator-payment-row { width: 100%; text-align: start; border: 0; border-radius: 10px; padding: 0; background: transparent; color: inherit; }
.operator-payment-row:hover { outline: 1px solid var(--focus); }
.operator-payment-summary { display: grid; gap: 6px; min-width: 0; overflow-wrap: anywhere; padding: 12px; border-radius: 10px; background: var(--field); }
.operator-payment-summary small { color: var(--muted); }
.order-fulfillment { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; overflow-wrap: anywhere; }
.order-fulfillment p, .order-fulfillment dl { margin: 0; }
.operator-transfer-review { gap: 12px; }
.operator-transfer-review .order-lines dd { min-width: 0; }
.order-fulfillment summary { cursor: pointer; }
.referral-list { display: grid; gap: 8px; padding: 0; margin: 0; list-style: none; }
.referral-list li, .referral-contact-card { display: grid; gap: 6px; padding: 10px; border-radius: 10px; background: var(--field); overflow-wrap: anywhere; }
.referral-list small, .referral-contact-card small { color: var(--muted); }
.referral-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.referral-list li > button, .referral-contact-card a { justify-self: start; }
#referral-chain-content { display: grid; gap: 8px; }
.order-fulfillment details .commerce-form { margin-top: 10px; }
.operator-payout-qr { width: min(100%, 260px); height: auto; justify-self: center; background: #fff; border-radius: 8px; }
.transfer-details { padding: 11px; border: 1px solid var(--accent-line); border-radius: 11px; background: var(--field); overflow-wrap: anywhere; }
.commerce-actions:has(> :not([hidden])) { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 7px 0 12px; }
.commerce-actions > * { max-width: 100%; white-space: normal; }
.commerce-form { display: grid; gap: 10px; }
.commerce-form label, .product-photo-field, .supplier-qr-picker { display: grid; gap: 5px; min-width: 0; font-size: .87rem; font-weight: 650; }
.commerce-form .send { justify-self: flex-start; margin-top: 3px; }
#invoice-form textarea, #channel-edit-text { width: 100%; resize: vertical; border: 1px solid var(--line); border-radius: 9px; padding: 10px; color: var(--navy); background: var(--field); font: inherit; font-weight: 400; }
#channel-remove-copy { margin: 0; }
.invoice-amount-group { display: grid; gap: 5px; }
.invoice-amount-field {
  display: flex; align-items: center; min-width: 0; border: 1px solid var(--line);
  border-radius: 10px; background: var(--field);
}
.invoice-amount-field:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
#invoice-form #invoice-amount {
  flex: 1; min-width: 0; width: auto; border: 0; background: transparent; box-shadow: none; outline: none;
}
.invoice-currency {
  flex: none; margin-inline-end: 9px; padding: 5px 8px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--surface); color: var(--muted); font-size: .82rem; font-weight: 700;
}
.invoice-icon { position: relative; width: 15px; height: 20px; border: 1.6px solid currentColor; border-radius: 3px; }
.invoice-icon::before { position: absolute; top: 5px; inset-inline: 3px; height: 5px; border-block: 1.4px solid currentColor; content: ""; }
.message.invoice-message .message-content { width: min(342px, calc(100% - 41px)); max-width: none; padding: 0; border: 0; background: transparent; }
.invoice-message .message-meta { padding-inline: 4px; }
.invoice-card {
  display: grid; gap: 10px; padding: 13px; border: 1px solid var(--accent-line);
  border-radius: 15px; background: var(--surface); box-shadow: 0 3px 12px #203e7110;
}
.invoice-card-header { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.invoice-card-icon {
  display: grid; width: 34px; height: 34px; place-items: center;
  border-radius: 9px; background: var(--accent-surface); color: var(--link);
}
.invoice-card-label { color: var(--muted); font-size: .84rem; font-weight: 700; }
.invoice-state {
  max-width: 125px; padding: 4px 7px; border-radius: 7px; background: var(--panel); color: var(--muted);
  font-size: .73rem; font-weight: 700; text-align: center; overflow-wrap: anywhere;
}
.invoice-state:is([data-state="requested"], [data-state="reported"]) { background: var(--warm-surface); color: var(--warm-text); }
.invoice-state[data-state="ready"] { background: var(--accent-surface); color: var(--link); }
.invoice-state[data-state="confirmed"] { background: color-mix(in srgb, var(--online) 14%, var(--surface)); color: var(--online); }
.invoice-card-title { margin: 0; font-size: 1rem; line-height: 1.3; overflow-wrap: anywhere; }
.invoice-card-description, .invoice-quote-note { margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.4; overflow-wrap: anywhere; white-space: pre-wrap; }
.invoice-translation-note { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.35; }
.invoice-card-totals { display: grid; gap: 3px; padding: 10px; border-radius: 9px; background: var(--field); }
.invoice-total-label { color: var(--muted); font-size: .76rem; }
.invoice-card-total { color: var(--navy); font-size: 1.2rem; font-weight: 750; overflow-wrap: anywhere; }
.invoice-action { width: 100%; min-height: 44px; white-space: normal; text-align: center; }
.is-blocked .invoice-action { display: none; }
.invoice-action-summary { display: grid; gap: 5px; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--field); overflow-wrap: anywhere; }
.invoice-action-summary strong { color: var(--link); font-size: 1.15rem; }
.product-photo-field .quiet-button { justify-self: start; }
:is(.product-photo-field, .supplier-qr-picker) output { color: var(--muted); overflow-wrap: anywhere; }
.orders-list { display: grid; gap: 8px; }
.orders-list button { width: 100%; padding: 10px; display: grid; gap: 4px; justify-items: start; text-align: start; border: 1px solid var(--line); border-radius: 10px; background: var(--field); color: var(--navy); }
.orders-list button:hover { background: var(--hover); }
.orders-list button span { color: var(--muted); font-size: .83rem; }
.order-status { display: inline-block; padding: 5px 9px; border-radius: 7px; background: var(--hover); color: var(--link); font-size: .83rem; font-weight: 700; }
.order-lines { display: grid; gap: 6px; margin: 10px 0; }
.order-lines div { display: flex; justify-content: space-between; align-items: baseline; gap: 9px; border-bottom: 1px solid var(--line); padding-bottom: 5px; }
.order-lines dt { color: var(--muted); font-size: .84rem; }
.order-lines dd { font-size: .87rem; font-weight: 620; margin: 0; text-align: end; overflow-wrap: anywhere; }
.order-detail .commerce-form { margin-top: 12px; }
.order-detail { display: grid; gap: 14px; }
.order-payment-box, .order-shipping-box { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.order-payment-box { background: var(--accent-surface); border-color: var(--accent-line); }
.order-payment-box.is-paid { background: var(--paid-surface); border-color: var(--paid-line); }
.order-payment-box.is-paid .order-status, .order-status.is-paid { background: var(--paid-badge); color: var(--paid-ink); }
.payment-celebration {
  position: sticky; inset-block-start: 0; z-index: 3; height: 0; pointer-events: none;
}
.payment-celebration-shower {
  position: absolute; inset-inline: 0; inset-block-start: -14px;
  height: min(280px, 48dvh); overflow: hidden;
}
.payment-celebration-bill {
  position: absolute; inset-block-start: -26px; width: 25px; height: 14px; border: 1px solid #399367;
  border-radius: 3px; background: #a3e0b6; color: #27764d;
  opacity: 0; animation: payment-bill-fall 1.35s cubic-bezier(.2,.55,.45,1) both;
}
.payment-celebration-bill:nth-child(3n) { background: #ffdc86; border-color: #c9972d; color: #976b19; }
.payment-celebration-bill::after {
  content: ''; position: absolute; inset: 3px 8px; border: 1px solid currentColor; border-radius: 50%;
}
@keyframes payment-bill-fall {
  from { opacity: 0; transform: translateY(0) rotate(var(--bill-angle)); }
  16%, 55% { opacity: .94; }
  to { opacity: 0; transform: translate(var(--bill-drift), 275px) rotate(calc(var(--bill-angle) + 100deg)); }
}
@media (prefers-reduced-motion: reduce) { .payment-celebration { display: none; } }
.order-payment-heading { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) fit-content(48%); align-items: start; gap: 12px; }
.order-payment-heading .order-status { max-width: 100%; overflow-wrap: anywhere; }
.order-price { min-width: 0; display: grid; gap: 5px; overflow-wrap: anywhere; }
.payment-review-status { display: flex; align-items: center; gap: 4px; color: var(--link); font-size: .83rem; font-weight: 700; }
.payment-review-info {
  position: relative; flex: none; display: grid; place-items: center; width: 38px; height: 38px;
  padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; font: inherit;
}
.payment-review-info::before {
  content: ''; position: absolute; inset: 5px; border: 2px solid var(--accent-line);
  border-block-start-color: currentColor; border-radius: 50%; animation: payment-review-spin 1.3s linear infinite;
}
.payment-review-info:focus-visible, .payment-review-info[aria-expanded="true"] { background: var(--surface); }
.dialog .payment-review-tip {
  display: none; position: absolute; z-index: 1; inset-block-start: 100%; inset-inline-end: 0;
  width: min(100%, 260px); margin: 0; padding: 10px 12px; border: 1px solid var(--accent-line);
  border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); font-weight: 500;
}
.payment-review-info:is(:focus-visible, [aria-expanded="true"]) + .payment-review-tip { display: block; }
@media (hover: hover) {
  .payment-review-info:hover + .payment-review-tip, .payment-review-tip:hover { display: block; }
}
@keyframes payment-review-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .payment-review-info::before { animation: none; } }
.order-payment-box h4, .order-shipping-box h4, .order-payment-box .order-lines, .order-shipping-box .order-lines { margin: 0; }
.order-payment-box .send, .order-payment-box > .quiet-button { justify-self: start; }
.order-amount { font-size: 1.55rem; line-height: 1.15; overflow-wrap: anywhere; }
.order-section-note { margin: 0; color: var(--muted); font-size: .85rem; line-height: 1.5; }
.shipping-weight-estimate {
  padding: 8px 10px; border: 1px solid var(--accent-line); border-radius: 8px;
  background: var(--accent-surface); color: var(--navy); font-size: .85rem; font-weight: 650; overflow-wrap: anywhere;
}
.commerce-form #product-weight-hint { font-weight: 400; }
.order-inline-link { color: var(--link); font-weight: 650; text-decoration: underline; text-underline-offset: 2px; }
.order-inline-link:hover { color: var(--navy); }
.shipping-quote-shell { width: min(100% - 28px, 560px); margin: 0 auto; padding: 16px 0 32px; }
.shipping-quote-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.shipping-quote-top img { display: block; }
.shipping-quote-panel { padding: clamp(16px, 4vw, 30px); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.shipping-quote-panel h1 { margin: 0; font-size: clamp(1.65rem, 5vw, 2.25rem); line-height: 1.1; }
.shipping-quote-panel > p { margin: 10px 0 20px; color: var(--muted); line-height: 1.5; }
.shipping-quote-panel form { gap: 14px; }
.shipping-dimensions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; min-width: 0; border: 0; padding: 0; margin: 0; }
.shipping-dimensions legend { padding: 0; margin: 0 0 9px; font-weight: 700; }
.shipping-quote-panel input, .shipping-quote-panel select { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 9px; padding: 10px; background: var(--field); color: var(--navy); font: inherit; font-size: 1rem; }
.shipping-quote-panel .select-wrap select { padding-inline-end: 42px; }
.shipping-quote-panel .send { width: 100%; }
.shipping-quote-error { color: var(--danger); margin: 0; }
.shipping-quote-success { background: var(--accent-surface); border: 1px solid var(--accent-line); border-radius: 12px; padding: 14px; }
.shipping-quote-success p { margin: 5px 0 0; }
.order-links { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.order-links > * { white-space: normal; }
.order-history { margin-top: 11px; color: var(--muted); font-size: .82rem; }
.order-history summary { cursor: pointer; }
.order-history ol { padding-inline-start: 20px; }
.profile-avatar-form, .profile-password-form { display: grid; gap: 7px; padding-bottom: 10px; }
.profile-password-form label { display: grid; gap: 4px; font-size: .89rem; font-weight: 650; }
.profile-password-form small { color: var(--muted); }
.profile-avatar-form > button, .profile-password-form > button { justify-self: start; }
.avatar-editor { display: flex; gap: 12px; align-items: flex-start; }
.avatar-editor .avatar { width: 59px; height: 59px; font-size: 1rem; }
.avatar-editor-controls { min-width: 0; display: grid; gap: 5px; }
.avatar-editor label { display: grid; gap: 5px; font-size: .9rem; font-weight: 650; }
.avatar-picker { position: relative; justify-self: start; }
.avatar-editor .avatar-picker input { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; opacity: 0; cursor: pointer; }
.avatar-picker > span { display: inline-flex; align-items: center; min-height: 39px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); color: var(--link); font-size: .83rem; }
.avatar-picker:hover > span { background: var(--hover); }
.avatar-picker input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.avatar-editor .avatar-remove { justify-self: start; padding: 4px 8px; min-height: 32px; margin: 0; font-size: .82rem; }
.avatar-editor .avatar-error { color: var(--danger); }
#settings-dialog[open] {
  display: grid; grid-template-rows: auto minmax(0, 1fr);
  width: min(460px, calc(100% - 24px)); height: min(525px, calc(var(--visible-height, 100dvh) - 24px));
  max-height: none; padding: 0; overflow: hidden;
}
.settings-top { display: flex; align-items: center; gap: 9px; padding: 11px 15px 11px 19px; border-bottom: 1px solid var(--line); }
.settings-top h2 { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.settings-top h2:focus-visible { outline: none; }
.settings-top .plain-button { width: 44px; height: 44px; background: var(--field); }
.settings-top .plain-button:hover { background: var(--hover); }
.settings-back-icon { position: relative; width: 16px; height: 2px; border-radius: 2px; background: currentColor; }
.settings-back-icon::before {
  position: absolute; inset: -4px auto auto 0; width: 10px; height: 10px;
  border: solid currentColor; border-width: 0 0 2px 2px; transform: rotate(45deg); content: '';
}
.settings-scroll { min-width: 0; min-height: 0; overflow: auto; padding: 16px 18px 20px; overscroll-behavior: contain; }
#settings-menu { display: grid; gap: 12px; }
.settings-menu-list { display: grid; border: 1px solid var(--line); border-radius: 13px; background: var(--field); }
.settings-profile-link, .settings-menu-link { display: flex; align-items: center; gap: 12px; min-width: 0; width: 100%; color: var(--navy); text-align: start; }
.settings-profile-link {
  min-height: 74px; padding: 12px; border: 1px solid var(--accent-line);
  border-radius: 13px; background: var(--accent-surface);
}
.settings-profile-link:hover { border-color: var(--focus); }
.settings-profile-link .avatar {
  width: 47px; height: 47px; border: 1px solid var(--accent-line); border-radius: 14px;
  background: var(--surface); color: var(--link); font-size: .99rem;
}
.avatar.avatar-tinted, .contact-avatar.avatar-tinted {
  background: hsl(var(--avatar-hue) 67% 87%); color: hsl(var(--avatar-hue) 54% 26%);
}
:root[data-theme="dark"] :is(.avatar, .contact-avatar).avatar-tinted {
  background: hsl(var(--avatar-hue) 37% 26%); color: hsl(var(--avatar-hue) 78% 87%);
}
.settings-menu-link { min-height: 55px; padding: 9px 12px; border: 0; background: transparent; font-size: .92rem; font-weight: 650; }
.settings-menu-link:first-child { border-radius: 12px 12px 0 0; }
.settings-menu-link:last-child { border-radius: 0 0 12px 12px; }
.settings-menu-link + .settings-menu-link { border-top: 1px solid var(--line); }
.settings-menu-link:hover { background: var(--hover); }
.settings-menu-link:focus-visible { outline-offset: -3px; }
.settings-profile-link::after, .settings-menu-link::after {
  width: 8px; height: 8px; flex: none; margin-inline: 2px 4px; border: solid var(--muted);
  border-width: 1.6px 1.6px 0 0; transform: rotate(45deg); content: '';
}
.settings-menu-text { display: grid; flex: 1; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.settings-menu-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-menu-text small, .settings-profile-caption { color: var(--muted); font-size: .78rem; font-weight: 500; }
.settings-profile-caption { display: flex; flex-wrap: wrap; gap: 3px 8px; }
.settings-menu-icon { display: grid; width: 32px; height: 32px; flex: none; place-items: center; border-radius: 8px; background: var(--accent-surface); color: var(--link); }
.settings-rate-icon { font-size: 1.25rem; }
.settings-bell, .settings-globe, .settings-lock { position: relative; display: block; border: 1.5px solid currentColor; }
.settings-bell { width: 13px; height: 13px; margin-bottom: 2px; border-radius: 7px 7px 3px 3px; }
.settings-bell::after { position: absolute; inset: auto 3px -4px; height: 1.5px; border-radius: 1px; background: currentColor; content: ''; }
.settings-globe { width: 16px; height: 16px; border-radius: 50%; }
.settings-globe::before { position: absolute; inset: -1px 3px; border-inline: 1px solid currentColor; border-radius: 50%; content: ''; }
.settings-globe::after { position: absolute; inset: 50% 0 auto; border-top: 1px solid currentColor; content: ''; }
.settings-lock { width: 14px; height: 11px; margin-top: 5px; border-radius: 3px; }
.settings-lock::before { position: absolute; inset: -7px 2px auto; height: 7px; border: 1.5px solid currentColor; border-bottom: 0; border-radius: 5px 5px 0 0; content: ''; }
.settings-panel { display: grid; gap: 12px; align-content: start; }
.settings-panel > :is(form, .notification-settings) { margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--field); }
.settings-panel .settings-status:empty { display: none; }
.settings-panel .account-actions { display: grid; }
.settings-panel .account-actions button { justify-content: flex-start; white-space: normal; text-align: start; }
.settings-panel #logout { color: var(--danger); }
.access-settings > div, .access-form, .access-history { display: grid; gap: 10px; }
.access-settings .invite-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.access-form, .access-history-item { padding: 12px; border: 1px solid var(--line); border-radius: 11px; }
.access-form > label:not(.setting) { display: grid; min-width: 0; gap: 5px; }
.access-form select, .access-form input:not([type="checkbox"]), .access-share input { width: 100%; min-width: 0; }
.access-history { list-style: none; padding: 0; margin: 0; }
.access-history-item { display: grid; gap: 7px; min-width: 0; overflow-wrap: anywhere; }
.access-history-item > button { justify-self: start; text-align: start; white-space: normal; }
.access-share { display: flex; flex-wrap: wrap; gap: 6px; }
.access-share input { flex: 1 1 100%; }
.access-share a { text-decoration: none; }
.theme-icon { width: 17px; height: 17px; border: 1.5px solid currentColor; border-radius: 50%; background: linear-gradient(90deg, currentColor 50%, transparent 50%); transform: rotate(-26deg); }
.theme-setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 50px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--field); color: var(--navy); font-size: .91rem; font-weight: 650; text-align: start; }
.theme-setting:hover { background: var(--hover); }
.theme-track { display: flex; align-items: center; flex: 0 0 34px; height: 20px; padding: 3px; border-radius: 12px; background: var(--muted); }
.theme-track::before { width: 14px; height: 14px; border-radius: 50%; background: #fff; content: ''; }
.theme-setting[aria-checked="true"] .theme-track { justify-content: flex-end; background: var(--blue); }
.nickname-row { display: flex; gap: 8px; }
.nickname-row input, .nickname-row .select-wrap { min-width: 0; flex: 1 1 auto; }
.dialog .select-wrap select { padding-inline-end: 42px; }
.language-form { margin-bottom: 7px; }
.notification-settings { border-top: 1px solid var(--line); padding-top: 12px; }
.account-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.notification-settings h3 { margin: 0 0 5px; font-size: .96rem; }
#external-alert-settings { display: grid; gap: 10px; }
#external-alert-settings h3 { margin: 0; }
.external-alert-card { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--field); }
.external-alert-card h4 { margin: 0; font-size: 1rem; }
.external-alert-card p { margin: 0; font-size: .83rem; line-height: 1.45; overflow-wrap: anywhere; }
.external-alert-card p:empty { display: none; }
.external-alert-guide { color: var(--muted); }
.external-alert-status { font-weight: 600; }
.external-alert-card input { min-width: 0; }
.external-alert-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.external-alert-actions button { display: inline-flex; align-items: center; min-height: 44px; }
.portal-alert-result { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.setting { position: relative; display: flex; align-items: center; min-height: 44px; gap: 12px; cursor: pointer; }
.setting input[role="switch"] { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; overflow: hidden; clip-path: inset(50%); }
.notification-switch {
  position: relative;
  flex: 0 0 42px;
  height: 24px;
  margin-inline-start: auto;
  border: 1px solid color-mix(in srgb, var(--muted) 43%, var(--line));
  border-radius: 24px;
  background: color-mix(in srgb, var(--muted) 27%, var(--field));
  transition: background-color 160ms ease, border-color 160ms ease;
}
.notification-switch::before {
  position: absolute;
  inset-block-start: 2px;
  inset-inline-start: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px #0003;
  transition: inset-inline-start 160ms ease;
  content: '';
}
.setting input:checked + .notification-switch { border-color: var(--blue); background: var(--blue); }
.setting input:checked + .notification-switch::before { inset-inline-start: calc(100% - 20px); }
.setting input:focus-visible + .notification-switch { outline: 2px solid var(--focus); outline-offset: 3px; }
.setting input:disabled + .notification-switch { opacity: .55; }
.setting input[data-permission-pending] + .notification-switch {
  border-color: var(--accent-line); background: var(--accent-surface); color: var(--link); opacity: 1;
}
.setting input[data-permission-pending] + .notification-switch::after {
  position: absolute; inset-block-start: 5px; inset-inline-start: 5px; width: 12px; height: 12px; box-sizing: border-box;
  border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%; content: '';
  animation: notification-permission-spin .8s linear infinite;
}
@keyframes notification-permission-spin { to { transform: rotate(1turn); } }
.setting:has(input:disabled) { cursor: default; }
@media (prefers-reduced-motion: reduce) {
  .notification-switch, .notification-switch::before { transition: none; }
  .setting input[data-permission-pending] + .notification-switch::after { animation: none; }
}
@media (forced-colors: active) {
  .notification-switch { forced-color-adjust: none; border-color: ButtonText; background: ButtonFace; }
  .notification-switch::before { background: ButtonText; }
  .setting input:checked + .notification-switch { border-color: Highlight; background: Highlight; }
  .setting input:checked + .notification-switch::before { background: HighlightText; }
  .setting input:focus-visible + .notification-switch { outline-color: Highlight; }
  .setting input[data-permission-pending] + .notification-switch { border-color: ButtonText; background: ButtonFace; color: ButtonFace; }
}
.dialog .settings-status { margin: 4px 0 7px; min-height: 1.3em; font-size: .83rem; }
.dialog-actions { display: flex; flex-wrap: wrap-reverse; gap: 8px; justify-content: flex-end; margin-top: 13px; }
.photo-dialog { max-width: 95vw; max-height: 93dvh; border: 0; padding: 9px; border-radius: 13px; background: #16203a; }
.photo-dialog img { display: block; max-width: 100%; max-height: 86dvh; margin: auto; object-fit: contain; }
.photo-dialog .close-button { position: absolute; top: 12px; right: 12px; }

.icon { position: relative; display: inline-block; width: 18px; height: 18px; flex: 0 0 auto; }
.icon-chat { width: 16px; height: 12px; border: 1.7px solid currentColor; border-radius: 5px; }
.icon-chat::after { position: absolute; left: 2px; bottom: -4px; width: 5px; height: 6px; border-left: 1.7px solid currentColor; transform: skewY(-36deg); background: var(--surface); content: ""; }
.icon-person-add { width: 22px; }
.icon-person-add::before, .icon-person-add::after { position: absolute; border: 1.5px solid currentColor; content: ''; }
.icon-person-add::before { inset: 0 auto auto 4px; width: 7px; height: 7px; border-radius: 50%; }
.icon-person-add::after { inset: 10px auto 1px 1px; width: 13px; border-radius: 7px 7px 2px 2px; }
.icon-person-add span { position: absolute; inset: 6px 0 auto auto; width: 7px; height: 7px; background: linear-gradient(currentColor, currentColor) center / 7px 1.5px no-repeat, linear-gradient(currentColor, currentColor) center / 1.5px 7px no-repeat; }
.icon-contacts { width: 16px; height: 14px; border: 1.5px solid currentColor; border-radius: 3px; }
.icon-contacts::before { position: absolute; inset: 3px 3px; border-block: 1.5px solid currentColor; content: ''; }
.icon-link { transform: rotate(-43deg); }
.icon-link::before, .icon-link::after { position: absolute; top: 5px; width: 11px; height: 8px; border: 1.6px solid currentColor; border-radius: 7px; content: ""; }
.icon-link::before { left: 0; border-right-color: transparent; }
.icon-link::after { right: 0; border-left-color: transparent; }
.icon-paperclip { width: 11px; height: 21px; border: 1.8px solid currentColor; border-radius: 7px 7px 7px 7px; border-top-color: transparent; transform: rotate(38deg); }
.icon-paperclip::after { position: absolute; top: 0; right: 1.25px; width: 4.5px; height: 14px; border: 1.4px solid currentColor; border-radius: 5px 5px 4px 4px; border-top-color: transparent; content: ""; }
.icon-send { background: currentColor; clip-path: polygon(1% 36%, 100% 0, 71% 98%, 43% 64%, 77% 25%, 33% 56%); }
.icon-more { display: inline-flex; gap: 2px; }
.icon-more > span { width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.icon-menu { width: 18px; height: 2px; border-radius: 2px; background: currentColor; box-shadow: 0 -5px currentColor, 0 5px currentColor; }
.icon-block { width: 17px; height: 17px; border: 1.5px solid currentColor; border-radius: 50%; }
.icon-block::after { position: absolute; inset: 6px 0 auto; border-top: 1.5px solid currentColor; transform: rotate(-45deg); content: ''; }
.icon-smile { width: 21px; height: 21px; border: 1.5px solid currentColor; border-radius: 50%; }
.icon-smile::before { position: absolute; top: 5px; left: 5px; width: 2px; height: 2px; border-radius: 50%; background: currentColor; box-shadow: 6px 0 currentColor; content: ''; }
.icon-smile::after { position: absolute; inset: auto 4px 3px; height: 4px; border-bottom: 1.5px solid currentColor; border-radius: 0 0 50% 50%; background: var(--smile-fill, transparent); content: ''; }
@keyframes compose-dot-wave {
  0%, 55%, 100% { transform: translateY(0); }
  28% { transform: translateY(-4px); }
}
@media (prefers-reduced-motion: no-preference) {
  .icon-more > span { animation: var(--dot-wave, none) 690ms ease-in-out 2; }
  .icon-more > span:nth-child(2) { animation-delay: 90ms; }
  .icon-more > span:nth-child(3) { animation-delay: 180ms; }
  .icon-smile { transform: var(--smile-turn, none); transition: transform 180ms ease-out; }
  .icon-smile::after { transform: var(--smile-grin, none); transition: transform 180ms ease-out, background-color 180ms ease-out; }
  #send { transition: background-color 150ms ease-out, box-shadow 150ms ease-out, transform 130ms ease-out; }
  #send .icon-send { transition: transform 180ms ease-out; }
  #send:enabled:is(:hover, :focus-visible) .icon-send { transform: translate(2px, -2px) rotate(-8deg); }
  #send:enabled:active { transform: scale(.95); }
  #send:enabled:active .icon-send { transform: translate(3px, -3px) rotate(-8deg); }
}
.icon-close::before, .icon-close::after { position: absolute; left: 8px; top: 0; width: 2px; height: 18px; border-radius: 3px; background: currentColor; transform: rotate(45deg); content: ""; }
.icon-close::after { transform: rotate(-45deg); }

@media (max-width: 920px) {
  .workspace { grid-template-columns: 212px minmax(0, 1fr); width: calc(100% - 40px); height: calc(100dvh - 40px); margin: 20px auto; }
  .sidebar { padding-inline: 13px; }
  .chat-header, .statusbar, .chat-footer { padding-inline: 20px; }
}

@media (max-width: 700px), (max-height: 520px) {
  .workspace { display: block; width: 100%; height: var(--visible-height, 100dvh); min-height: 0; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  .sidebar {
    position: fixed; z-index: 3; inset: 0 auto 0 0; width: min(330px, calc(100% - 46px)); height: var(--visible-height, 100dvh);
    padding: calc(14px + env(safe-area-inset-top)) 14px calc(12px + env(safe-area-inset-bottom));
    visibility: hidden; transform: translateX(-100%); transition: transform 220ms ease, visibility 220ms;
  }
  .sidebar-backdrop { position: fixed; z-index: 2; inset: 0; display: block; visibility: hidden; opacity: 0; background: #131f3c7a; transition: opacity 220ms ease, visibility 220ms; }
  #sidebar-search { font-size: 1rem; }
  .workspace.drawer-open .sidebar { visibility: visible; transform: translateX(0); transition-property: transform; }
  .workspace.drawer-open .sidebar-backdrop { visibility: visible; opacity: 1; }
  .chat { height: 100%; }
  .chat-header { min-height: 60px; padding: 7px 14px; }
  #sidebar-toggle { display: inline-grid; padding: 0; background: transparent; }
  .chat-heading-title { gap: 8px; }
  .chat-heading-title .presence { gap: 4px; font-size: .73rem; }
  .chat-heading-title .presence-dot { width: 6px; height: 6px; }
  .chat-peer-avatar { width: 40px; height: 40px; }
  .chat-heading .country-pair { overflow: hidden; }
  .country-pair-side > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chat-heading h1 { font-size: 1.03rem; }
  .chat-heading p { font-size: .78rem; }
  .statusbar { min-height: 37px; padding: 3px 14px; }
  #contacts-list, #contacts-archive, #handle-form:has(#my-handle[readonly]) { display: none; }
  .timeline-inner { padding: 13px 13px 16px; }
  .message-content { max-width: 85%; }
  .channel-post .message-content { max-width: 100%; }
  .chat-footer { padding: 2px 10px calc(7px + env(safe-area-inset-bottom)); }
  .composer { padding: 5px; border-radius: 13px; }
  .send { min-width: 45px; }
  .compose-entry > .send span:first-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .footer-meta { margin-top: 5px; padding-inline: 4px; font-size: .69rem; text-align: left; }
  .empty p { max-width: 270px; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar, .sidebar-backdrop { transition: none; }
}

@media (max-width: 540px) {
  #settings-dialog[open] {
    position: fixed; inset: 0; width: 100%; height: var(--visible-height, 100dvh); max-width: none;
    margin: 0; border: 0; border-radius: 0;
  }
  .settings-top { padding-block-start: calc(10px + env(safe-area-inset-top)); }
  .settings-scroll { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  #invite-dialog[open] {
    position: fixed; inset: 0; width: 100%; height: var(--visible-height, 100dvh);
    margin: 0; border: 0; border-radius: 0;
  }
  .invite-heading { padding-block-start: calc(10px + env(safe-area-inset-top)); }
  .invite-scroll { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
}

@media (max-width: 350px) {
  .chat-header { padding-inline: 9px; gap: 7px; }
  .chat-heading h1 { font-size: .97rem; }
}

@media (max-width: 420px) {
  .compose-row { gap: 4px; }
}

@media (max-height: 430px) {
  .empty-art { display: none; }
  .empty h2 { margin-top: 0; }
  .empty { padding-block: 10px; }
}
