@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: light;
  /* Primitive tokens */
  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --text-2xs: 8px;
  --text-xs: 9px;
  --text-sm: 10px;
  --text-md: 11px;
  --text-base: 12px;
  --text-lg: 15px;
  --text-xl: 20px;
  --text-display: 24px;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Manrope', 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-heavy: 800;
  --radius-xs: 5px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-pill: 999px;
  --elevation-1: 0 2px 8px rgba(31, 41, 55, .04);
  --elevation-2: 0 8px 24px rgba(31, 41, 55, .07);
  --elevation-3: 0 18px 50px rgba(31, 41, 55, .09), 0 2px 8px rgba(31, 41, 55, .03);
  --elevation-accent: 0 5px 14px rgba(79, 70, 229, .16);
  --motion-fast: 160ms;
  --motion-standard: 240ms;
  --motion-slow: 340ms;
  --ease-standard: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --blur-glass: 28px;

  /* Semantic color tokens */
  --page: #f1f3f6;
  --surface: rgba(255, 255, 255, .64);
  --surface-strong: rgba(255, 255, 255, .82);
  --surface-soft: rgba(248, 249, 251, .62);
  --text: #202a39;
  --muted: #586579;
  --subtle: #48566a;
  --line: rgba(71, 85, 105, .13);
  --accent: #4f46e5;
  --accent-strong: #4338ca;
  --accent-soft: rgba(79, 70, 229, .10);
  --green: #18794e;
  --shadow: var(--elevation-3);
  --bubble-in: rgba(255, 255, 255, .72);
  --avatar-surface: #5b6472;
  --font: var(--font-body);
}

[data-theme="dark"] {
  color-scheme: dark;
  --page: #141a23;
  --surface: rgba(29, 38, 51, .76);
  --surface-strong: rgba(31, 41, 55, .9);
  --surface-soft: rgba(43, 54, 69, .74);
  --text: #edf1f6;
  --muted: #b1bdcc;
  --subtle: #c5ceda;
  --line: rgba(203, 213, 225, .13);
  --accent: #a5b4fc;
  --accent-strong: #586a9e;
  --accent-soft: rgba(165, 180, 252, .14);
  --green: #72d6a5;
  --elevation-1: 0 2px 8px rgba(0, 0, 0, .14);
  --elevation-2: 0 8px 24px rgba(0, 0, 0, .19);
  --elevation-3: 0 20px 56px rgba(0, 0, 0, .25);
  --elevation-accent: 0 5px 14px rgba(0, 0, 0, .2);
  --shadow: var(--elevation-3);
  --bubble-in: rgba(43, 54, 69, .86);
  --avatar-surface: #596779;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-width: 320px; min-height: 100%; margin: 0; }
body {
  min-height: 100vh;
  overflow: hidden;
  color: var(--text);
  background: var(--page);
  font-family: var(--font);
  transition: background var(--motion-slow) var(--ease-standard), color var(--motion-slow) var(--ease-standard);
}
button, input { color: inherit; font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.message-composer:focus-within, .search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.message-composer input:focus-visible, .search-box input:focus-visible { outline: none; }
.ambient { position: fixed; z-index: -1; width: 480px; height: 480px; border-radius: var(--radius-pill); filter: blur(90px); opacity: .28; pointer-events: none; animation: drift 16s ease-in-out infinite alternate; background: #cbd5e1; }
.ambient-one { top: -260px; left: 18%; }
.ambient-two { right: -210px; bottom: -240px; animation-delay: -8s; opacity: .18; }
[data-theme="dark"] .ambient { opacity: .12; }
@keyframes drift { to { transform: translate(35px, 42px) scale(1.13); } }
.app-shell {
  display: grid;
  grid-template-columns: minmax(270px, 304px) minmax(380px, 1fr) minmax(245px, 286px);
  gap: var(--space-4);
  width: min(1512px, calc(100vw - 64px));
  height: min(900px, calc(100dvh - 56px));
  min-height: 540px;
  margin: 28px auto;
}
.glass-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow); backdrop-filter: blur(var(--blur-glass)); -webkit-backdrop-filter: blur(var(--blur-glass)); }
.sidebar, .conversation, .details-panel { min-width: 0; overflow: hidden; }
.sidebar { display: flex; flex-direction: column; position: relative; }
.sidebar-header { height: 68px; flex: 0 0 68px; padding: 0 19px 0 22px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; gap: var(--space-2); align-items: center; color: var(--text); text-decoration: none; font: var(--weight-heavy) var(--text-display)/1 var(--font-display); letter-spacing: -1.5px; }
.brand-mark { width: 29px; height: 29px; display: grid; place-items: center; color: var(--accent-strong); background: var(--accent-soft); border-radius: var(--radius-md); }
.brand-mark svg { width: 23px; }
.brand-period { color: var(--accent); }
.header-actions, .conversation-tools { display: flex; align-items: center; gap: 7px; }
.icon-button, .more-button { width: 34px; height: 34px; display: grid; place-items: center; padding: 0; border: 0; border-radius: var(--radius-md); color: var(--subtle); background: transparent; transition: background var(--motion-fast), color var(--motion-fast), transform var(--motion-fast); }
.icon-button:hover, .more-button:hover { color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.icon-button svg { width: 19px; height: 19px; }
.moon-icon { display: none; }
[data-theme="dark"] .sun-icon { display: none; }
[data-theme="dark"] .moon-icon { display: block; }
.profile-strip { display: flex; align-items: center; gap: var(--space-3); margin: 0 14px; padding: 13px 10px; border-radius: var(--radius-lg); background: var(--surface-soft); }
.avatar { flex: 0 0 auto; position: relative; display: grid; place-items: center; overflow: visible; border-radius: 50%; color: white; font: 700 15px 'Manrope', var(--font); background: var(--avatar-surface) !important; }
.avatar-me { width: 41px; height: 41px; color: #fff; }
.presence { position: absolute; right: -1px; bottom: 1px; width: 11px; height: 11px; border: 2px solid var(--surface-strong); border-radius: 50%; }
.presence.online { background: var(--green); animation: status-glow 2.6s ease-in-out infinite; }
.profile-copy { min-width: 0; display: flex; flex: 1; flex-direction: column; gap: 3px; }
.profile-copy strong { font-size: 12px; font-weight: 700; }
.profile-copy span { color: var(--muted); font-size: 10px; }
.more-button { font-size: 21px; letter-spacing: 1px; }
.search-box { height: 42px; margin: var(--space-4) var(--space-4) var(--space-3); padding: 0 11px; display: flex; align-items: center; gap: var(--space-2); border: 1px solid var(--line); border-radius: var(--radius-md); color: var(--muted); background: var(--surface-soft); }
.search-box svg { flex: 0 0 auto; width: 17px; height: 17px; }
.search-box input { width: 100%; min-width: 0; padding: 0; border: 0; outline: 0; color: var(--text); font-size: var(--text-md); background: transparent; }
.search-box input::placeholder { color: var(--muted); }
kbd { padding: 3px 5px; color: var(--muted); border: 1px solid var(--line); border-radius: var(--radius-xs); font: var(--text-xs) var(--font); white-space: nowrap; background: var(--surface); }
.chat-filters { display: flex; gap: var(--space-1); padding: 0 var(--space-4) 14px; border-bottom: 1px solid var(--line); }
.filter-chip { height: 27px; padding: 0 10px; display: inline-flex; align-items: center; gap: 5px; color: var(--muted); border: 0; border-radius: var(--radius-sm); font-size: var(--text-sm); background: transparent; transition: background var(--motion-standard) var(--ease-standard), color var(--motion-standard) var(--ease-standard); }
.filter-chip.active { color: var(--accent-strong); background: var(--accent-soft); font-weight: 700; }
.filter-chip span { width: 15px; height: 15px; display: grid; place-items: center; border-radius: 5px; font-size: 9px; background: var(--accent-soft); }
.section-label { padding: 15px 20px 8px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: 1.25px; }
.section-label button { border: 0; color: var(--muted); font-size: 16px; background: transparent; }
.chat-list { flex: 1; overflow: auto; padding: 0 8px 8px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.list-group-heading { padding: 11px 11px 5px; color: var(--muted); font-size: 8px; font-weight: 700; letter-spacing: 1.1px; }
.list-group-heading:not(:first-child) { margin-top: 3px; border-top: 1px solid var(--line); padding-top: 12px; }
.chat-item { width: 100%; min-height: 67px; padding: 9px 10px; display: flex; align-items: center; gap: 10px; text-align: left; border: 0; border-radius: var(--radius-lg); background: transparent; transition: background var(--motion-standard), transform var(--motion-standard); animation: enter var(--motion-slow) both; }
.chat-item:hover { transform: translateX(2px); background: var(--surface-soft); }
.chat-item.selected { background: var(--accent-soft); }
@keyframes enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.chat-avatar { width: 43px; height: 43px; font-size: 14px; }
.chat-avatar .presence { width: 10px; height: 10px; }
.chat-meta { flex: 1; min-width: 0; }
.chat-line { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.chat-line strong { overflow: hidden; color: var(--text); font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.pin-indicator { flex: 0 0 auto; display: grid; place-items: center; color: var(--accent); opacity: .8; }
.pin-indicator svg { width: 12px; height: 12px; }
.chat-line time { flex: 0 0 auto; color: var(--muted); font-size: 9px; }
.chat-preview { margin-top: 5px; display: flex; justify-content: space-between; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; }
.chat-preview span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unread-count { min-width: 17px; height: 17px; padding: 0 4px; display: grid; place-items: center; color: white; border-radius: 6px; font-size: 9px; font-weight: 700; background: var(--accent-strong); }
.read-check { color: var(--accent); font-size: 12px; letter-spacing: -3px; padding-right: 3px; }
.empty-list { padding: 35px 20px; color: var(--muted); text-align: center; font-size: 11px; }
.sidebar-footer { height: 39px; flex: 0 0 39px; padding: 0 15px; display: flex; align-items: center; gap: 5px; color: var(--muted); border-top: 1px solid var(--line); font-size: 9px; }
.secure-mark { color: #f0ad6b; font-size: 13px; }
.sidebar-footer strong { color: var(--subtle); font-weight: 600; }
.sidebar-footer button { margin-left: auto; padding: 2px; border: 0; color: var(--muted); background: transparent; }
.mobile-compose { display: none; }

.conversation { position: relative; display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.conversation-header { position: sticky; z-index: 1; top: 0; height: 69px; flex: 0 0 69px; padding: 0 var(--space-5); display: flex; align-items: center; gap: var(--space-3); border-bottom: 1px solid var(--line); background: var(--surface-strong); }
.message-search { min-height: 48px; padding: 6px 14px; display: flex; align-items: center; gap: 7px; border-bottom: 1px solid var(--line); background: var(--surface-strong); }
.message-search[hidden] { display: none; }
.message-search input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); outline: 0; color: var(--text); background: var(--surface-soft); }
.message-search input:focus { border-color: var(--accent); }
.message-search span { min-width: 52px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.message-search button, .reply-preview button { width: 32px; height: 32px; border: 0; border-radius: var(--radius-sm); color: var(--subtle); font-size: 17px; background: transparent; }
.message-search button:hover, .reply-preview button:hover { color: var(--accent); background: var(--accent-soft); }
.conversation-avatar { width: 39px; height: 39px; }
.conversation-person { display: flex; flex: 1; flex-direction: column; gap: 4px; }
.conversation-person strong { font-size: 12px; font-weight: 700; }
.conversation-person > span { display: flex; align-items: center; gap: 5px; color: var(--green); font-size: 9px; }
.status-dot, .online-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(57,191,145,.12); animation: status-glow 2.6s ease-in-out infinite; }
@keyframes status-glow { 50% { box-shadow: 0 0 0 5px rgba(57,191,145,.05); opacity: .78; } }
.conversation-tools .icon-button { width: 33px; height: 33px; }
.back-button { display: none; width: 30px; height: 34px; padding: 0; border: 0; color: var(--subtle); background: transparent; }
.back-button svg { width: 20px; }
.conversation-canvas { flex: 1; min-height: 0; overflow: auto; padding: 24px clamp(18px, 4vw, 48px) 18px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.date-divider { margin: 0 auto 21px; width: max-content; padding: 6px 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; font-size: 9px; background: var(--surface-strong); }
.message-row { max-width: 79%; margin: 0 0 15px; display: flex; align-items: flex-end; gap: var(--space-2); animation: message-in var(--motion-standard) var(--ease-standard) both; }
.message-row.outgoing { margin-left: auto; flex-direction: row-reverse; }
.message-row.group-continues { margin-bottom: 3px; }
.message-row.grouped { margin-top: -1px; }
.message-row:not(.group-continues) { margin-bottom: 15px; }
@keyframes message-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.message-avatar { width: 25px; height: 25px; font-size: 9px; }
.message-avatar-spacer { flex: 0 0 25px; }
.message-stack { min-width: 0; }
.message-actions { min-height: 24px; display: flex; align-items: center; gap: 3px; opacity: 0; transition: opacity var(--motion-fast); }
.message-row:hover .message-actions, .message-row:focus-within .message-actions { opacity: 1; }
.message-actions button { min-width: 26px; height: 23px; padding: 0 5px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: 12px; background: var(--surface-strong); }
.message-actions button:hover { color: var(--accent-strong); background: var(--accent-soft); }
.outgoing .message-actions { justify-content: flex-end; }
.reply-quote { margin: 0 0 7px; padding: 4px 8px; border-left: 2px solid var(--accent); color: var(--muted); font-size: 10px; line-height: 1.4; }
.search-result .message-bubble { outline: 2px solid var(--accent-soft); }
.search-current .message-bubble { outline: 2px solid var(--accent); }
.message-bubble { padding: 11px 13px; color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) var(--radius-xs); font-size: var(--text-md); line-height: 1.6; background: var(--bubble-in); box-shadow: var(--elevation-1); overflow-wrap: anywhere; }
.message-row.grouped .message-bubble { border-top-left-radius: 5px; }
.message-row.group-continues .message-bubble { border-bottom-left-radius: 5px; }
.outgoing .message-bubble { color: #fff; border: 0; border-radius: var(--radius-lg) var(--radius-lg) var(--radius-xs) var(--radius-lg); background: var(--accent-strong); box-shadow: var(--elevation-1); }
.outgoing.grouped .message-bubble { border-top-left-radius: 14px; border-top-right-radius: 5px; }
.outgoing.group-continues .message-bubble { border-bottom-right-radius: 5px; }
.message-time { margin-top: 5px; color: var(--muted); font-size: 8px; }
.outgoing .message-time { color: rgba(255,255,255,.86); text-align: right; }
.outgoing .message-time .read-check { color: #fff; }
.message-time .read-check, .message-time .delivered-check, .message-time .sent-check { font-size: 10px; }
.delivered-check { color: rgba(255,255,255,.72); letter-spacing: -3px; padding-right: 3px; }
.sent-check { color: rgba(255,255,255,.72); }
.inline-reaction { margin-top: 5px; padding: 3px 7px; width: max-content; color: var(--subtle); border: 1px solid var(--line); border-radius: 10px; font-size: 10px; background: var(--surface-strong); }
.photo-card { width: 185px; height: 112px; display: grid; place-items: center; overflow: hidden; border-radius: 10px; color: rgba(255,255,255,.9); font-size: 32px; background: #596779; }
.attachment-image, .attachment-video { display: block; max-width: min(250px, 62vw); max-height: 220px; border-radius: var(--radius-md); object-fit: cover; background: var(--surface-soft); }
.attachment-image:empty, .attachment-video:not([src]) { min-width: 180px; min-height: 90px; }
.media-unavailable { color: var(--muted); font-size: var(--text-sm); }
.file-message[aria-disabled="true"] { opacity: .7; pointer-events: none; }
.photo-card .photo-label { padding: 5px 9px; border: 1px solid rgba(255,255,255,.35); border-radius: 20px; font-size: 8px; background: rgba(255,255,255,.18); backdrop-filter: blur(8px); }
.file-message { max-width: min(250px, 62vw); display: flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; }
.file-message > span:first-child, .voice-icon { width: 30px; height: 30px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; color: var(--accent); background: var(--accent-soft); }
.file-message > span:last-child { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.file-message strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.file-message small { color: var(--muted); font-size: 8px; }
.outgoing .file-message small { color: rgba(255,255,255,.76); }
.voice-message { min-width: 190px; display: flex; align-items: center; gap: 8px; }
.voice-message audio { width: min(180px, 46vw); height: 30px; }
.voice-duration { display: none; }
.typing-indicator { min-height: 31px; padding: 0 26px 8px; display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 9px; }
.typing-indicator[hidden] { display: none; }
.typing-avatar { width: 22px; height: 22px; display: grid; place-items: center; color: white; border-radius: 50%; font-size: 9px; background: var(--avatar-surface); }
.typing-bubble { height: 19px; padding: 0 7px; display: flex; align-items: center; gap: 3px; border-radius: 9px; background: var(--bubble-in); }
.typing-bubble i { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); animation: typing .9s infinite ease-in-out; }
.typing-bubble i:nth-child(2) { animation-delay: .13s; }.typing-bubble i:nth-child(3) { animation-delay: .26s; }
@keyframes typing { 50% { transform: translateY(-3px); opacity: .5; } }
.message-composer { position: sticky; z-index: 1; bottom: 0; min-height: 53px; margin: 5px 19px 0; padding: 6px 7px 6px 12px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-strong); box-shadow: var(--elevation-1); }
.reply-preview { min-height: 46px; margin: 6px 19px 0; padding: 6px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border-left: 3px solid var(--accent); border-radius: var(--radius-sm); background: var(--surface-soft); }
.reply-preview[hidden] { display: none; }
.reply-preview > span { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.reply-preview strong { color: var(--accent-strong); font-size: 9px; }
.reply-preview small { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.message-composer input { flex: 1; width: 0; min-width: 30px; padding: 8px 3px; outline: 0; border: 0; color: var(--text); font-size: var(--text-md); background: transparent; }
.message-composer input::placeholder { color: var(--muted); }
.composer-tool { width: 30px; height: 31px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 9px; color: var(--muted); font-size: 20px; background: transparent; transition: .2s; }
.composer-tool:hover { color: var(--accent); background: var(--accent-soft); }
.composer-tool svg { width: 18px; }
.voice-button.recording { color: #fff; background: #e85f83; animation: record-pulse 1.1s infinite ease-in-out; }
@keyframes record-pulse { 50% { box-shadow: 0 0 0 5px rgba(232,95,131,.18); } }
.emoji-button { font-size: 21px; font-family: sans-serif; }
.send-button { width: 37px; height: 37px; display: grid; place-items: center; padding: 0; border: 0; border-radius: var(--radius-md); color: #fff; background: var(--accent-strong); box-shadow: var(--elevation-1); transition: transform var(--motion-fast), filter var(--motion-fast); }
.send-button:hover { transform: translateY(-2px); filter: brightness(1.08); }
.send-button svg { width: 19px; height: 19px; }
.composer-hint { height: 30px; flex: 0 0 30px; display: flex; justify-content: center; align-items: center; gap: 6px; color: var(--muted); font-size: 8px; }
.composer-hint kbd { padding: 2px 4px; font-size: 8px; }
.composer-hint > span { color: #c5bfdc; }

.details-panel { padding: 0 19px; overflow-y: auto; }
.details-top { height: 62px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: 1.2px; }
.details-top button { width: 26px; height: 26px; padding: 0; border: 0; border-radius: 8px; color: var(--muted); font-size: 20px; background: transparent; }
.details-top button:hover { color: var(--accent); background: var(--accent-soft); }
.detail-profile { padding: 12px 0 20px; display: flex; flex-direction: column; align-items: center; border-bottom: 1px solid var(--line); }
.detail-avatar { width: 74px; height: 74px; font-size: 23px; box-shadow: var(--elevation-2); }
.detail-profile h2 { margin: 12px 0 3px; font: var(--weight-bold) var(--text-lg) var(--font-display); }
.detail-profile p { margin: 0 0 11px; color: var(--muted); font-size: 10px; }
.online-pill { padding: 5px 9px; display: flex; align-items: center; gap: 7px; color: var(--green); border-radius: 20px; font-size: 9px; background: var(--accent-soft); }
.online-pill i { width: 5px; height: 5px; box-shadow: none; }
.detail-actions { padding: 15px 4px; display: flex; justify-content: space-around; border-bottom: 1px solid var(--line); }
.detail-actions button { min-width: 50px; display: flex; flex-direction: column; align-items: center; gap: 5px; border: 0; color: var(--subtle); font-size: 9px; background: transparent; }
.detail-actions button > span:first-child { width: 31px; height: 31px; display: grid; place-items: center; color: var(--accent); border-radius: 10px; font-size: 15px; background: var(--accent-soft); transition: transform .2s; }
.detail-actions button:hover > span:first-child { transform: translateY(-2px); }
.detail-bio { padding: 17px 0 14px; border-bottom: 1px solid var(--line); }
.detail-bio > span, .shared-heading > span { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: 1px; }
.detail-bio p { margin: 8px 0 0; color: var(--subtle); font-size: 10px; line-height: 1.6; }
.shared-heading { padding: 16px 0 10px; display: flex; align-items: center; justify-content: space-between; }
.shared-heading button { padding: 0; border: 0; color: var(--accent); font-size: 9px; background: transparent; }
.shared-heading button span { margin-left: 3px; }
.shared-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.shared-tile { height: 66px; display: grid; place-items: center; border-radius: 9px; color: rgba(255,255,255,.88); font-size: 24px; }
.tile-sunset, .tile-leaf, .tile-wave { background: #596779; }
.detail-links { margin-top: 14px; border-top: 1px solid var(--line); }
.detail-link { width: 100%; min-height: 53px; padding: 0; display: flex; align-items: center; gap: var(--space-2); text-align: left; border: 0; border-bottom: 1px solid var(--line); color: var(--text); background: transparent; }
.detail-link:hover strong, .detail-link:hover b { color: var(--accent); }
.link-icon { width: 29px; height: 29px; display: grid; place-items: center; color: var(--accent); border-radius: 9px; font-size: 14px; background: var(--accent-soft); }
.detail-link > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.detail-links strong { font-size: 10px; font-weight: 600; }
.detail-links small { color: var(--muted); font-size: 9px; }
.detail-link b { color: var(--muted); font-size: 18px; font-weight: 400; }
.sheet-backdrop { position: fixed; z-index: 20; inset: 0; visibility: hidden; opacity: 0; background: rgba(24, 24, 42, .34); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); transition: opacity .24s ease, visibility .24s ease; }
.sheet-backdrop.visible { visibility: visible; opacity: 1; }
.attachment-sheet { position: fixed; z-index: 22; right: 20px; bottom: 20px; width: min(390px, calc(100vw - 32px)); padding: 20px; border-radius: 20px; opacity: 0; visibility: hidden; transform: translateY(14px) scale(.98); transition: opacity .24s ease, transform .24s ease, visibility .24s ease; }
.attachment-sheet.open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
.sheet-handle { display: none; }
.sheet-heading { margin-bottom: 12px; display: flex; justify-content: space-between; align-items: flex-start; }
.sheet-heading > div > span { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: 1.1px; }
.sheet-heading h2 { margin: 5px 0 0; font: 700 16px 'Manrope',var(--font); }
.sheet-close { width: 36px; height: 36px; border: 0; border-radius: 10px; color: var(--muted); font-size: 22px; background: transparent; }
.attachment-option { width: 100%; min-height: 60px; padding: 8px; display: flex; align-items: center; gap: 11px; text-align: left; border: 0; border-radius: 13px; color: var(--text); background: transparent; }
.attachment-option:hover { background: var(--surface-soft); }
.attachment-icon { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 12px; font-size: 19px; }
.photo-option, .document-option { color: var(--accent); background: var(--accent-soft); }
.attachment-option > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.attachment-option strong { font-size: 11px; }
.attachment-option small { color: var(--muted); font-size: 9px; }
.attachment-option > b { color: var(--muted); font-size: 19px; font-weight: 400; }
.toast { position: fixed; z-index: 10; left: 50%; bottom: 26px; padding: 11px 16px; color: white; border-radius: 12px; font-size: 11px; background: #29263d; box-shadow: var(--shadow); opacity: 0; transform: translate(-50%, 10px); pointer-events: none; transition: .25s ease; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 1500px) {
  .app-shell { grid-template-columns: 320px minmax(480px, 1fr) 300px; }
}
@media (max-width: 1080px) {
  .app-shell { position: relative; grid-template-columns: 270px minmax(360px, 1fr); width: calc(100vw - 36px); height: calc(100dvh - 36px); margin: 18px auto; }
  .details-panel { position: absolute; z-index: 21; right: 0; top: 0; bottom: 0; width: 286px; border-radius: 22px; visibility: hidden; transform: translateX(12px); transition: transform .24s ease, visibility .24s ease; }
  .details-panel.open { visibility: visible; transform: translateX(0); }
  .attachment-sheet { right: 24px; }
}
@media (max-width: 700px) {
  body { overflow: hidden; }
  .ambient { width: 300px; height: 300px; filter: blur(60px); }
  .app-shell { position: relative; display: block; width: 100%; height: var(--app-height, 100dvh); min-height: 0; margin: 0; }
  .sidebar, .conversation { position: absolute; inset: 0; border: 0; border-radius: 0; }
  .sidebar { z-index: 2; transition: transform .32s cubic-bezier(.2,.8,.2,1); }
  .conversation { z-index: 1; transition: transform .32s cubic-bezier(.2,.8,.2,1); }
  .app-shell.chat-open .sidebar { transform: translateX(-100%); }
  .app-shell.chat-open .conversation { z-index: 3; }
  .sidebar-header { height: calc(67px + env(safe-area-inset-top)); flex-basis: calc(67px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 20px 0; }
  .sidebar-header .icon-button { min-width: 44px; min-height: 44px; }
  .profile-strip { margin: 4px 15px 0; padding: 13px 10px; }
  .search-box { height: 45px; margin: 15px 15px 12px; }
  .chat-filters { padding-bottom: 13px; }
  .section-label { padding-top: 16px; }
  .chat-item { min-height: 71px; padding: 10px 11px; }
  .chat-avatar { width: 46px; height: 46px; }
  .chat-line strong { font-size: 12px; }
  .chat-preview { font-size: 11px; }
  .sidebar-footer { min-height: calc(39px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); }
  .mobile-compose { position: absolute; z-index: 3; right: 21px; bottom: calc(57px + env(safe-area-inset-bottom)); width: 54px; height: 54px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 18px; color: white; background: var(--accent-strong); box-shadow: var(--elevation-2); }
  .mobile-compose svg { width: 24px; }
  .conversation-header { height: calc(64px + env(safe-area-inset-top)); flex-basis: calc(64px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0; gap: 7px; }
  .back-button { width: 40px; min-height: 44px; display: grid; place-items: center; }
  .conversation-header .icon-button { min-width: 40px; min-height: 44px; }
  .conversation-avatar { width: 37px; height: 37px; }
  .conversation-tools { gap: 0; }
  .conversation-tools .icon-button { width: 31px; }
  .conversation-tools .icon-button:nth-child(2) { display: none; }
  .conversation-canvas { padding: 18px 14px 12px; }
  .message-row { max-width: 88%; }
  .message-composer { margin: 5px 10px 0; padding-bottom: 6px; }
  .reply-preview { margin: 6px 10px 0; }
  .message-actions { opacity: .8; }
  .composer-tool { width: 44px; height: 44px; }
  .send-button { width: 42px; height: 42px; }
  .composer-hint { height: calc(25px + env(safe-area-inset-bottom)); flex-basis: calc(25px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); }
  .details-panel { z-index: 21; top: auto; right: 0; bottom: 0; left: 0; width: 100%; max-height: min(82dvh, 680px); padding: 0 22px max(22px, env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; transform: translateY(105%); visibility: hidden; transition: transform .3s cubic-bezier(.2,.8,.2,1), visibility .3s; }
  .details-panel.open { transform: translateY(0); visibility: visible; }
  .details-top { position: sticky; top: 0; background: var(--surface-strong); }
  .sheet-handle { width: 36px; height: 4px; margin: 0 auto 15px; display: block; border-radius: 4px; background: var(--muted); opacity: .4; }
  .attachment-sheet { right: 0; bottom: 0; left: 0; width: 100%; padding: 12px 22px max(22px, env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; transform: translateY(105%); }
  .attachment-sheet.open { transform: translateY(0); }
  .attachment-option { min-height: 68px; }
  .sheet-close, .details-top button { min-width: 44px; min-height: 44px; }
  .filter-chip { min-height: 44px; }
  .search-box { min-height: 44px; }
  .toast { bottom: calc(20px + env(safe-area-inset-bottom)); }
}
@media (max-width: 380px) {
  .conversation-tools .icon-button:first-child { display: none; }
  .composer-hint { font-size: 7px; }
  .chat-filters { gap: 2px; }
  .filter-chip { padding: 0 8px; }
}
@media (hover: none) {
  .icon-button, .composer-tool, .send-button, .filter-chip, .sheet-close, .details-top button { touch-action: manipulation; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
