:root {
  color-scheme: light;
  --canvas: #f2f5f3;
  --surface: #ffffff;
  --surface-soft: #f7f9f8;
  --surface-warm: #fff8f2;
  --ink: #17211d;
  --muted: #65736d;
  --subtle: #8b9792;
  --line: #d9e1dd;
  --line-strong: #c4cfca;
  --brand: #124f3f;
  --brand-strong: #0b3f32;
  --brand-soft: #e4f2ed;
  --accent: #c76143;
  --accent-soft: #fae9e2;
  --gold: #d6a140;
  --danger: #b23c45;
  --danger-soft: #fae8e9;
  --shadow: 0 14px 40px rgba(26, 50, 41, 0.12);
  --radius: 8px;
  --rail-width: 88px;
  --list-width: 348px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-width: 320px; height: 100%; margin: 0; overflow: hidden; }
body { background: var(--canvas); color: var(--ink); font-size: 14px; letter-spacing: 0; }
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: 0; }
button { border: 0; }
button, label, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(214, 161, 64, 0.48); outline-offset: 2px; }
[hidden] { display: none !important; }
svg { width: 19px; height: 19px; stroke-width: 1.9; }

.loading-screen { position: fixed; inset: 0; z-index: 1000; display: grid; place-content: center; justify-items: center; gap: 22px; background: var(--canvas); }
.loading-line { width: 120px; height: 3px; overflow: hidden; border-radius: 2px; background: var(--line); }
.loading-line::after { content: ""; display: block; width: 45%; height: 100%; background: var(--accent); animation: loading 1.15s ease-in-out infinite; }
@keyframes loading { 0% { transform: translateX(-120%); } 100% { transform: translateX(280%); } }

.brand-mark { display: inline-grid; place-items: center; width: 38px; height: 38px; flex: 0 0 auto; border-radius: 7px; background: var(--brand); color: #fff; font-size: 19px; font-weight: 850; }
.brand-mark.large { width: 54px; height: 54px; font-size: 25px; }
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-lockup > span:last-child { display: grid; gap: 2px; }
.brand-lockup strong { font-size: 17px; }
.brand-lockup small { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.brand-lockup.inverse .brand-mark { background: #fff; color: var(--brand); }
.brand-lockup.inverse small { color: rgba(255,255,255,.68); }

.eyebrow { margin: 0 0 5px; color: var(--accent); font-size: 11px; font-weight: 800; line-height: 1.2; text-transform: uppercase; }
.auth-view { display: grid; grid-template-columns: minmax(310px, 42%) 1fr; min-height: 100dvh; }
.auth-brand { position: relative; display: flex; flex-direction: column; justify-content: space-between; min-height: 100dvh; padding: clamp(28px, 5vw, 70px); overflow: hidden; background: var(--brand); color: #fff; }
.auth-brand-copy { position: relative; z-index: 1; max-width: 480px; }
.auth-brand-copy .eyebrow { color: #efb965; }
.auth-brand h1 { max-width: 420px; margin: 10px 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(36px, 4vw, 64px); font-weight: 500; line-height: 1.02; }
.auth-footer { position: relative; z-index: 1; margin: 0; color: rgba(255,255,255,.7); font-size: 13px; }
.auth-form-wrap { display: grid; place-items: center; min-height: 100dvh; padding: 30px; background: var(--surface); }
.auth-form { width: min(100%, 420px); }
.auth-form h2 { margin: 4px 0 9px; font-size: 30px; line-height: 1.15; }
.auth-context { margin: 0 0 22px; padding: 11px 12px; border-left: 3px solid var(--gold); background: #fff8e8; color: #64532f; }
.mobile-brand { display: none; margin-bottom: 44px; }
.privacy-line { display: flex; align-items: flex-start; gap: 9px; margin: 20px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.privacy-line svg { width: 17px; height: 17px; flex: 0 0 auto; color: var(--brand); }

.field { display: grid; gap: 7px; margin: 16px 0; font-weight: 700; }
.field > span:first-child { font-size: 12px; }
.field > small { justify-self: end; color: var(--subtle); font-size: 11px; font-weight: 500; }
.field input, .field textarea, .field select, .search-box input, .message-input textarea, .copy-result input { width: 100%; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); }
.field input, .field select { min-height: 44px; padding: 0 12px; }
.field textarea { min-height: 92px; padding: 11px 12px; resize: vertical; line-height: 1.5; }
.field input:hover, .field textarea:hover, .field select:hover { border-color: #aab8b2; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--brand); outline: 3px solid rgba(18,79,63,.12); }
.input-shell { position: relative; display: flex; align-items: center; }
.input-shell > svg { position: absolute; left: 12px; z-index: 1; width: 18px; color: var(--muted); }
.input-shell > input { padding-left: 40px; padding-right: 42px; }
.input-shell .icon-button { position: absolute; right: 4px; }
.form-alert { margin: 13px 0; padding: 10px 12px; border: 1px solid #e8b6ba; border-radius: 6px; background: var(--danger-soft); color: #832a32; font-size: 13px; font-weight: 650; line-height: 1.4; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 15px; border: 1px solid transparent; border-radius: 6px; font-weight: 750; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.button svg { width: 17px; height: 17px; }
.button.primary { background: var(--brand); color: #fff; }
.button.primary:hover { background: var(--brand-strong); }
.button.secondary { border-color: var(--line-strong); background: var(--surface); color: var(--ink); }
.button.secondary:hover { background: var(--surface-soft); border-color: #9eadA6; }
.button.danger { background: var(--danger); color: #fff; }
.button.danger-quiet { border-color: #ebc2c5; background: var(--danger-soft); color: var(--danger); }
.button.wide { width: 100%; min-height: 46px; justify-content: space-between; padding: 0 17px; }
.button.small { min-height: 32px; padding: 0 10px; font-size: 12px; }
.button.text-button { min-height: 32px; padding: 0 8px; background: transparent; color: var(--muted); }
.button:disabled, .icon-button:disabled { cursor: not-allowed; opacity: .45; }
.icon-button { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: 0 0 auto; padding: 0; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-button:hover { border-color: var(--line); background: var(--surface-soft); color: var(--ink); }
.icon-button.compact { width: 32px; height: 32px; }
.icon-button.compact svg { width: 16px; height: 16px; }

.app-shell { width: 100vw; height: 100dvh; display: grid; grid-template-columns: var(--rail-width) var(--list-width) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); overflow: hidden; }
.nav-rail { z-index: 5; min-height: 0; display: flex; flex-direction: column; align-items: stretch; overflow-y: auto; overscroll-behavior: contain; padding: 16px 8px 11px; border-right: 1px solid rgba(255,255,255,.08); background: #17372e; color: #fff; }
.rail-brand { display: grid; place-items: center; align-self: center; width: 54px; height: 50px; margin: 0 0 18px; border-radius: 7px; background: transparent; cursor: pointer; }
.rail-brand .brand-mark { background: #fff; color: var(--brand); }
.rail-nav { display: grid; gap: 5px; }
.rail-bottom { margin-top: auto; }
.rail-item { position: relative; display: grid; grid-template-rows: 23px 16px; place-items: center; min-height: 55px; padding: 6px 2px; border-radius: 6px; background: transparent; color: rgba(255,255,255,.69); cursor: pointer; text-decoration: none; }
.rail-item span { font-size: 10px; font-weight: 700; }
.rail-item svg { width: 20px; height: 20px; }
.rail-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.rail-item.active { background: #fff; color: var(--brand); }
.rail-item b { position: absolute; top: 3px; right: 8px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 10px; line-height: 18px; }

.thread-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; border-right: 1px solid var(--line); background: var(--surface); }
.thread-pane-header { min-height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 20px 18px 14px; }
.thread-pane-header h1 { margin: 0; font-size: 24px; line-height: 1.1; }
.account-id { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.compact-command { min-width: 42px; padding: 0 12px; }
.compact-command span { display: none; }
.search-row { padding: 0 14px 13px; }
.search-box { position: relative; display: flex; align-items: center; }
.search-box > svg { position: absolute; left: 11px; width: 17px; color: var(--muted); }
.search-box input { height: 40px; padding: 0 38px; background: var(--surface-soft); }
.search-box .icon-button { position: absolute; right: 4px; }
.thread-summary { min-height: 34px; padding: 7px 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fafcfa; color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; }
.thread-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.thread-item { position: relative; display: grid; grid-template-columns: 42px minmax(0,1fr) auto; gap: 11px; min-height: 82px; width: 100%; padding: 14px; border-bottom: 1px solid #e9eeeb; background: var(--surface); text-align: left; cursor: pointer; }
.thread-item:hover { background: #f8faf9; }
.thread-item.active { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.thread-item.unread .thread-name, .thread-item.unread .thread-preview { font-weight: 800; color: var(--ink); }
.thread-copy { min-width: 0; display: grid; align-content: center; gap: 4px; }
.thread-name-row { display: flex; align-items: center; min-width: 0; gap: 5px; }
.thread-name { overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.verified-icon { width: 15px; height: 15px; color: var(--brand); }
.thread-id { overflow: hidden; color: var(--muted); font-size: 10px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.thread-preview { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.thread-meta { display: grid; justify-items: end; align-content: center; gap: 7px; color: var(--subtle); font-size: 10px; }
.unread-badge { min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 800; line-height: 19px; text-align: center; }
.state-badge { padding: 3px 5px; border-radius: 4px; background: #fff2d7; color: #79581d; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.list-empty { min-height: 250px; display: grid; place-content: center; justify-items: center; gap: 7px; padding: 30px; color: var(--muted); text-align: center; }
.list-empty > svg { width: 32px; height: 32px; margin-bottom: 8px; color: var(--line-strong); }
.list-empty strong { color: var(--ink); }
.list-empty span { font-size: 12px; }

.avatar { position: relative; display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 auto; overflow: hidden; border: 1px solid #c8d6d0; border-radius: 50%; background: #edf3f0; color: var(--brand); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar svg { width: 19px; height: 19px; }
.conversation-pane { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #edf2ef; }
.conversation-empty { height: 100%; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--muted); text-align: center; }
.conversation-empty .empty-symbol { display: grid; place-items: center; width: 62px; height: 62px; margin-bottom: 10px; border: 1px solid var(--line-strong); border-radius: 50%; background: rgba(255,255,255,.55); color: var(--brand); }
.conversation-empty .empty-symbol svg { width: 29px; height: 29px; }
.conversation-empty strong { color: var(--ink); font-size: 18px; }
.conversation-empty p { margin: 0; font-size: 13px; }
.conversation-view { height: 100%; min-height: 0; max-height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.conversation-header { position: relative; z-index: 3; flex: 0 0 auto; min-height: 72px; display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.mobile-back { display: none; }
.peer-identity { min-width: 0; flex: 1; display: flex; align-items: center; gap: 11px; padding: 3px; border-radius: 6px; background: transparent; text-align: left; cursor: pointer; }
.peer-identity:hover { background: var(--surface-soft); }
.peer-copy { min-width: 0; display: grid; gap: 3px; }
.peer-copy strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.peer-copy small { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; }
.peer-status:not(:empty)::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: #45a574; }
.conversation-tools { display: flex; align-items: center; gap: 2px; }
.action-menu { position: absolute; top: 61px; right: 14px; z-index: 20; min-width: 190px; padding: 6px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); box-shadow: var(--shadow); }
.action-menu button { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 10px; border-radius: 5px; background: transparent; font-size: 12px; font-weight: 650; text-align: left; cursor: pointer; }
.action-menu button:hover { background: var(--surface-soft); }
.action-menu svg { width: 16px; height: 16px; }
.danger-text { color: var(--danger); }
.privacy-banner { flex: 0 0 auto; min-height: 34px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 7px 12px; border-bottom: 1px solid #e7d9b8; background: #fff8e8; color: #72551d; font-size: 11px; }
.privacy-banner svg { width: 15px; height: 15px; }
.message-list { min-height: 0; flex: 1 1 auto; overflow-y: auto; padding: 22px clamp(14px, 3vw, 44px); scroll-behavior: auto; overscroll-behavior: contain; }
.message-day { display: flex; align-items: center; justify-content: center; margin: 7px 0 18px; }
.message-day span { padding: 4px 8px; border: 1px solid rgba(196,207,202,.75); border-radius: 5px; background: rgba(255,255,255,.7); color: var(--muted); font-size: 10px; font-weight: 700; }
.message-row { display: flex; margin: 5px 0; }
.message-row.own { justify-content: flex-end; }
.message-bubble { position: relative; max-width: min(72%, 680px); min-width: 92px; padding: 9px 11px 6px; border: 1px solid #d7e1dc; border-left: 3px solid #b66c4b; border-radius: 8px 8px 8px 2px; background: var(--surface); box-shadow: 0 1px 1px rgba(24,48,39,.05); overflow-wrap: anywhere; }
.message-row.own .message-bubble { border-color: #a9d3c1; border-left-width: 1px; border-right: 3px solid #19745a; border-radius: 8px 8px 2px 8px; background: #d1ecdf; }
.message-row.system { justify-content: center; }
.message-row.system .message-bubble { padding: 5px 9px; border-color: #dfd3bd; border-radius: 5px; background: #fff9ec; color: #725d31; font-size: 11px; text-align: center; }
.message-speaker { margin-bottom: 5px; color: #944e30; font-size: 10px; font-weight: 800; line-height: 1.25; }
.message-row.own .message-speaker { color: #135640; }
.message-text { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; line-height: 1.47; }
.deleted-message { display: flex; align-items: center; gap: 7px; color: var(--subtle); font-style: italic; }
.deleted-message svg { width: 15px; height: 15px; }
.message-meta { display: flex; align-items: center; justify-content: flex-end; gap: 4px; min-height: 16px; margin-top: 3px; color: var(--subtle); font-size: 9px; }
.message-meta svg { width: 13px; height: 13px; }
.message-meta .read { color: #247c61; }
.reply-quote { margin: 0 0 7px; padding: 7px 9px; border-left: 3px solid var(--accent); border-radius: 4px; background: rgba(255,255,255,.55); color: var(--muted); font-size: 11px; }
.message-files { min-width: 0; display: grid; gap: 7px; margin-bottom: 6px; }
.message-file { min-width: 0; max-width: 100%; display: grid; justify-items: start; gap: 3px; }
.message-file > a, .message-file > video, .message-file > audio { max-width: 100%; }
.delete-file { display: inline-flex; align-items: center; gap: 4px; padding: 3px 5px; border-radius: 4px; background: transparent; color: var(--danger); font-size: 10px; cursor: pointer; }
.delete-file:hover { background: var(--danger-soft); }
.delete-file svg { width: 12px; height: 12px; }
.file-tile { min-width: 0; max-width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid rgba(103,130,119,.22); border-radius: 6px; background: rgba(255,255,255,.62); color: var(--ink); text-decoration: none; }
.file-tile:hover { border-color: var(--brand); }
.file-tile > svg { flex: 0 0 auto; color: var(--brand); }
.file-tile span { min-width: 0; display: grid; }
.file-tile strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.file-tile small { color: var(--muted); font-size: 9px; }
.message-image, .message-video { display: block; max-width: 100%; max-height: min(360px, 40dvh); border-radius: 6px; object-fit: contain; background: #12201b; }
.message-audio { width: min(340px, 100%); height: 38px; }
.message-actions { position: absolute; top: -16px; right: 4px; display: none; align-items: center; padding: 2px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); box-shadow: 0 4px 12px rgba(24,48,39,.12); }
.message-bubble:hover .message-actions, .message-bubble:focus-within .message-actions { display: flex; }
.message-actions button { width: 28px; height: 27px; display: grid; place-items: center; padding: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; }
.message-actions button:hover { background: var(--surface-soft); color: var(--ink); }
.message-actions svg { width: 14px; height: 14px; }
.reaction-bar { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.reaction-chip { min-height: 22px; padding: 0 6px; border: 1px solid #ccd8d3; border-radius: 5px; background: #fff; color: var(--muted); font-size: 10px; cursor: pointer; }
.reaction-chip.mine { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.typing-status { align-items: center; gap: 4px; min-height: 28px; padding: 0 28px; color: var(--muted); font-size: 10px; }
.typing-status:not([hidden]) { display: flex; }
.typing-status > span { width: 5px; height: 5px; border-radius: 50%; background: var(--brand); animation: typing 1s infinite alternate; }
.typing-status > span:nth-child(2) { animation-delay: .16s; }
.typing-status > span:nth-child(3) { animation-delay: .32s; }
.typing-status em { margin-left: 4px; font-style: normal; }
@keyframes typing { to { opacity: .25; transform: translateY(-2px); } }

.request-gate, .pending-gate { flex: 0 1 auto; min-height: 0; overflow-y: auto; margin: 16px clamp(14px, 3vw, 44px); padding: 18px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
.request-gate blockquote { margin: 12px 0; padding: 12px 14px; border-left: 3px solid var(--gold); background: var(--surface-warm); font-size: 14px; line-height: 1.5; }
.request-privacy { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.request-privacy svg { width: 15px; height: 15px; }
.request-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.pending-gate { display: flex; align-items: center; gap: 13px; background: #fff9ec; }
.pending-gate > svg { color: var(--gold); }
.pending-gate > div { display: grid; gap: 3px; }
.pending-gate span { color: var(--muted); font-size: 11px; }

.composer { flex: 0 0 auto; max-height: 35dvh; overflow-y: auto; padding: 8px 12px 10px; border-top: 1px solid var(--line); background: var(--surface); }
.composer-row { display: flex; align-items: flex-end; gap: 5px; }
.message-input { min-width: 0; flex: 1; }
.message-input textarea { display: block; max-height: min(150px, 25dvh); min-height: 42px; padding: 10px 12px; resize: none; line-height: 1.45; }
.send-button { background: var(--brand); color: #fff; }
.send-button:hover { background: var(--brand-strong); color: #fff; }
.reply-preview { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -1px 45px 7px; padding: 6px 9px; border-left: 3px solid var(--accent); background: var(--surface-soft); }
.reply-preview > span { min-width: 0; display: grid; gap: 2px; }
.reply-preview small { color: var(--accent); font-size: 9px; font-weight: 750; }
.reply-preview strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.file-preview { display: flex; gap: 7px; overflow-x: auto; margin: 0 45px 7px; padding-bottom: 2px; }
.pending-file { display: flex; align-items: center; gap: 7px; max-width: 220px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-soft); font-size: 10px; }
.pending-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recording-bar { min-height: 48px; display: flex; align-items: center; gap: 10px; }
.recording-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); animation: pulse 1s infinite; }
.recording-bar > span:nth-of-type(2) { flex: 1; color: var(--muted); font-size: 11px; }
@keyframes pulse { 50% { opacity: .35; } }

.modal { width: min(580px, calc(100% - 28px)); max-height: min(760px, calc(100dvh - 28px)); padding: 0; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(15, 28, 23, .48); backdrop-filter: blur(2px); }
.compact-modal { width: min(480px, calc(100% - 28px)); }
.wide-modal { width: min(900px, calc(100% - 28px)); }
.modal > form, .modal > div { max-height: inherit; display: flex; flex-direction: column; }
.modal-header { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; font-size: 20px; }
.modal-body { min-height: 0; overflow-y: auto; padding: 19px 20px; }
.modal-footer { min-height: 64px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 11px 20px; border-top: 1px solid var(--line); background: var(--surface-soft); }
.modal-copy { margin: 0 0 16px; color: var(--muted); line-height: 1.5; }
.two-column-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.profile-photo-editor { display: flex; align-items: center; gap: 16px; margin-bottom: 13px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.profile-photo { display: grid; place-items: center; width: 76px; height: 76px; flex: 0 0 auto; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface-soft); color: var(--brand); }
.profile-photo img { width: 100%; height: 100%; object-fit: cover; }
.profile-photo svg { width: 30px; height: 30px; }
.profile-photo-editor > div { display: grid; justify-items: start; gap: 5px; }
.profile-photo-editor span { color: var(--muted); font-size: 11px; }
.identity-document-note { display: flex; align-items: flex-start; gap: 10px; margin-top: 18px; padding: 12px; border-left: 3px solid var(--brand); background: var(--brand-soft); color: #355149; font-size: 11px; line-height: 1.45; }
.identity-document-note svg { flex: 0 0 auto; width: 18px; color: var(--brand); }
.checkbox-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.checkbox-list label { position: relative; }
.checkbox-list input { position: absolute; opacity: 0; }
.checkbox-list label > span { min-height: 44px; display: flex; align-items: center; gap: 9px; padding: 0 11px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); cursor: pointer; }
.checkbox-list input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.checkbox-list input:focus-visible + span { outline: 3px solid rgba(214,161,64,.48); }
.checkbox-list svg { width: 17px; height: 17px; }
.setting-list { padding: 5px 20px; }
.setting-row { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); cursor: pointer; }
.setting-row:last-child { border-bottom: 0; }
.setting-row > span { display: grid; gap: 4px; }
.setting-row small { color: var(--muted); font-size: 11px; font-weight: 400; }
input[role="switch"] { appearance: none; width: 40px; height: 22px; flex: 0 0 auto; padding: 2px; border: 1px solid var(--line-strong); border-radius: 11px; background: #dfe5e2; cursor: pointer; }
input[role="switch"]::before { content: ""; display: block; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s; }
input[role="switch"]:checked { border-color: var(--brand); background: var(--brand); }
input[role="switch"]:checked::before { transform: translateX(18px); }
.copy-result { display: flex; gap: 6px; margin-top: 16px; }
.copy-result input { min-width: 0; height: 42px; padding: 0 10px; background: var(--surface-soft); color: var(--muted); font-size: 11px; }
.sites-layout { display: grid; grid-template-columns: minmax(260px, 330px) minmax(0,1fr); gap: 24px; }
.site-create-form { padding-right: 23px; border-right: 1px solid var(--line); }
.site-create-form h3, .site-list-section h3 { margin: 0 0 14px; font-size: 14px; }
.snippet-result { margin-top: 20px; padding: 12px; border: 1px solid #c8d9d2; border-radius: 6px; background: var(--brand-soft); }
.snippet-result > div, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.snippet-result pre { max-height: 110px; overflow: auto; margin: 9px 0; padding: 9px; border-radius: 4px; background: #17372e; color: #e8f6f0; font: 10px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.snippet-result small { color: var(--muted); font-size: 10px; }
.site-list { display: grid; gap: 8px; }
.site-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; padding: 11px; border: 1px solid var(--line); border-radius: 6px; }
.site-row > div:first-child { min-width: 0; display: grid; gap: 4px; }
.site-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-row small { color: var(--muted); font-size: 10px; }
.site-row-actions { display: flex; align-items: center; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; background: #50a477; }
.status-dot.disabled { background: var(--subtle); }
.shared-profile { display: grid; gap: 13px; }
.shared-profile-hero { display: flex; align-items: center; gap: 14px; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.shared-profile-grid { display: grid; gap: 11px; }
.shared-profile-field { display: grid; gap: 3px; }
.shared-profile-field small { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.shared-profile-field p { margin: 0; line-height: 1.5; white-space: pre-wrap; }

.call-dialog { width: min(1000px, calc(100% - 24px)); height: min(720px, calc(100dvh - 24px)); max-width: none; max-height: none; padding: 0; overflow: hidden; border: 0; border-radius: 8px; background: #101815; color: #fff; }
.call-dialog::backdrop { background: rgba(5,10,8,.84); }
.call-stage { position: relative; width: 100%; height: 100%; overflow: hidden; }
#remote-video { width: 100%; height: 100%; object-fit: cover; background: #101815; }
#local-video { position: absolute; top: 18px; right: 18px; width: min(24%, 210px); aspect-ratio: 4/3; border: 1px solid rgba(255,255,255,.3); border-radius: 7px; background: #1e2a26; object-fit: cover; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.call-avatar { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; pointer-events: none; }
.call-avatar > svg { width: 62px; height: 62px; padding: 16px; border: 1px solid rgba(255,255,255,.2); border-radius: 50%; background: rgba(255,255,255,.08); }
.call-avatar strong { font-size: 20px; }
.call-avatar span { color: rgba(255,255,255,.65); }
.call-controls { position: absolute; left: 50%; bottom: 26px; display: flex; gap: 12px; transform: translateX(-50%); }
.call-control { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,.14); color: #fff; cursor: pointer; backdrop-filter: blur(8px); }
.call-control:hover { background: rgba(255,255,255,.24); }
.call-control.end { background: #c6424c; }
.call-control.accept { background: #25815f; }
.call-control.off { background: #fff; color: #1c2824; }
.incoming-call-modal { width: min(360px, calc(100% - 28px)); text-align: center; }
.incoming-call-modal > div { align-items: center; padding: 32px; }
.incoming-call-icon { display: grid; place-items: center; width: 68px; height: 68px; margin-bottom: 20px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); }
.incoming-call-icon svg { width: 29px; height: 29px; }
.incoming-call-modal h2 { margin: 2px 0 4px; }
.incoming-call-modal p:not(.eyebrow) { margin: 0; color: var(--muted); }
.incoming-call-actions { display: flex; gap: 38px; margin-top: 28px; }

.toast-region { position: fixed; z-index: 2000; top: 116px; right: 18px; display: grid; gap: 8px; width: min(360px, calc(100% - 36px)); pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 9px; padding: 11px 13px; border: 1px solid #b9ccc4; border-radius: 7px; background: #fff; box-shadow: var(--shadow); color: var(--ink); font-size: 12px; line-height: 1.4; animation: toast-in .18s ease-out; }
.toast.error { border-color: #e2adb2; background: #fff6f6; color: #7b2930; }
.toast svg { flex: 0 0 auto; width: 17px; height: 17px; color: var(--brand); }
.toast.error svg { color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (min-width: 1280px) {
  :root { --list-width: 388px; }
  .compact-command span { display: inline; }
}

@media (max-width: 960px) {
  :root { --rail-width: 68px; --list-width: 310px; }
  .nav-rail { padding-inline: 6px; }
  .rail-item span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .rail-item { grid-template-rows: 1fr; min-height: 48px; }
  .rail-brand { width: 48px; }
  .rail-item b { right: 2px; }
  .conversation-header { padding-inline: 10px; }
  .message-bubble { max-width: 82%; }
}

@media (max-width: 720px) {
  html, body { overflow: hidden; }
  .auth-view { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-form-wrap { align-items: start; padding: 28px 22px; }
  .auth-form { margin-top: min(11vh, 82px); }
  .mobile-brand { display: flex; }
  .app-shell { grid-template-columns: 58px minmax(0,1fr); }
  .nav-rail { grid-column: 1; grid-row: 1; }
  .thread-pane { grid-column: 2; grid-row: 1; border-right: 0; }
  .conversation-pane { position: fixed; inset: 0; z-index: 20; display: none; }
  body.thread-open .conversation-pane { display: block; }
  .conversation-view { background: #edf2ef; }
  .mobile-back { display: inline-grid; }
  .conversation-tools { gap: 0; }
  #create-invite { display: none; }
  .message-list { padding: 16px 10px; }
  .message-bubble { max-width: 88%; }
  .composer { padding-inline: 7px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  .composer-row { gap: 2px; }
  .composer-row > .icon-button { width: 36px; }
  .request-gate, .pending-gate { margin: 12px 10px; }
  .modal { width: calc(100% - 18px); max-height: calc(100dvh - 18px); }
  .two-column-fields, .checkbox-list, .sites-layout { grid-template-columns: 1fr; }
  .site-create-form { padding: 0 0 20px; border-right: 0; border-bottom: 1px solid var(--line); }
  .modal-header, .modal-body, .modal-footer { padding-left: 15px; padding-right: 15px; }
  .modal-footer { padding-bottom: max(11px, env(safe-area-inset-bottom)); }
  .call-dialog { width: 100%; height: 100dvh; max-height: none; border-radius: 0; }
  #local-video { width: 30%; top: 12px; right: 12px; }
}

@media (max-height: 620px) {
  .nav-rail { padding-block: 6px; }
  .rail-brand { height: 40px; margin-bottom: 4px; }
  .rail-item { min-height: 42px; padding-block: 3px; }
  .thread-pane-header { min-height: 68px; padding-block: 8px; }
  .search-row { padding-bottom: 8px; }
  .conversation-header { min-height: 58px; padding-block: 5px; }
  .message-list { padding-top: 10px; padding-bottom: 10px; }
}

@media (max-width: 420px) {
  .thread-pane-header { padding-inline: 14px; }
  .thread-pane-header h1 { font-size: 22px; }
  .conversation-header { min-height: 66px; }
  .peer-copy strong { max-width: 125px; }
  .conversation-tools .icon-button { width: 34px; }
  .file-tile { min-width: 190px; }
  .profile-photo-editor { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
