:root {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #242036;
  background: #f6f4fa;
  font-synthesis: none;
  --ink: #242036;
  --muted: #625c74;
  --primary: #4c3780;
  --primary-ink: #fff;
  --primary-hover: #392762;
  --paper: #fff;
  --line: #e8e4ef;
  --lavender: #eee8f8;
  --brand-color: #bd9cf6;
  --accent: #6c4f9d;
  --field: #f8f6fb;
  --icon-ink: #54416e;
  --error-ink: #9b1c41;
  --online: #2a8568;
  --online-ring: #cee9de;
}

.admin {
  color-scheme: dark;
  --ink: #f1f3fc;
  --muted: #a7afc8;
  --primary: #a99bff;
  --primary-ink: #15112c;
  --primary-hover: #c1b6ff;
  --paper: #161b28;
  --line: #2a3144;
  --lavender: #26233e;
  --accent: #b3a6ff;
  --field: #101521;
  --icon-ink: #b6bfd8;
  --error-ink: #ffb1c3;
  --online: #62dfb0;
  --online-ring: #21413e;
  --surface-header: #10131d;
  --surface-profiles: #111621;
  --surface-inbox: #151925;
  --surface-chat: #0e121d;
  --surface-hover: #202638;
  --surface-selected: #232642;
  --border-selected: #3d4064;
  --badge-fill: #252843;
  --badge-ink: #c8bcff;
  color: var(--ink);
  background: var(--surface-chat);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; }
button, input, textarea, select { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .6; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3, strong { font-weight: 750; }
a { color: inherit; }
input, textarea, select, button { color: inherit; }

.primary, .plain-button, .text-button, .icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: .875rem;
  font-weight: 680;
  text-decoration: none;
  background: none;
}
.primary { background: var(--primary); color: var(--primary-ink); padding: 10px 17px; }
.primary:hover { background: var(--primary-hover); }
.plain-button { border-color: var(--line); background: var(--paper); padding: 8px 12px; }
.plain-button:hover { background: var(--lavender); }
.text-button { color: var(--accent); min-height: 30px; padding: 3px 1px; text-align: left; }
.text-button:hover, .resume:hover { text-decoration: underline; text-underline-offset: 3px; }
.icon-button { width: 40px; flex: 0 0 40px; font-size: 1.45rem; color: var(--icon-ink); }
.icon-button:hover { background: var(--lavender); }
.wide { width: 100%; }
.muted { color: var(--muted); font-size: .875rem; line-height: 1.6; }
.error { color: var(--error-ink); font-size: .88rem; line-height: 1.5; }

.icon { display: inline-block; position: relative; width: 18px; height: 18px; flex: none; }
.icon::before, .icon::after { content: ""; position: absolute; }
.icon-search::before { width: 11px; height: 11px; border: 1.7px solid; border-radius: 50%; left: 2px; top: 2px; }
.icon-search::after { width: 6px; height: 1.7px; background: currentColor; transform: rotate(45deg); left: 11px; top: 12px; }
.icon-link::before, .icon-link::after { width: 10px; height: 6px; border: 1.5px solid; border-radius: 5px; transform: rotate(-36deg); }
.icon-link::before { top: 4px; right: 1px; }
.icon-link::after { bottom: 4px; left: 1px; }
.icon-chat::before { inset: 2px 1px 4px; border: 1.8px solid; border-radius: 5px; }
.icon-chat::after { width: 5px; height: 5px; left: 4px; bottom: 2px; border: solid currentColor; border-width: 0 0 1.7px 1.7px; transform: skewY(-35deg); background: inherit; }
.icon-smile::before { inset: 0; border: 1.6px solid; border-radius: 50%; }
.icon-smile::after { width: 8px; height: 6px; left: 5px; top: 7px; border-bottom: 1.7px solid; border-radius: 50%; background: radial-gradient(circle at 1.5px 0, currentColor 1px, transparent 1.5px), radial-gradient(circle at 6.5px 0, currentColor 1px, transparent 1.5px); }
.icon-clip::before, .icon-clip::after { border: 1.5px solid; border-radius: 8px; transform: rotate(42deg); }
.icon-clip::before { width: 8px; height: 17px; left: 6px; top: 1px; }
.icon-clip::after { width: 4px; height: 11px; top: 3px; left: 8px; border-top-color: transparent; }

.desk { min-height: 100dvh; display: grid; grid-template-rows: 70px minmax(0, 1fr); height: 100dvh; }
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 27px;
  background: var(--surface-header);
  border-bottom: 1px solid var(--line);
}
.product { display: inline-flex; align-items: center; gap: 11px; font-size: 1.14rem; font-weight: 750; letter-spacing: -.025em; }
.product-mark {
  display: block; flex: none;
  width: 40px; height: 40px; border-radius: 10px;
  box-shadow: 0 5px 16px #735bfe42;
}
.mast-actions { display: flex; align-items: center; gap: 17px; }
.demo-label, .count, .profile-count, .room-label {
  color: var(--badge-ink); background: var(--badge-fill); border-radius: 20px; font-size: .77rem;
}
.demo-label { padding: 4px 9px; }
.live-status { display: inline-flex; align-items: center; gap: 7px; font-size: .8rem; color: var(--muted); }
.live-status b { font-weight: 620; }
.live-status > span { background: #a9a2b7; width: 8px; height: 8px; border-radius: 50%; }
.live-status.online > span { background: var(--online); box-shadow: 0 0 0 3px var(--online-ring); }

.workspace { display: grid; grid-template-columns: minmax(243px, 21%) minmax(282px, 26%) 1fr; min-height: 0; }
.profiles, .inbox { min-width: 0; display: flex; flex-direction: column; overflow: hidden; border-right: 1px solid var(--line); }
.profiles { padding: 22px 15px; background: var(--surface-profiles); }
.section-title { display: flex; align-items: center; gap: 9px; min-height: 38px; }
.profiles > .section-title { justify-content: space-between; padding: 0 5px 0 10px; margin-bottom: 16px; }
.profiles h2 { font-size: .95rem; }
.add-button { border-color: var(--border-selected); background: var(--field); color: var(--accent); width: 36px; min-height: 36px; flex-basis: 36px; font-weight: 500; }
.profile-list, .room-list { overflow: auto; scrollbar-width: thin; }
.profile-list { display: grid; align-content: start; gap: 8px; }
.profile-item, .room-item {
  display: flex; align-items: center; gap: 11px; width: 100%; min-width: 0; background: none;
  text-align: left; border: 1px solid transparent; border-radius: 13px; padding: 10px;
}
.profile-row { display: flex; align-items: center; min-width: 0; border: 1px solid transparent; border-radius: 13px; }
.profile-row:hover { background: var(--surface-hover); }
.profile-row.active { background: var(--surface-selected); border-color: var(--border-selected); box-shadow: inset 2px 0 0 #9988fa; }
.profile-item { padding-right: 4px; gap: 9px; }
.profile-row-actions { display: grid; justify-items: center; padding-right: 4px; padding-bottom: 4px; }
.profile-menu-button {
  display: grid; place-items: center; width: 29px; min-height: 30px;
  padding: 0; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 1.25rem; line-height: 1;
}
.profile-menu-button:hover, .profile-menu-button[aria-expanded=true] { background: var(--lavender); color: var(--ink); }
.profile-menu {
  position: fixed; inset: auto; margin: 0; padding: 5px; min-width: 176px;
  color: var(--ink); background: var(--paper); border: 1px solid var(--border-selected); border-radius: 11px;
  box-shadow: 0 10px 30px #080a1580;
}
.profile-menu button {
  display: flex; align-items: center; gap: 7px; width: 100%; min-height: 36px; padding: 6px 9px;
  border: 0; border-radius: 7px; background: transparent; text-align: left; font-size: .85rem;
}
.profile-menu button:first-child { color: var(--accent); font-weight: 650; }
.profile-menu button:hover, .profile-menu button:focus-visible { background: var(--lavender); }
.profile-menu button:focus-visible { outline-offset: -2px; }
.brand-mark {
  display: inline-grid; place-items: center; border-radius: 11px; flex: 0 0 38px;
  width: 38px; height: 38px; overflow: hidden; color: #231b35;
  background: color-mix(in srgb, var(--brand-color) 80%, white); font-size: 1.2rem;
}
.brand-mark img { display: block; width: 100%; height: 100%; padding: 4px; object-fit: contain; background: #fff; }
.profile-details, .room-details { display: grid; min-width: 0; flex: 1; gap: 4px; }
.profile-details strong, .room-title strong { font-size: .88rem; }
.profile-details small, .room-preview { color: var(--muted); font-size: .78rem; }
.profile-details strong { overflow-wrap: anywhere; }
.profile-details small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-preview, .room-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-count, .count { display: grid; min-width: 24px; min-height: 23px; padding: 2px 6px; place-items: center; }
.profile-count { min-width: 20px; min-height: 18px; padding: 0 5px; font-size: .72rem; }
.profile-foot {
  margin-top: auto; display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 9px 0; color: var(--muted); font-size: .78rem; line-height: 1.55;
}
.profile-foot .icon { color: var(--accent); }

.inbox { background: var(--surface-inbox); }
.inbox-header { display: grid; gap: 14px; padding: 22px 19px 14px; }
.inbox h1 { font-size: 1.34rem; letter-spacing: -.025em; }
.search {
  display: flex; align-items: center; gap: 7px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--field); padding: 0 10px; color: var(--muted);
}
.search:focus-within { outline: 2px solid var(--accent); }
.search input { width: 100%; min-width: 0; min-height: 39px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: .875rem; }
.admin input::placeholder, .admin textarea::placeholder { color: var(--muted); opacity: 1; }
.search input:focus-visible { outline: 0; }
.profile-tools {
  margin: 0 19px 9px; border: 1px solid var(--line); border-radius: 11px; padding: 8px 10px;
  background: var(--field); display: flex; align-items: center; flex-wrap: wrap; column-gap: 12px;
}
.profile-address { display: flex; width: 100%; align-items: center; gap: 7px; font-size: .82rem; color: var(--muted); min-width: 0; }
.profile-domain, .thread-domain { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-tools .text-button { font-size: .76rem; }
.room-list { display: grid; gap: 4px; align-content: start; padding: 7px 12px 16px; }
.room-item:hover { background: var(--surface-hover); }
.room-item[aria-pressed=true] { background: var(--surface-selected); border-color: var(--border-selected); }
.avatar {
  display: inline-grid; place-items: center; flex: 0 0 41px; width: 41px; height: 41px; border-radius: 50%;
  color: #e3caff; background: #3f3056; font-size: .85rem; font-weight: 750; text-transform: uppercase;
}
.avatar-mint { background: #244640; color: #b5f0d8; }
.avatar-peach { background: #4d3448; color: #ffc6bc; }
.avatar-blue { background: #2b3b61; color: #c2d5ff; }
.room-title { display: flex; align-items: center; justify-content: space-between; gap: 5px; min-width: 0; }
.room-title time { flex: none; color: var(--muted); font-size: .75rem; }
.room-label { justify-self: start; padding: 2px 6px; }
.empty-list { padding: 15px 8px; color: var(--muted); font-size: .89rem; }

.thread {
  min-width: 0; min-height: 0;
  background:
    radial-gradient(ellipse at 80% 0%, #25254f75, transparent 56%),
    radial-gradient(circle, #9d9fda1c 0 1px, transparent 1.2px) 0 0 / 22px 22px,
    var(--surface-chat);
}
.thread-open, .guest-thread { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.thread-header {
  min-height: 77px; display: flex; align-items: center; gap: 12px;
  background: var(--paper); border-bottom: 1px solid var(--line); padding: 12px 22px;
}
.identity { min-width: 0; flex: 1; }
.identity h1, .identity h2 { font-size: 1rem; overflow-wrap: anywhere; }
.identity p { font-size: .83rem; color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }
.thread-domain { max-width: 36%; border: 1px solid var(--line); padding: 5px 9px; border-radius: 20px; color: var(--badge-ink); font-size: .78rem; background: var(--field); }
.close-room { font-size: .77rem; }
.thread-blank {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  height: 100%; padding: 28px; text-align: center;
}
.thread-blank h2 { font-size: 1.25rem; }
.thread-blank p { color: var(--muted); max-width: 330px; font-size: .91rem; line-height: 1.6; }
.blank-symbol {
  width: 64px; height: 64px; display: grid; place-items: center; border-radius: 21px; color: var(--accent);
  background: var(--surface-selected); border: 1px solid var(--border-selected);
}
.blank-symbol .icon { transform: scale(1.4); }
.message-log {
  flex: 1; min-height: 0; overflow-y: auto; padding: 21px clamp(15px, 4vw, 52px);
  display: flex; flex-direction: column; align-items: flex-start; gap: 14px; scrollbar-width: thin;
}
.date-rule { display: flex; align-items: center; gap: 13px; width: 100%; justify-content: center; font-size: .78rem; color: var(--muted); margin: 7px 0; }
.date-rule::before, .date-rule::after { content: ""; width: min(16%, 72px); height: 1px; background: var(--line); }
.chat-message { display: grid; max-width: min(84%, 490px); min-width: 0; gap: 3px; }
.chat-message.own { align-self: flex-end; justify-items: end; }
.bubble {
  min-width: 0; padding: 10px 13px; background: var(--paper); border: 1px solid var(--line);
  border-radius: 4px 15px 15px; font-size: .95rem; line-height: 1.65; overflow-wrap: anywhere;
}
.bubble-text { white-space: pre-wrap; }
.auto-reply-label { font-size: .77rem; font-weight: 650; margin-bottom: 4px; opacity: .82; }
.own .bubble { background: #e8dcf7; color: #2f2048; border-color: #e1d3f3; border-radius: 15px 4px 15px 15px; }
.admin .bubble { background: #191f2e; }
.admin .own .bubble { background: #34305f; color: #f4efff; border-color: #4a427a; }
.message-time { font-size: .75rem; color: var(--muted); margin: 0 3px; }
.empty-messages { color: var(--muted); margin: auto; text-align: center; font-size: .93rem; }
.older-button { align-self: center; }
.attachment-link { display: flex; align-items: center; gap: 8px; font-weight: 650; text-underline-offset: 3px; }
.bubble-text + .attachment-link { margin-top: 8px; }
.compose { margin: 6px clamp(13px, 2.8vw, 34px) 20px; padding: 9px 11px 8px; background: var(--paper); border: 1px solid var(--line); border-radius: 15px; }
.compose:focus-within { border-color: var(--accent); }
.compose textarea { width: 100%; border: 0; background: transparent; resize: vertical; min-height: 49px; max-height: 175px; padding: 4px; line-height: 1.4; outline: 0; }
.compose textarea:focus-visible { outline: 0; }
.compose-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.compose-extras { display: flex; align-items: center; gap: 3px; min-width: 0; position: relative; }
.composer-icon { width: 34px; flex-basis: 34px; min-height: 34px; }
.composer-error { margin: 4px 24px; }
.emoji-panel {
  position: absolute; z-index: 2; bottom: 45px; left: 0; display: grid; gap: 1px;
  grid-template-columns: repeat(6, 1fr); padding: 7px; width: 227px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: 0 6px 20px #080a153e;
}
.emoji-panel button { font-size: 1.1rem; padding: 4px; min-height: 34px; border: 0; border-radius: 8px; background: transparent; }
.emoji-panel button:hover { background: var(--lavender); }
.file-badge { min-width: 0; max-width: 240px; display: flex; align-items: center; gap: 4px; font-size: .78rem; background: #eee5f8; color: #3c2b56; padding: 3px 4px 3px 8px; border-radius: 8px; }
.admin .file-badge { background: var(--badge-fill); color: var(--badge-ink); }
.file-badge span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.file-remove { padding: 0 5px; border: 0; background: transparent; font-size: 1.2rem; line-height: 1; }
.room-closed { padding: 14px 18px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; }
.mobile-back { display: none; }

dialog {
  background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 20px;
  padding: 23px; width: min(440px, calc(100vw - 24px)); box-shadow: 0 18px 65px #140c2938;
}
dialog::backdrop { background: #080a158a; backdrop-filter: blur(4px); }
dialog h2 { font-size: 1.2rem; }
dialog form, .guest-card { display: grid; gap: 9px; }
dialog label, .guest-card label { font-size: .86rem; font-weight: 700; margin-top: 6px; }
dialog input, dialog select, .guest-card input {
  width: 100%; min-width: 0; min-height: 42px; border: 1px solid var(--line);
  border-radius: 9px; padding: 7px 9px; background: var(--field);
}
dialog input[type=color] { padding: 3px; }
dialog input[type=file] { font-size: .78rem; }
dialog input[type=file]::file-selector-button {
  border: 0; border-radius: 6px; padding: 5px 8px; margin-right: 5px; background: var(--lavender); color: var(--ink); cursor: pointer;
}
dialog .wide, .guest-card .wide { margin-top: 7px; }
.dialog-title, .dialog-actions { display: flex; justify-content: space-between; align-items: center; gap: 9px; }
.dialog-actions { justify-content: flex-end; margin-top: 10px; }
.dns-record { display: grid; grid-template-columns: max-content 1fr; gap: 8px 13px; padding: 12px; margin: 3px 0; background: var(--field); border-radius: 10px; font-size: .86rem; }
.dns-record dt { font-weight: 700; }
.dns-record dd { margin: 0; overflow-wrap: anywhere; }
.dns-status { padding-top: 3px; }
.profile-dialog { width: min(730px, calc(100vw - 24px)); }
.profile-editor-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 21px; }
.profile-fields { display: grid; gap: 6px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field-grid > div { display: grid; min-width: 0; gap: 5px; }
.logo-note { font-size: .76rem; }
.profile-preview { align-self: start; position: sticky; top: 0; }
.preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 4px 0 9px; }
.profile-preview h3 { color: var(--muted); font-size: .86rem; }
.preview-switcher { display: flex; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); }
.preview-switcher button { border: 0; border-radius: 6px; padding: 4px 7px; background: transparent; font-size: .75rem; }
.preview-switcher button[aria-pressed=true] { background: var(--lavender); color: var(--accent); }
.preview-card { border-radius: 15px; padding: 15px; background: var(--guest-paper); color: var(--guest-ink); border: 1px solid var(--guest-line); display: grid; gap: 10px; }
.preview-card .guest-brand { font-size: .83rem; }
.preview-title { font-size: 1.15rem; font-weight: 750; overflow-wrap: anywhere; }
.preview-field { border: 1px solid var(--guest-line); border-radius: 7px; color: var(--guest-muted); padding: 7px; font-size: .78rem; }
.preview-button { color: #211633; background: color-mix(in srgb, var(--brand-color) 65%, white); font-size: .78rem; }
.appearance-details { border: 1px solid var(--line); border-radius: 9px; margin-top: 4px; padding: 9px; }
.appearance-details summary { cursor: pointer; font-size: .875rem; font-weight: 700; }
.appearance-details textarea { width: 100%; resize: vertical; border: 1px solid var(--line); border-radius: 7px; padding: 7px; background: var(--field); font: .8rem/1.5 ui-monospace, monospace; }
.appearance-details label { display: block; font-size: .78rem; margin-bottom: 3px; }
.appearance-details .muted { font-size: .75rem; }
.appearance-details .header-brand-option { display: flex; align-items: center; gap: 7px; margin: 9px 0; }
dialog .header-brand-option input { width: 16px; min-height: 16px; accent-color: var(--accent); }
.color-controls { display: grid; gap: 5px; margin-top: 8px; }
.color-control { display: grid; grid-template-columns: minmax(0, 1fr) 36px 77px 37px; align-items: center; gap: 5px; }
.color-control label { margin: 0; }
dialog .color-control input { min-height: 32px; }
dialog .color-control input[type=color] { height: 32px; cursor: pointer; }
dialog .color-hex { padding: 5px 6px; font: .79rem/1.3 ui-monospace, monospace; }
.color-reset { font-size: .73rem; }
.style-controls { display: grid; gap: 5px; margin-top: 5px; }
.style-control { display: grid; align-items: baseline; grid-template-columns: 1fr max-content; }
.style-control output { color: var(--muted); font-size: .78rem; }
.style-control input[type=range] { grid-column: 1/-1; margin: 0; padding: 0; min-height: 19px; accent-color: var(--primary); }
.preview-chat-scene {
  padding: 9px; border: 1px solid var(--guest-line); border-radius: 15px;
  background: var(--guest-page-background, var(--guest-default-page));
}
.preview-chat {
  justify-self: center; margin-inline: auto; min-height: calc(var(--chat-max-height) * .26);
  width: clamp(62%, calc(60% + (var(--chat-max-width) - 360px) / 11), 100%);
  border-radius: calc(var(--chat-border-radius) * .62);
  grid-template-rows: auto 1fr auto; overflow: hidden; padding: 0; gap: 0;
  background: var(--guest-chat-background, var(--guest-bg));
}
.preview-chat-header {
  padding: 7px; border-top: 3px solid var(--brand-color);
  background: var(--guest-header-background, var(--guest-paper));
  color: var(--guest-header-foreground, var(--guest-ink));
}
.preview-chat-status { display: inline-flex; align-items: center; gap: 5px; font-weight: 650; }
.preview-chat-status span { width: 7px; height: 7px; border-radius: 50%; background: #258357; }
.preview-chat .preview-field {
  margin: 0 7px 7px;
  background: var(--guest-composer-background, var(--guest-paper));
  color: var(--guest-composer-foreground, var(--guest-muted));
}
.preview-chat-messages { display: grid; align-content: end; gap: calc(var(--chat-gap) * .45); padding: 7px; }
.preview-chat-messages span {
  border-radius: calc(var(--chat-border-radius) * .4);
  padding: 5px 7px; font-size: calc(var(--chat-font-size) * .78);
}
.preview-support-message {
  justify-self: start;
  background: var(--guest-reply-background, var(--guest-paper));
  color: var(--guest-reply-foreground, var(--guest-ink));
}
.preview-customer-message {
  justify-self: end;
  background: var(--guest-message-background, color-mix(in srgb, var(--brand-color) 60%, white));
  color: var(--guest-message-foreground, #251a35);
}
.toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 5; max-width: calc(100% - 40px);
  background: var(--surface-selected); color: var(--ink); border: 1px solid var(--border-selected);
  padding: 12px 18px; border-radius: 12px; box-shadow: 0 7px 24px #080a1570;
}

.login-view {
  min-height: 100dvh; display: grid; place-items: center; padding: 20px;
  background:
    radial-gradient(ellipse at 50% 32%, #3134679c, transparent 53%),
    radial-gradient(circle, #a0a7e325 0 1px, transparent 1.2px) 0 0 / 24px 24px,
    var(--surface-chat);
}
.login-view .guest-card {
  width: min(100%, 410px); color: var(--ink);
  background: linear-gradient(145deg, #1c2235, var(--paper) 60%);
}
.login-view h1 { font-size: 1.33rem; margin: 8px 0 4px; }

.guest, .preview-welcome, .preview-chat-scene {
  --guest-ink: #272037;
  --guest-muted: #5e566f;
  --guest-paper: #fff;
  --guest-line: #ded8e8;
  --guest-bg: #f7f4fa;
  --guest-field: #fff;
  --guest-default-page: var(--guest-bg);
}
[data-theme=compact] {
  --guest-ink: #202638;
  --guest-muted: #505b70;
  --guest-paper: #fff;
  --guest-line: #d7dfeb;
  --guest-bg: #eef2f7;
  --guest-field: #fff;
  --guest-default-page: #f4f6fa;
}
[data-theme=mist] { --guest-paper: #f7f9fb; --guest-bg: #e9eef1; --guest-line: #d8e0e6; --guest-muted: #4c606a; --guest-field: #fff; }
[data-theme=night] {
  --guest-ink: #f1f3fc;
  --guest-muted: #aeb7cf;
  --guest-paper: #191e2c;
  --guest-bg: #101421;
  --guest-line: #333b51;
  --guest-field: #131826;
}
.guest {
  --ink: var(--guest-ink); --muted: var(--guest-muted); --line: var(--guest-line);
  --paper: var(--guest-paper); --lavender: var(--guest-bg); --field: var(--guest-field);
  color: var(--guest-page-foreground, var(--guest-ink));
  background: var(--guest-page-background,
    radial-gradient(ellipse at 10% 0%, color-mix(in srgb, var(--brand-color) 20%, var(--guest-bg)), transparent 55%), var(--guest-bg));
}
.guest-shell { max-width: 1080px; margin: auto; padding: 22px; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; }
.guest[data-theme=compact] { background: var(--guest-page-background, var(--guest-default-page)); }
.guest[data-theme=compact] .guest-shell { padding: 16px; }
.welcome {
  width: 100%; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  border: 1px solid var(--guest-line); border-radius: 26px; overflow: hidden; box-shadow: 0 16px 70px #2420311c;
}
.guest-intro {
  min-height: 480px; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
  gap: 50px; padding: clamp(24px, 5vw, 59px); background: color-mix(in srgb, var(--brand-color) 57%, #eee7ff); color: #251a35;
}
.guest-brand { display: flex; gap: 10px; align-items: center; font-weight: 800; min-width: 0; overflow-wrap: anywhere; }
.guest-intro .brand-mark { background: #ffffffa9; }
.guest[data-theme=night] {
  color-scheme: dark;
  --icon-ink: #b6bfd8;
  --error-ink: #ffb1c3;
  --online: #62dfb0;
  --online-ring: #21413e;
}
.guest[data-theme=night] .guest-intro {
  background:
    radial-gradient(ellipse at 90% 95%, color-mix(in srgb, var(--brand-color) 38%, #171a30), transparent 65%),
    linear-gradient(145deg, color-mix(in srgb, var(--brand-color) 20%, #151829), #141827 65%);
  color: var(--guest-ink);
}
.guest[data-theme=night] .guest-intro .brand-mark { background: color-mix(in srgb, var(--brand-color) 76%, white); }
.guest[data-theme=night] .guest-decoration {
  background: repeating-radial-gradient(circle, transparent 0 17px, #ffffff20 18px 19px, transparent 20px 31px);
}
.intro-copy { position: relative; z-index: 1; display: grid; gap: 15px; margin-bottom: 42px; }
.intro-copy h1 { max-width: 460px; font-size: clamp(2rem, 5vw, 3.5rem); letter-spacing: -.045em; line-height: 1.17; overflow-wrap: anywhere; }
.intro-copy p { line-height: 1.6; max-width: 275px; }
.guest-decoration {
  position: absolute; right: -115px; bottom: -130px; width: 440px; height: 440px; border-radius: 50%;
  background: repeating-radial-gradient(circle, transparent 0 17px, #ffffff43 18px 19px, transparent 20px 31px);
  pointer-events: none;
}
.guest-card { align-content: center; background: var(--paper); color: var(--ink); padding: clamp(22px, 5vw, 44px); }
.login-view .guest-card, .guest-card.unavailable { border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 16px 45px #07091352; }
.guest-card h2 { font-size: 1.34rem; margin-bottom: 4px; }
.guest-card-icon { display: grid; place-items: center; width: 43px; height: 43px; border-radius: 13px; background: color-mix(in srgb, var(--brand-color) 55%, white); color: #30213e; margin-bottom: 5px; }
.guest-note, .resume { font-size: .83rem; line-height: 1.6; color: var(--muted); }
.resume { justify-self: start; text-align: center; text-underline-offset: 3px; }
.guest-note { margin-top: 5px; }
.guest .primary { background: color-mix(in srgb, var(--brand-color) 68%, white); color: #221832; }
.guest .primary:hover { background: color-mix(in srgb, var(--brand-color) 80%, white); }
.guest input::placeholder, .guest textarea::placeholder { color: var(--guest-muted); opacity: 1; }
.guest-thread {
  width: min(100%, var(--chat-max-width, 680px)); height: min(var(--chat-max-height, 760px), calc(100dvh - 44px));
  background: var(--guest-chat-background, var(--guest-bg)); border-radius: var(--chat-border-radius, 21px); overflow: hidden;
  border: 1px solid var(--guest-line); box-shadow: 0 16px 50px #241b3824;
}
.guest-thread .message-log { gap: var(--chat-gap, 14px); padding-block: calc(var(--chat-gap, 14px) + 5px); }
.guest-thread :is(.date-rule, .message-time, .empty-messages) { color: var(--guest-chat-foreground, var(--guest-muted)); }
.guest-thread .bubble {
  color: var(--guest-ink);
  font-size: var(--chat-font-size, 15px);
  border-radius: calc(var(--chat-border-radius, 21px) * .24) calc(var(--chat-border-radius, 21px) * .7) calc(var(--chat-border-radius, 21px) * .7);
}
.guest-thread .chat-message:not(.own) .bubble {
  background: var(--guest-reply-background, var(--guest-paper));
  color: var(--guest-reply-foreground, var(--guest-ink));
}
.guest-thread .own .bubble {
  border-radius: calc(var(--chat-border-radius, 21px) * .7) calc(var(--chat-border-radius, 21px) * .24) calc(var(--chat-border-radius, 21px) * .7) calc(var(--chat-border-radius, 21px) * .7);
}
.guest-thread .compose {
  margin-bottom: 14px;
  border-radius: calc(var(--chat-border-radius, 21px) * .7);
  background: var(--guest-composer-background, var(--guest-paper));
  color: var(--guest-composer-foreground, var(--guest-ink));
  border-color: color-mix(in srgb, var(--guest-composer-foreground, var(--line)) 30%, var(--guest-composer-background, var(--line)));
}
.guest-thread .compose:focus-within { border-color: var(--accent); }
.guest-thread .compose textarea::placeholder { color: var(--guest-composer-foreground, var(--guest-muted)); }
.guest-thread textarea { font-size: max(16px, var(--chat-font-size, 15px)); }
.guest-thread .thread-header {
  border-top: 4px solid var(--brand-color);
  background: var(--guest-header-background, var(--guest-paper));
  color: var(--guest-header-foreground, var(--guest-ink));
}
.guest-thread .thread-header .live-status { color: var(--guest-header-foreground, var(--guest-muted)); }
.guest-thread-actions { display: flex; max-width: 100%; gap: 6px; flex-wrap: wrap; }
.guest-thread-actions .plain-button {
  background: var(--guest-header-background, var(--guest-paper));
  border-color: color-mix(in srgb, var(--guest-header-foreground, var(--guest-line)) 32%, var(--guest-header-background, var(--guest-line)));
}
.guest-thread-actions .plain-button:hover {
  background: color-mix(in srgb, var(--guest-header-background, var(--lavender)) 88%, currentColor);
}
.guest-thread .own .bubble {
  background: var(--guest-message-background, color-mix(in srgb, var(--brand-color) 60%, white));
  color: var(--guest-message-foreground, #2f2048);
  border-color: transparent;
}
.guest-thread .composer-icon { color: var(--guest-composer-foreground, var(--guest-muted)); }
.guest-thread .composer-icon:hover {
  color: var(--guest-composer-foreground, var(--ink));
  background: color-mix(in srgb, var(--guest-composer-background, var(--lavender)) 88%, var(--guest-composer-foreground, var(--lavender)));
}
.guest-thread .emoji-panel { color: var(--ink); }
.guest[data-theme=compact] .guest-thread {
  height: min(var(--chat-max-height, 800px), calc(100dvh - 32px));
  box-shadow: 0 18px 50px #20263824;
}
.guest[data-theme=compact] .thread-header {
  min-height: 61px; gap: 8px; padding: 9px 12px; border-top: 0;
}
.guest[data-theme=compact] .identity h1[hidden] + p { margin-top: 0; }
.guest[data-theme=compact] .guest-thread-actions .plain-button { min-height: 36px; padding: 6px 9px; font-size: .79rem; }
.guest[data-theme=compact] .message-log { padding-inline: 14px; }
.guest[data-theme=compact] .compose {
  position: relative;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 4px;
  align-items: end;
  margin: 0;
  padding: 9px;
  border-width: 1px 0 0;
  border-radius: 0;
}
.guest[data-theme=compact] .compose :is(.compose-bottom, .compose-extras) { display: contents; }
.guest[data-theme=compact] .compose textarea {
  grid-area: 1 / 3;
  min-width: 0; height: 42px; min-height: 42px; max-height: 120px;
  padding: 8px; border: 1px solid currentColor; border-color: inherit; border-radius: 9px;
}
.guest[data-theme=compact] .compose .primary { grid-area: 1 / 4; min-height: 42px; padding-inline: 12px; }
.guest[data-theme=compact] .composer-icon { width: 35px; min-height: 42px; }
.guest[data-theme=compact] .composer-icon:first-of-type { grid-area: 1 / 1; }
.guest[data-theme=compact] .composer-icon:last-of-type { grid-area: 1 / 2; }
.guest[data-theme=compact] .file-badge { grid-area: 2 / 1 / 3 / -1; justify-self: start; }
.guest[data-theme=compact] .emoji-panel { bottom: calc(100% + 6px); left: 8px; }
.unavailable { width: min(100%, 510px); gap: 14px; }
.unavailable h1 { font-size: 1.4rem; }

@media (max-width: 1050px) {
  .workspace { grid-template-columns: 218px 275px 1fr; }
  .thread-header { flex-wrap: wrap; padding-inline: 15px; }
  .thread-domain { order: 3; max-width: 100%; }
}
@media (max-width: 780px) {
  .desk { grid-template-rows: 59px minmax(0, 1fr); }
  .masthead { padding: 0 13px; }
  .mast-actions { gap: 9px; }
  .workspace { display: block; }
  .workspace > * { min-height: 0; height: 100%; }
  .workspace[data-view=profiles] > :not(.profiles),
  .workspace[data-view=inbox] > :not(.inbox),
  .workspace[data-view=thread] > :not(.thread) { display: none; }
  .mobile-back { display: inline-flex; min-height: 36px; width: 34px; flex-basis: 34px; }
  .thread-header { column-gap: 8px; row-gap: 5px; }
  .thread-domain { margin-left: 42px; }
  .close-room { padding: 5px 7px; min-height: 34px; }
  .guest-shell { padding: 12px; }
  .guest-thread { height: min(var(--chat-max-height, 760px), calc(100dvh - 24px)); }
}
@media (max-width: 580px) {
  .welcome, .profile-editor-grid { grid-template-columns: 1fr; }
  .profile-preview { position: static; }
  .guest-intro { min-height: 230px; gap: 22px; }
  .intro-copy { margin-bottom: 8px; gap: 8px; }
  .guest-thread .thread-header { padding-inline: 10px; }
  .guest-back { font-size: .73rem; min-height: 36px; }
  .guest[data-theme=compact] .guest-shell { padding: 8px; }
  .guest[data-theme=compact] .guest-thread { height: min(var(--chat-max-height, 800px), calc(100dvh - 16px)); }
}
@media (max-width: 380px) {
  .mast-actions .live-status b { display: none; }
  .mast-actions .live-status { padding: 4px; }
  .thread-header .close-room { order: 4; }
  .guest-thread-actions { width: 100%; margin-left: 46px; }
  .guest[data-theme=compact] .guest-thread-actions { width: auto; margin-left: 0; }
}
