:root {
  color-scheme: light;
  --color-page: #edf2f7;
  --color-chat-page: #f8f8fa;
  --color-reaction-surface: #f8f8fa;
  --color-surface-header: #ffffff;
  --color-surface-sidebar: #ffffff;
  --color-surface-primary: #ffffff;
  --color-surface-secondary: #f4f6f8;
  --color-surface-tertiary: #e8edf2;
  --color-surface-overlay: #ffffff;
  --color-surface-scrim: #00000099;
  --color-surface-hover: #f0f5fa;
  --color-surface-pressed: #e2ebf3;
  --color-surface-selected: #e3f1fd;
  --color-chat-inbound: #ffffff;
  --color-chat-outbound: #d9fdd3;
  --color-chat-reply-inbound: #edf6fc;
  --color-chat-reply-outbound: #ccefc7;
  --color-action-primary: #3390ec;
  --color-action-primary-hover: #49a0f2;
  --color-action-primary-pressed: #3390ec;
  --color-action-primary-text: #17212b;
  --color-action-secondary: #eef3f7;
  --color-action-secondary-hover: #e0e8ef;
  --color-action-secondary-pressed: #d4dee7;
  --color-action-secondary-text: #334155;
  --color-action-disabled: #e4e9ee;
  --color-action-disabled-text: #8794a2;
  --color-border-subtle: #d9e0e7;
  --color-border-strong: #bdc8d3;
  --color-border-focus: #168acd;
  --color-text-primary: #17212b;
  --color-text-secondary: #64748b;
  --color-text-tertiary: #8493a3;
  --color-text-inverse: #ffffff;
  --color-text-link: #0878c9;
  --color-feedback-positive: #187a48;
  --color-feedback-positive-surface: #e7f7ee;
  --color-feedback-positive-border: #86cfaa;
  --color-feedback-negative: #c43d4b;
  --color-feedback-negative-surface: #fff0f1;
  --color-feedback-negative-border: #e8a2a9;
  --color-feedback-progress: #168acd;
  --color-feedback-progress-surface: #e7f4fc;
  --color-feedback-progress-border: #8fc8e8;
  --color-feedback-warning: #9a6700;
  --color-feedback-warning-surface: #fff6d8;
  --color-feedback-warning-border: #e5c56d;
  --color-unread: #3390ec;
  --color-room-avatar-0: #3390ec;
  --color-room-avatar-1: #32c9b9;
  --color-room-avatar-2: #f49b46;
  --color-room-avatar-3: #8b6eef;
  --color-room-avatar-4: #e86a7b;
  --color-room-avatar-5: #3dab8d;
  --color-unread-selected-text: #0878c9;
  --color-room-selected: #cfe6f8;
  --color-room-selected-text: #17212b;
  --color-room-selected-meta: #46708f;
  --color-scrollbar: #bcc8d3;
  --shadow-bubble: 0 1px 1px #1f293719;
  --shadow-overlay: 0 12px 32px #0f172a2b;
  --shadow-floating: 0 4px 16px #0f172a33;
  --radius-control: 8px;
  --radius-action: 12px;
  --radius-action-filled: 22px;
  --radius-bubble: 14px;
  --radius-overlay: 12px;
  --radius-composer: 24px;
  --size-action-button: 36px;
  --space-action-button-inline: 9px;
  --font-size-action-button: 12px;
  --font-weight-action-button: 700;
  --size-inline-action-button: 30px;
  --space-inline-action-button-inline: 8px;
  --font-size-inline-action-button: 11px;
  --size-control-min: 44px;
  --size-input-prominent: 48px;
  --size-composer-attachment: 40px;
  --size-composer-send: 40px;
  --size-composer-language: 104px;
  --size-composer-control: 40px;
  --size-toolbar-icon: 40px;
  --size-search-compact: 40px;
  --duration-fast: 120ms;
  --duration-standard: 180ms;
  --ease-product: ease-out;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --color-page: #0e1621;
    --color-chat-page: #0e1621;
    --color-reaction-surface: #0e1621;
    --color-surface-header: #17212b;
    --color-surface-sidebar: #17212b;
    --color-surface-primary: #17212b;
    --color-surface-secondary: #202b36;
    --color-surface-tertiary: #253544;
    --color-surface-overlay: #1d2a36;
    --color-surface-scrim: #02070db8;
    --color-surface-hover: #202f3d;
    --color-surface-pressed: #263949;
    --color-surface-selected: #2b5278;
    --color-chat-inbound: #182533;
    --color-chat-outbound: #2b5278;
    --color-chat-reply-inbound: #12202d;
    --color-chat-reply-outbound: #244766;
    --color-action-primary: #3390ec;
    --color-action-primary-hover: #49a0f2;
    --color-action-primary-pressed: #3390ec;
    --color-action-primary-text: #17212b;
    --color-action-secondary: #253544;
    --color-action-secondary-hover: #304354;
    --color-action-secondary-pressed: #1e2d3b;
    --color-action-secondary-text: #e5edf5;
    --color-action-disabled: #22303c;
    --color-action-disabled-text: #71808e;
    --color-border-subtle: #263746;
    --color-border-strong: #3a4b59;
    --color-border-focus: #6ab2f7;
    --color-text-primary: #f5f7fa;
    --color-text-secondary: #a8b5c2;
    --color-text-tertiary: #7f91a3;
    --color-text-inverse: #ffffff;
    --color-text-link: #6ab2f7;
    --color-feedback-positive: #64c88b;
    --color-feedback-positive-surface: #173a2a;
    --color-feedback-positive-border: #3f825e;
    --color-feedback-negative: #ff8f9a;
    --color-feedback-negative-surface: #3b2329;
    --color-feedback-negative-border: #8b4a55;
    --color-feedback-progress: #6ab2f7;
    --color-feedback-progress-surface: #18364d;
    --color-feedback-progress-border: #3f7298;
    --color-feedback-warning: #ffd36a;
    --color-feedback-warning-surface: #3a311b;
    --color-feedback-warning-border: #7e6933;
    --color-unread: #3390ec;
    --color-room-avatar-0: #3390ec;
    --color-room-avatar-1: #32c9b9;
    --color-room-avatar-2: #f49b46;
    --color-room-avatar-3: #8b6eef;
    --color-room-avatar-4: #e86a7b;
    --color-room-avatar-5: #3dab8d;
    --color-unread-selected-text: #0878c9;
    --color-room-selected: #23496d;
    --color-room-selected-text: #ffffff;
    --color-room-selected-meta: #d3e7f7;
    --color-scrollbar: #415463;
    --shadow-bubble: 0 1px 2px #00000042;
    --shadow-overlay: 0 16px 42px #00000066;
    --shadow-floating: 0 6px 18px #00000059;
  }
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  background: var(--color-page);
}

body {
  color: var(--color-text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
  font-size: 14px;
  line-height: 1.4;
}

::selection {
  color: var(--color-text-inverse);
  background: var(--color-action-primary);
}

* {
  scrollbar-color: var(--color-scrollbar) transparent;
  scrollbar-width: thin;
}

button,
input,
select,
textarea,
#photoPicker,
.photo-viewer-download {
  transition:
    color var(--duration-fast) var(--ease-product),
    background-color var(--duration-fast) var(--ease-product),
    border-color var(--duration-fast) var(--ease-product),
    box-shadow var(--duration-fast) var(--ease-product);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
#photoPicker:focus-within {
  outline: 3px solid var(--color-border-focus);
  outline-offset: 2px;
}

button {
  min-height: var(--size-action-button);
  padding: 0 var(--space-action-button-inline);
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  color: var(--color-action-primary-text);
  background: var(--color-action-primary);
  font-size: var(--font-size-action-button);
  font-weight: var(--font-weight-action-button);
  line-height: 1;
}

button:hover:not(:disabled) {
  background: var(--color-action-primary-hover);
}

button:active:not(:disabled) {
  background: var(--color-action-primary-pressed);
}

button:disabled {
  border-color: var(--color-border-subtle);
  color: var(--color-action-disabled-text);
  background: var(--color-action-disabled);
  opacity: 1;
  cursor: not-allowed;
}

input,
select,
textarea {
  border-color: var(--color-border-strong);
  border-radius: var(--radius-control);
  color: var(--color-text-primary);
  background: var(--color-surface-primary);
}

input:not(:where([type="checkbox"], [type="radio"], [type="file"])),
select {
  min-height: var(--size-control-min);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-text-tertiary);
}

header {
  height: 52px;
  padding: 0 16px;
  border-bottom-color: var(--color-border-subtle);
  background: var(--color-surface-header);
}

header strong {
  color: var(--color-text-primary);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.status {
  color: var(--color-feedback-positive);
  font-size: 12px;
  font-weight: 650;
}

.session-user {
  color: var(--color-text-secondary);
  font-size: 12px;
}

.back-to-rooms,
#searchButton,
.original-toggle,
.message-reply-button,
.album-download,
.photo-viewer button,
.photo-viewer-download,
.cancel,
.initial-password-logout,
.onboarding-skip,
.onboarding-previous {
  border-color: var(--color-border-strong);
  color: var(--color-action-secondary-text);
  background: var(--color-action-secondary);
}

.back-to-rooms,
#enableCollection,
#searchButton,
#enableSelectedCollection {
  min-height: var(--size-action-button);
  padding: 0 var(--space-action-button-inline);
  font-size: var(--font-size-action-button);
  font-weight: var(--font-weight-action-button);
  line-height: 1;
}

.back-to-rooms:hover:not(:disabled),
#searchButton:hover:not(:disabled),
.original-toggle:hover:not(:disabled),
.message-reply-button:hover:not(:disabled),
.album-download:hover,
.photo-viewer button:hover:not(:disabled),
.photo-viewer-download:hover,
.cancel:hover:not(:disabled),
.initial-password-logout:hover:not(:disabled),
.onboarding-skip:hover:not(:disabled),
.onboarding-previous:hover:not(:disabled) {
  color: var(--color-action-secondary-text);
  background: var(--color-action-secondary-hover);
}

main {
  --sidebar-width: 340px;
  grid-template-columns: var(--sidebar-width) 6px minmax(0, 1fr);
  height: calc(100dvh - 52px);
  background: var(--color-reaction-surface);
}

aside {
  display: flex;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  border-right: 0;
  background: var(--color-surface-sidebar);
}

.sidebar-resizer {
  position: relative;
  z-index: 5;
  width: 6px;
  min-width: 6px;
  cursor: col-resize;
  touch-action: none;
  background: var(--color-surface-sidebar);
}

.sidebar-resizer::before {
  position: absolute;
  inset: 0 2px;
  background: var(--color-border-subtle);
  content: "";
  transition: background-color 120ms ease;
}

.sidebar-resizer:hover::before,
.sidebar-resizer:focus-visible::before,
body.sidebar-resizing .sidebar-resizer::before {
  background: var(--color-text-link);
}

.sidebar-resizer:focus-visible {
  outline: 0;
}

body.sidebar-resizing {
  cursor: col-resize;
  user-select: none;
}

.main-panel {
  display: grid;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.main-panel > section {
  grid-area: 1 / 1;
}

#chatPanel[hidden],
#settingsEmptyPanel[hidden],
#profilePanel[hidden],
#userManagementPanel[hidden] {
  display: none !important;
}

.sidebar-panel,
.settings-panel {
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
}

.sidebar-panel.rooms-loading {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-panel.rooms-loading #rooms {
  display: grid;
  min-height: 0;
  flex: 1 1 auto;
  place-items: center;
}

.settings-panel {
  padding: 14px 10px;
  background: var(--color-surface-sidebar);
}

.settings-heading {
  padding: 4px 6px 14px;
}

.settings-heading h2 {
  margin: 0;
  color: var(--color-text-primary);
  font-size: 18px;
}

.settings-section-title {
  margin: 10px 6px 6px;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 650;
}

.settings-profile-item {
  display: grid;
  width: 100%;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-control);
  color: var(--color-text-primary);
  background: var(--color-surface-secondary);
  text-align: left;
}

.settings-profile-item:hover:not(:disabled),
.settings-profile-item[aria-current="page"] {
  background: var(--color-surface-hover);
}

.settings-utility-action {
  display: flex;
  width: 100%;
  min-height: var(--size-search-compact);
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-control);
  color: var(--color-text-primary);
  background: transparent;
  font-size: 13px;
  text-align: left;
}

/* Override the legacy header-ID rules after these controls move into Settings. */
#settingsPanel .settings-utility-action {
  padding: 0 10px;
  color: var(--color-text-secondary);
  background: transparent;
  font-size: 13px;
}

.settings-utility-action::after {
  color: var(--color-text-tertiary);
  content: "›";
  font-size: 20px;
  font-weight: 400;
}

#settingsPanel .settings-utility-action:hover:not(:disabled) {
  color: var(--color-text-primary);
  background: var(--color-surface-hover);
}

#settingsPanel .settings-utility-action:active:not(:disabled) {
  background: var(--color-surface-pressed);
}

#settingsPanel .settings-utility-action[aria-current="page"] {
  color: var(--color-text-primary);
  background: var(--color-surface-selected);
}

#settingsPanel .settings-utility-action.destructive {
  color: var(--color-feedback-negative);
}

.settings-profile-avatar {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  color: var(--color-text-inverse);
  background: var(--color-action-primary);
  font-size: 13px;
  font-weight: 750;
}

.settings-profile-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.settings-profile-copy strong {
  overflow: hidden;
  margin: 0;
  color: var(--color-text-primary);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-profile-copy small {
  overflow: hidden;
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-profile-status {
  white-space: nowrap;
}

.settings-chevron {
  color: var(--color-text-tertiary);
  font-size: 25px;
  line-height: 1;
}

.sidebar-bottom-tabs {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--color-border-subtle);
  background: var(--color-surface-sidebar);
}

.sidebar-bottom-tab {
  display: grid;
  min-height: 52px;
  place-items: center;
  border: 0;
  border-radius: 0;
  color: var(--color-text-secondary);
  background: transparent;
}

.sidebar-bottom-tab svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.sidebar-bottom-tab .chat-bubble-shape {
  fill: currentColor;
  stroke: none;
}

.sidebar-bottom-tab .chat-bubble-dot {
  fill: var(--color-surface-sidebar);
  stroke: none;
}

.sidebar-bottom-tab.active {
  color: var(--color-text-link);
  background: var(--color-surface-secondary);
}

.sidebar-bottom-tab:hover:not(:disabled) {
  color: var(--color-text-primary);
  background: var(--color-surface-hover);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.settings-empty-panel,
.profile-panel,
.user-management-panel {
  min-width: 0;
  background: var(--color-chat-page);
}

.settings-empty-panel {
  display: grid;
  place-items: center;
  color: var(--color-text-secondary);
}

.settings-empty-panel p {
  font-size: 17px;
  font-weight: 650;
}

.profile-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: auto;
}

.user-management-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: auto;
}

.profile-toolbar {
  display: grid;
  grid-template-columns: var(--size-control-min) minmax(0, 1fr) var(--size-control-min);
  align-items: center;
  min-height: 54px;
  padding: 0 14px;
  border-bottom: 1px solid var(--color-border-subtle);
  background: var(--color-surface-sidebar);
}

.profile-toolbar h1 {
  margin: 0;
  color: var(--color-text-primary);
  font-size: 17px;
  text-align: center;
}

.profile-toolbar button {
  width: var(--size-control-min);
  min-width: var(--size-control-min);
  height: var(--size-control-min);
  min-height: var(--size-control-min);
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--color-text-primary);
  background: transparent;
  line-height: 1;
}

.profile-toolbar button:hover:not(:disabled) {
  background: var(--color-surface-hover);
}

.profile-toolbar button svg,
.back-to-rooms svg,
#searchButton svg,
.global-search-trigger svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.profile-content {
  width: min(100%, 620px);
  margin: 0 auto;
  padding: 22px 18px 36px;
}

.user-management-content {
  width: 100%;
  margin: 0;
  padding: 16px 16px 28px;
}

.user-management-notice {
  margin: 0 0 12px;
  padding: 11px 12px;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-control);
  color: var(--color-text-secondary);
  background: var(--color-surface-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.user-management-list {
  display: grid;
  gap: 10px;
}

.user-management-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 24px;
  row-gap: 10px;
  padding: 12px;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-control);
  background: var(--color-surface-sidebar);
}

.user-management-identity {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.user-management-name-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.user-management-name-line strong {
  overflow: hidden;
  color: var(--color-text-primary);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-management-login {
  overflow: hidden;
  color: var(--color-text-secondary);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-management-last-seen {
  overflow: hidden;
  color: var(--color-text-secondary);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role-badge {
  flex: 0 0 auto;
  padding: 3px 6px;
  border-radius: 999px;
  color: var(--color-text-link);
  background: var(--color-surface-hover);
  font-size: 11px;
  font-weight: 700;
}

.user-role-badge.admin {
  color: var(--color-feedback-positive);
}

.user-role-badge.viewer {
  color: var(--color-text-secondary);
}

.viewer-readonly-label {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--color-text-secondary);
  background: var(--color-surface-hover);
  font-size: 11px;
  font-weight: 800;
}

body.viewer-readonly #replyForm {
  display: none;
}

body.viewer-readonly #profileNameForm {
  display: none;
}

.user-presence {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--color-text-secondary);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.user-presence::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-text-secondary);
  content: "";
}

.user-presence.online {
  color: var(--color-feedback-positive);
}

.user-presence.online::before {
  background: var(--color-feedback-positive);
}

.user-management-actions {
  display: grid;
  grid-template-columns: auto auto auto auto;
  align-items: center;
  justify-items: end;
  gap: 7px;
}

.user-management-actions button,
.user-management-role-select {
  min-height: var(--size-action-button);
  padding: 0 var(--space-action-button-inline);
  font-size: var(--font-size-action-button);
  white-space: nowrap;
}

.user-management-role-select {
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-control);
  color: var(--color-text-primary);
  background: var(--color-surface-sidebar);
}

.user-reset-status {
  grid-column: 1 / -1;
}

.user-management-self,
.user-management-empty {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 13px;
}

.profile-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  margin: 0;
  padding: 0 4px 24px;
  border: 0;
  border-bottom: 1px solid var(--color-border-subtle);
  border-radius: 0;
  background: transparent;
}

.profile-form + .profile-form {
  margin-top: 22px;
  padding-top: 4px;
}

.profile-form h2 {
  margin: 0;
  color: var(--color-text-primary);
  font-size: 15px;
}

.profile-form label {
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 650;
}

.profile-form input {
  width: 100%;
}

.profile-form button {
  min-width: 96px;
  min-height: var(--size-control-min);
  justify-self: end;
  margin-top: 8px;
  padding-inline: 20px;
  border: 0;
  border-radius: var(--radius-action-filled);
  box-shadow: none;
  font-weight: var(--font-weight-action-button);
  letter-spacing: 0.02em;
}

.profile-form button:hover:not(:disabled) {
  background: var(--color-action-primary-hover);
  box-shadow: var(--shadow-bubble);
}

.profile-form button:active:not(:disabled) {
  background: var(--color-action-primary-pressed);
  box-shadow: none;
}

.profile-status {
  min-height: 0;
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 13px;
}

.profile-status:empty {
  display: none;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 4;
  gap: 0;
  padding: 0 12px;
  border-bottom-color: var(--color-border-subtle);
  background: var(--color-surface-sidebar);
}

.tab {
  position: relative;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  border: 0;
  border-radius: 0;
  color: var(--color-text-secondary);
  background: transparent;
  font-size: 13px;
  font-weight: 650;
}

.tab-count {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  color: var(--color-action-primary-text);
  background: var(--color-action-primary);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.tab-count[hidden] {
  display: none;
}

.tab:hover:not(:disabled) {
  color: var(--color-text-primary);
  background: var(--color-surface-hover);
}

.tab.active {
  color: var(--color-text-link);
  background: transparent;
}

.tab.active::after {
  position: absolute;
  right: 10px;
  bottom: -1px;
  left: 10px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--color-action-primary);
  content: "";
}

.pending-collection-actions {
  min-height: 46px;
  padding: 6px 12px;
  border-bottom-color: var(--color-border-subtle);
  background: var(--color-surface-secondary);
}

.pending-collection-select {
  color: var(--color-text-primary);
}

.pending-collection-select input,
.room-select input {
  accent-color: var(--color-action-primary);
}

.pending-collection-count {
  color: var(--color-text-secondary);
}

.global-search {
  padding: 4px 12px;
  border-bottom-color: var(--color-border-subtle);
  background: var(--color-surface-sidebar);
}

.global-search-row {
  gap: 7px;
}

.global-search-field {
  position: relative;
  display: flex;
  width: 100%;
  align-items: center;
}

.global-search-field > svg {
  position: absolute;
  left: 12px;
  z-index: 1;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--color-text-secondary);
  stroke-linecap: round;
  stroke-width: 1.8;
}

.global-search input {
  height: var(--size-search-compact);
  min-height: var(--size-search-compact);
  padding: 0 42px 0 38px;
  border: 1px solid var(--color-border-subtle);
  border-radius: calc(var(--size-control-min) / 2);
  color: var(--color-text-secondary);
  background: var(--color-surface-secondary);
  font-size: 13px;
}

.global-search input:hover {
  color: var(--color-text-primary);
  background: var(--color-surface-hover);
}

.global-search input:focus {
  color: var(--color-text-primary);
  background: var(--color-surface-primary);
}

.global-search-field .global-search-close {
  position: absolute;
  right: 0;
  width: var(--size-search-compact);
  min-width: var(--size-search-compact);
  height: var(--size-search-compact);
  min-height: var(--size-search-compact);
}

.global-search-close,
.message-search-clear {
  border-color: transparent;
  color: var(--color-text-secondary);
  background: var(--color-action-secondary);
}

.global-search-close:hover:not(:disabled),
.message-search-clear:hover:not(:disabled) {
  color: var(--color-text-primary);
  background: var(--color-action-secondary-hover);
}

.global-search-tabs {
  border-bottom-color: var(--color-border-subtle);
}

.global-search-tab {
  min-height: 40px;
  color: var(--color-text-secondary);
  background: transparent;
}

.global-search-tab:hover:not(:disabled) {
  color: var(--color-text-primary);
  background: transparent;
}

.global-search-tab.active {
  border-bottom-color: var(--color-action-primary);
  color: var(--color-text-link);
}

.global-search-result {
  min-height: 54px;
  border-radius: var(--radius-control);
  color: var(--color-text-primary);
  background: transparent;
}

.global-search-result:hover:not(:disabled) {
  background: var(--color-surface-hover);
}

.global-search-result-title {
  color: var(--color-text-primary);
}

.global-search-result-text,
.global-search-empty,
.empty {
  color: var(--color-text-secondary);
}

.global-search-highlight {
  padding: 0 2px;
  border-radius: 2px;
  color: var(--color-feedback-warning);
  background: var(--color-feedback-warning-surface);
  font-weight: 700;
}

.room-row {
  position: relative;
  min-height: 68px;
  border-bottom-color: var(--color-border-subtle);
  background: var(--color-surface-sidebar);
  transition: background-color var(--duration-fast) var(--ease-product);
}

.room-group-block {
  border-bottom-color: var(--color-border-subtle);
}

.room-group-block.grouped-room {
  background: var(--color-surface-secondary);
}

.room-group-block.grouped-room.expanded {
  margin: 4px 8px 10px;
  overflow: hidden;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-control);
  background: var(--color-surface-sidebar);
}

.room-group-block.grouped-room > .room-group {
  background: var(--color-surface-secondary);
}

.room-group-block.grouped-room.expanded > .room-group {
  border-bottom: 1px solid var(--color-border-subtle);
}

.room-group-block.grouped-room.has-active-topic > .room-group .room-group-name,
.room-group-block.grouped-room.has-active-topic > .room-group .room-group-icon {
  color: var(--color-text-link);
}

.room-group-topics {
  position: relative;
  padding-left: 34px;
  border-top: 0;
  background: var(--color-surface-primary);
}

.room-topic {
  border-top: 0;
  border-bottom: 1px solid var(--color-border-subtle);
  position: relative;
  border-radius: 0;
  background: var(--color-surface-primary);
}

.room-group-topics > .room-topic::before {
  position: absolute;
  top: 33px;
  left: -12px;
  width: 12px;
  height: 2px;
  background: var(--color-border-strong);
  content: "";
}

.room-group-topics > .room-topic::after {
  position: absolute;
  top: -1px;
  bottom: -1px;
  left: -12px;
  width: 2px;
  background: var(--color-border-strong);
  content: "";
}

.room-group-topics > .room-topic:last-child::after {
  bottom: auto;
  height: 34px;
}

.room-topic:last-child {
  border-bottom: 0;
}

.room-row:not(.active):hover {
  background: var(--color-surface-hover);
}

.room-row.active,
.room-row.active.search-result-target {
  background: var(--color-room-selected);
}

.room-row.sortable-chosen,
.room-sortable-fallback {
  background: var(--color-surface-pressed);
}

.room-sortable-fallback {
  border-color: var(--color-action-primary);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-floating);
}

.room {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 68px;
  padding: 11px 10px 10px 14px;
  border-radius: 0;
}

.room:hover:not(:disabled),
.room:active:not(:disabled) {
  background: transparent;
}

.room-title {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--color-text-primary);
  font-size: 14px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-group .room {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  min-height: 54px;
  align-items: center;
  gap: 6px;
  padding: 7px calc(var(--size-control-min) + 8px) 7px 12px;
}

.room-group {
  min-height: 54px;
}

.room-group.has-unread .room,
.room-group.has-drag-handle .room {
  padding-right: calc((var(--size-control-min) * 2) + 8px);
}

.room-group.has-drag-handle.has-unread .room {
  padding-right: calc((var(--size-control-min) * 3) + 8px);
}

.room-group > .room-pin,
.room-group > .room-drag-handle {
  top: 5px;
}

.room-group > .room-unread {
  top: 15px;
}

.room-group-type {
  padding: 3px 6px;
  border: 1px solid var(--color-border-strong);
  border-radius: 999px;
  color: var(--color-text-secondary);
  background: var(--color-surface-primary);
  font-size: 11px;
  font-weight: 750;
  line-height: 1;
  white-space: nowrap;
}

.room-group-name {
  min-width: 0;
  overflow: hidden;
  color: var(--color-text-primary);
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-group-count {
  flex: none;
  white-space: nowrap;
  padding: 2px 6px;
  border-radius: 999px;
  color: var(--color-text-secondary);
  background: var(--color-surface-tertiary);
  font-size: 11px;
}

.room-row.has-unread .room-title,
.room-row.has-pin .room-title {
  padding-right: calc(var(--size-control-min) + 4px);
}

.room-row.has-pin.has-unread .room-title,
.room-row.has-drag-handle .room-title {
  padding-right: calc((var(--size-control-min) * 2) + 4px);
}

.room-row.has-drag-handle.has-unread .room-title {
  padding-right: calc((var(--size-control-min) * 3) + 4px);
}

.room-last {
  display: flex;
  min-width: 0;
  gap: 6px;
  margin-top: 4px;
  color: var(--color-text-secondary);
  font-size: 12px;
}

.room-copy {
  display: block;
  min-width: 0;
  flex: 1 1 auto;
}

.room-list-avatar {
  display: inline-grid !important;
  width: 38px;
  height: 38px;
  min-width: 38px;
  flex: 0 0 38px !important;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  color: var(--color-text-inverse);
  font-size: 17px;
  font-weight: 750;
  line-height: 1;
  text-align: center;
  vertical-align: middle;
}

.room-list-avatar-0 { background: var(--color-room-avatar-0); }
.room-list-avatar-1 { background: var(--color-room-avatar-1); }
.room-list-avatar-2 { background: var(--color-room-avatar-2); }
.room-list-avatar-3 { background: var(--color-room-avatar-3); }
.room-list-avatar-4 { background: var(--color-room-avatar-4); }
.room-list-avatar-5 { background: var(--color-room-avatar-5); }

.room-list-avatar-topic {
  width: 28px;
  height: 28px;
  min-width: 28px;
  flex: 0 0 28px !important;
  font-size: 13px;
}

.room-topic .room {
  min-height: 64px;
  padding: 9px 8px 8px 10px;
}

.room-topic .room-title {
  font-size: 15px;
}

.room-topic .room-last {
  font-size: 13px;
}

.room-topic-label {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 4px;
  color: var(--color-text-link);
}

.room-topic-prefix {
  flex: 0 0 auto;
  font-weight: 800;
}

.room-preview {
  flex: 1 1 auto;
  min-width: 0;
}

.room-meta {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.room-time {
  margin-left: 0;
  color: var(--color-text-tertiary);
  font-variant-numeric: tabular-nums;
}

.room-unread {
  flex: 0 0 auto;
  display: inline-flex;
  box-sizing: border-box;
  min-width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  border-radius: 999px;
  color: var(--color-text-inverse);
  background: var(--color-unread);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}

.room-row.active .room-title,
.room-row.active .room-last,
.room-row.active .room-time {
  color: var(--color-room-selected-text);
}

.room-row.active .room-last,
.room-row.active .room-time {
  color: var(--color-room-selected-meta);
}

.room-row.active .room-unread {
  color: var(--color-unread-selected-text);
  background: var(--color-text-inverse);
}

.room-pin,
.room-drag-handle,
.room-select {
  flex-basis: var(--size-control-min);
  min-width: var(--size-control-min);
  min-height: var(--size-control-min);
  color: var(--color-text-tertiary);
  background: transparent;
}

.room-row > .room-pin,
.room-row > .room-drag-handle,
.room-row > .room-unread {
  position: absolute;
  z-index: 1;
}

.room-row > .room-pin,
.room-row > .room-drag-handle {
  top: 0;
}

.room-row > .room-unread {
  top: 10px;
  right: calc(var(--size-control-min) + 8px);
}

.room-row > .room-pin {
  right: 0;
}

.room-row > .room-drag-handle {
  right: var(--size-control-min);
}

.room-row.has-unread > .room-drag-handle {
  right: calc((var(--size-control-min) * 2) + 4px);
}

.room-pin:hover:not(:disabled) {
  color: var(--color-action-primary);
  background: var(--color-surface-hover);
}

.room-row.pinned .room-pin {
  color: var(--color-action-primary);
}

.room-row.active .room-pin,
.room-row.active .room-pin:hover,
.room-row.active .room-drag-handle,
.room-row.active .room-select {
  color: var(--color-room-selected-text);
  background: transparent;
}

#rooms.room-list-filtered .room-drag-handle {
  display: none;
}

.room-divider {
  padding: 8px 14px;
  color: var(--color-text-tertiary);
  background: transparent;
}

.room-divider::before,
.room-divider::after {
  background: var(--color-border-subtle);
}

.my-notifications-block {
  padding: 8px 8px 4px;
  border-bottom: 1px solid var(--color-border-subtle);
  background: var(--color-surface-primary);
}

.bot-conversations-block {
  padding: 4px 8px 8px;
  border-bottom: 1px solid var(--color-border-subtle);
  background: var(--color-surface-primary);
}

.my-notifications-room,
.bot-conversations-room {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 64px;
  align-items: center;
  gap: 11px;
  padding: 9px 48px 9px 11px;
  border: 1px solid var(--color-feedback-progress-border);
  border-radius: var(--radius-action);
  color: var(--color-text-primary);
  background: var(--color-feedback-progress-surface);
  text-align: left;
}

.my-notifications-room:hover:not(:disabled),
.my-notifications-room.active,
.bot-conversations-room:hover:not(:disabled),
.bot-conversations-room.active {
  border-color: var(--color-action-primary);
  background: var(--color-surface-selected);
}

.my-notifications-icon,
.bot-conversations-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 50%;
  color: var(--color-text-inverse);
  background: var(--color-action-primary);
  font-size: 18px;
}

.bot-conversations-icon {
  background: var(--color-feedback-positive);
}

.my-notifications-room .room-unread {
  position: absolute;
  top: 20px;
  right: 12px;
}

.my-notifications-room .room-preview,
.bot-conversations-room .room-preview {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

section {
  background: var(--color-chat-page);
}

.detail {
  min-height: 48px;
  gap: 8px;
  padding: 3px 14px;
  border-bottom-color: var(--color-border-subtle);
  background: var(--color-surface-header);
}

.detail-title {
  min-width: 0;
  overflow: hidden;
  color: var(--color-text-primary);
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail select {
  min-height: 40px;
  background: var(--color-surface-secondary);
}

.detail button {
  min-height: var(--size-action-button);
}

.back-to-rooms,
#searchButton {
  display: grid;
  width: var(--size-toolbar-icon);
  min-width: var(--size-toolbar-icon);
  height: var(--size-toolbar-icon);
  min-height: var(--size-toolbar-icon);
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--color-text-primary);
  background: transparent;
}

.back-to-rooms:hover:not(:disabled),
#searchButton:hover:not(:disabled) {
  color: var(--color-text-primary);
  background: var(--color-surface-hover);
}

.search-panel {
  padding: 4px 14px;
  border-bottom-color: var(--color-border-subtle);
  background: var(--color-surface-primary);
}

.search-panel input {
  height: var(--size-control-min);
  min-height: var(--size-control-min);
  border-radius: calc(var(--size-control-min) / 2);
  border-color: var(--color-border-subtle);
  background: var(--color-surface-secondary);
}

.search-results {
  border-top-color: var(--color-border-subtle);
}

.search-result {
  min-height: 58px;
  border-bottom-color: var(--color-border-subtle);
  color: var(--color-text-primary);
  background: transparent;
}

.search-result:hover:not(:disabled) {
  background: var(--color-surface-hover);
}

.search-result-room,
.search-result-meta {
  color: var(--color-text-link);
}

.search-result-text {
  color: var(--color-text-primary);
}

.search-empty {
  color: var(--color-text-secondary);
}

#messages {
  padding: 18px clamp(12px, 3vw, 34px);
  background: var(--color-chat-page);
  scroll-padding-block: 18px;
}

.message-placeholder {
  color: var(--color-text-secondary);
  font-size: 17px;
  font-weight: 600;
}

.room-loading {
  display: flex;
  min-height: 100%;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: var(--color-text-secondary);
  text-align: center;
}

.room-loading-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid var(--color-surface-tertiary);
  border-top-color: var(--color-feedback-progress);
  border-radius: 50%;
  animation: send-spin 0.8s linear infinite;
}

.room-loading strong {
  font-size: 17px;
  font-weight: 650;
}

.room-list-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  padding: 24px;
  color: var(--color-text-secondary);
  text-align: center;
}

.room-list-loading .room-loading-spinner {
  width: 24px;
  height: 24px;
  border-width: 2px;
}

.room-list-loading strong {
  font-size: 13px;
  font-weight: 650;
}

.message-day-divider,
.message-unread-divider {
  margin: 4px auto 14px;
  color: var(--color-text-secondary);
}

.message-day-divider::before,
.message-day-divider::after,
.message-unread-divider::before,
.message-unread-divider::after {
  background: var(--color-border-strong);
}

.message-day-divider span {
  padding: 2px 6px;
  color: var(--color-text-secondary);
  background: transparent;
  box-shadow: none;
}

.message-unread-divider {
  color: var(--color-action-primary);
}

.message-unread-divider::before,
.message-unread-divider::after {
  background: var(--color-action-primary);
}

.message-unread-divider span {
  background: var(--color-chat-page);
}

.message {
  gap: 8px;
  margin-bottom: 10px;
}

.message.outbound {
  flex-direction: row-reverse;
}

.message-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  max-width: min(680px, 72%);
}

.message.outbound .message-content {
  align-items: flex-end;
}

.message.outbound .message-reactions,
.message.outbound .message-reaction-panel-row {
  justify-content: flex-end;
}

.avatar {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
  box-shadow: none;
}

.bubble {
  position: relative;
  max-width: 100%;
  padding: 8px 11px 7px;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-bubble) var(--radius-bubble) var(--radius-bubble) 4px;
  color: var(--color-text-primary);
  background: var(--color-chat-inbound);
  box-shadow: var(--shadow-bubble);
}

.message.inbound .bubble::before,
.message.outbound .bubble::before {
  position: absolute;
  bottom: -1px;
  width: 9px;
  height: 12px;
  background: var(--color-chat-inbound);
  content: "";
}

.message.inbound .bubble::before {
  left: -7px;
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.message.outbound .bubble::before {
  right: -7px;
  background: var(--color-chat-outbound);
  clip-path: polygon(0 0, 100% 100%, 0 100%);
}

.outbound .bubble {
  border-radius: var(--radius-bubble) var(--radius-bubble) 4px var(--radius-bubble);
  background: var(--color-chat-outbound);
}

.message-line {
  line-height: 1.42;
}

.sender-name,
.outbound .sender-name {
  color: var(--color-text-primary);
  font-size: 12px;
}

.content {
  font-size: 14px;
}

.content a,
.outbound .content a {
  color: var(--color-text-link);
}

.meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 5px;
  color: var(--color-text-secondary);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.original-toggle,
.message-reply-button,
.message-retry-button {
  flex: none;
  min-height: var(--size-inline-action-button);
  padding: 0 var(--space-inline-action-button-inline);
  border-radius: 6px;
  font-size: var(--font-size-inline-action-button);
  white-space: nowrap;
}

.original-toggle,
.message-reply-button {
  margin: 0 0 0 4px;
  border: 0;
  color: var(--color-text-link);
  background: transparent;
}

.original-toggle:hover:not(:disabled),
.message-reply-button:hover:not(:disabled) {
  color: var(--color-text-link);
  background: var(--color-surface-hover);
}

.original-content,
.reply-preview-text {
  color: var(--color-text-secondary);
}

.reply-preview {
  display: grid;
  border-left-color: var(--color-action-primary);
  background: var(--color-chat-reply-inbound);
  text-align: left;
}

.outbound .reply-preview {
  border-left-color: var(--color-action-primary);
  background: var(--color-chat-reply-outbound);
}

.reply-preview-label,
.outbound .reply-preview-label {
  color: var(--color-text-link);
}

.reply-preview.missing {
  border-left-color: var(--color-feedback-negative);
}

.message-reactions {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 4px;
  padding: 0 2px;
}

.message-reaction-chip,
.message-reaction-people,
.message-reaction-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border: 0;
  color: var(--color-action-secondary-text);
  background: var(--color-chat-page);
}

.message-reaction-chip {
  gap: 3px;
  min-width: 0;
  padding: 1px 3px;
  border-radius: 999px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.message-reaction-chip span {
  font-size: 12px;
}

.message-reaction-people,
.message-reaction-add {
  width: 24px;
  min-width: 24px;
  padding: 0;
  border-radius: 50%;
}

.message-reaction-people svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.9;
}

.message-reaction-add {
  font-size: 17px;
  font-weight: 400;
  line-height: 1;
}

.message-reaction-people:hover:not(:disabled),
.message-reaction-add:hover:not(:disabled) {
  color: var(--color-text-link);
  background: var(--color-action-secondary-hover);
}

.message-reaction-people-popover,
.message-reaction-menu {
  position: static;
  display: grid;
  gap: 5px;
  width: max-content;
  max-width: 100%;
  min-width: 0;
  margin-top: 2px;
  padding: 8px;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-control);
  color: var(--color-text-primary);
  background: var(--color-surface-header);
  box-shadow: var(--shadow-bubble);
  font-size: 12px;
}

.message-reaction-panel-row {
  display: flex;
  flex: 0 0 100%;
}

.message-reaction-people-popover {
  justify-items: start;
}

.message-reaction-menu {
  grid-template-columns: repeat(3, max-content);
  justify-items: start;
}

.message-reaction-people-popover[hidden],
.message-reaction-menu[hidden] {
  display: none;
}

.message-reaction-person-row {
  white-space: nowrap;
}

.message-reaction-menu button {
  min-height: 30px;
  padding: 4px 7px;
  border: 0;
  border-radius: 6px;
  color: var(--color-text-primary);
  background: transparent;
  text-align: left;
}

.message-reaction-menu button:hover:not(:disabled) {
  background: var(--color-surface-hover);
}

.message-retry-button,
.message-retry-button:hover:not(:disabled) {
  border-color: var(--color-feedback-negative-border);
  color: var(--color-feedback-negative);
  background: var(--color-feedback-negative-surface);
}

.message-notification-button {
  margin-left: 8px;
  padding: 4px 7px;
  border: 1px solid var(--color-feedback-progress-border);
  border-radius: 6px;
  color: var(--color-feedback-progress);
  background: var(--color-feedback-progress-surface);
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}

.message-notification-button:hover:not(:disabled) {
  border-color: var(--color-action-primary);
  color: var(--color-text-link);
  background: var(--color-surface-hover);
}

body.notification-open #replyForm,
body.notification-open .new-message-notice,
body.bot-conversations-open #replyForm,
body.bot-conversations-open .new-message-notice {
  display: none;
}

.internal-notifications {
  display: flex;
  min-height: 100%;
  width: min(720px, 100%);
  flex-direction: column;
  gap: 12px;
  margin: 0 auto;
}

.internal-notifications > :first-child,
.bot-conversations > :first-child {
  margin-top: auto;
}

.internal-notification {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-bubble);
  background: var(--color-surface-primary);
  box-shadow: var(--shadow-bubble);
}

.internal-notification.unread {
  border-left: 4px solid var(--color-action-primary);
  background: var(--color-feedback-progress-surface);
}

.internal-notification-heading,
.internal-notification-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.internal-notification-heading time {
  margin-left: auto;
  color: var(--color-text-tertiary);
  font-size: 12px;
}

.internal-notification-body {
  margin: 0;
  color: var(--color-text-primary);
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.internal-notification-source {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-left: 3px solid var(--color-action-primary);
  border-radius: var(--radius-control);
  background: var(--color-surface-secondary);
}

.internal-notification-source span {
  overflow: hidden;
  color: var(--color-text-secondary);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.internal-notification-actions {
  justify-content: flex-end;
}

.internal-notification-actions button {
  min-height: var(--size-action-button);
  padding: 7px 10px;
}

.internal-notification-read {
  color: var(--color-feedback-positive);
  font-size: 12px;
  font-weight: 700;
}

.bot-conversations {
  display: flex;
  min-height: 100%;
  width: min(760px, 100%);
  flex-direction: column;
  gap: 14px;
  margin: 0 auto;
}

.bot-conversation-entry {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-bubble);
  background: var(--color-surface-primary);
  box-shadow: var(--shadow-bubble);
}

.bot-conversation-entry.status-failed {
  border-left: 4px solid var(--color-feedback-negative);
}

.bot-conversation-entry.unread:not(.status-failed) {
  border-left: 4px solid var(--color-action-primary);
  background: var(--color-feedback-progress-surface);
}

.bot-conversation-heading,
.bot-conversation-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bot-conversation-heading time {
  margin-left: auto;
  color: var(--color-text-tertiary);
  font-size: 12px;
}

.bot-conversation-question,
.bot-conversation-answer {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 12px;
  border-radius: var(--radius-control);
}

.bot-conversation-question {
  border-left: 3px solid var(--color-action-primary);
  background: var(--color-surface-secondary);
}

.bot-conversation-answer {
  border-left: 3px solid var(--color-feedback-positive);
  background: var(--color-feedback-progress-surface);
}

.bot-conversation-question > span,
.bot-conversation-answer > span {
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 750;
}

.bot-conversation-question p,
.bot-conversation-answer p {
  margin: 0;
  color: var(--color-text-primary);
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.bot-conversation-actions {
  justify-content: flex-end;
}

.bot-conversation-actions button {
  min-height: var(--size-action-button);
  padding: 7px 10px;
}

.bot-conversation-sent {
  color: var(--color-feedback-positive);
  font-size: 12px;
  font-weight: 700;
}

.bot-conversation-read {
  color: var(--color-text-tertiary);
  font-size: 12px;
  font-weight: 700;
}

.bot-conversation-read.unread {
  color: var(--color-action-primary);
}

.bot-conversation-error {
  margin: 0 auto 0 0;
  color: var(--color-feedback-negative);
  font-size: 12px;
  line-height: 1.4;
}

.bot-conversation-empty-answer {
  color: var(--color-text-secondary) !important;
}

.failed,
.login-error,
.account-error,
.initial-password-error {
  color: var(--color-feedback-negative);
}

.album-sending {
  border-color: var(--color-feedback-progress-border);
  border-radius: var(--radius-control);
  color: var(--color-feedback-progress);
  background: var(--color-feedback-progress-surface);
}

.album-sending-progress {
  background: var(--color-surface-tertiary);
}

.album-sending-progress::after {
  background: var(--color-feedback-progress);
}

.message.search-result-target .bubble {
  outline-color: var(--color-action-primary);
}

.new-message-notice {
  color: var(--color-action-primary-text);
  background: var(--color-action-primary);
  box-shadow: var(--shadow-floating);
}

#replyForm {
  grid-template-columns: minmax(0, 1fr) var(--size-composer-language) var(--size-composer-attachment) var(--size-composer-send);
  align-items: end;
  gap: 7px;
  min-height: 52px;
  padding: 4px 12px calc(4px + env(safe-area-inset-bottom));
  border-top-color: var(--color-border-subtle);
  background: var(--color-surface-header);
}

#replyForm.drop-active {
  outline-color: var(--color-action-primary);
  background: var(--color-feedback-progress-surface);
}

#replyText {
  min-width: 0;
  width: 100%;
  height: var(--size-control-min);
  min-height: var(--size-control-min);
  max-height: 50dvh;
  overflow-y: hidden;
  padding: 10px 16px;
  border-color: var(--color-border-subtle);
  border-radius: var(--radius-composer);
  background: var(--color-surface-secondary);
  field-sizing: content;
  line-height: 1.35;
}

#replyText::placeholder {
  font-size: 14px;
  white-space: nowrap;
}

.composer-language {
  width: var(--size-composer-language);
  min-width: var(--size-composer-language);
  max-width: var(--size-composer-language);
  height: var(--size-composer-control);
  min-height: var(--size-composer-control);
  appearance: none;
  padding: 0 28px 0 10px;
  border-color: var(--color-border-strong);
  border-radius: var(--radius-control);
  color: var(--color-text-primary);
  background: var(--color-surface-secondary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23677d92' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.8'/%3E%3C/svg%3E") no-repeat right 10px center / 12px 8px;
  font-size: 12px;
}

.composer-language:disabled {
  color: var(--color-action-disabled-text);
  background: var(--color-action-disabled);
}

#photoPicker {
  position: relative;
  width: var(--size-composer-attachment);
  min-width: var(--size-composer-attachment);
  max-width: var(--size-composer-attachment);
  height: var(--size-composer-attachment);
  min-height: var(--size-composer-attachment);
  max-height: var(--size-composer-attachment);
  padding: 0;
  border-color: var(--color-border-strong);
  border-radius: 50%;
  color: var(--color-action-secondary-text);
  background: var(--color-action-secondary);
  font-size: 0;
  line-height: 0;
}

#photos {
  position: absolute;
  display: block;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  opacity: 0;
}

#replyForm:has(#photos:focus-visible) #photoPicker {
  outline: 3px solid var(--color-border-focus);
  outline-offset: 2px;
}

#photoPicker::before,
#photoPicker::after {
  position: absolute;
  width: 18px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  content: "";
}

#photoPicker::after {
  transform: rotate(90deg);
}

#photoPicker:hover {
  background: var(--color-action-secondary-hover);
}

#photoPicker:active {
  background: var(--color-action-secondary-pressed);
}

#photoPicker.selected {
  border-color: var(--color-action-primary);
  color: var(--color-action-primary);
  background: var(--color-feedback-progress-surface);
}

#photoPicker.disabled {
  border-color: var(--color-border-subtle);
  color: var(--color-action-disabled-text);
  background: var(--color-action-disabled);
  opacity: 1;
}

#send {
  width: var(--size-composer-send);
  min-width: var(--size-composer-send);
  max-width: var(--size-composer-send);
  height: var(--size-composer-send);
  min-height: var(--size-composer-send);
  max-height: var(--size-composer-send);
  padding: 0;
  border-radius: 50%;
  color: var(--color-text-inverse);
  background: var(--color-action-primary);
  font-size: 0;
  line-height: 0;
}

#send::before {
  display: block;
  width: 20px;
  height: 20px;
  margin: auto;
  background: currentColor;
  clip-path: polygon(4% 43%, 96% 4%, 66% 96%, 48% 60%, 4% 43%, 52% 48%);
  content: "";
}

#send:hover:not(:disabled) {
  background: var(--color-action-primary-hover);
}

#send:active:not(:disabled) {
  background: var(--color-action-primary-pressed);
}

#send:disabled {
  border-color: var(--color-border-subtle);
  color: var(--color-action-disabled-text);
  background: var(--color-action-disabled);
}

.composer-attachments,
.composer-reply-target {
  grid-column: 1 / -1;
}

.composer-attachments[hidden] {
  display: none;
}

.composer-attachments {
  gap: 6px;
}

.composer-attachment {
  min-height: 52px;
  padding-right: 52px;
  border-color: var(--color-border-subtle);
  border-radius: var(--radius-control);
  background: var(--color-surface-secondary);
}

.composer-file-icon {
  color: var(--color-action-primary-text);
  background: var(--color-action-primary);
}

.composer-file-name {
  color: var(--color-text-primary);
}

.composer-file-size {
  color: var(--color-text-secondary);
}

.composer-attachment-remove,
.composer-reply-cancel {
  width: var(--size-control-min);
  min-width: var(--size-control-min);
  height: var(--size-control-min);
  min-height: var(--size-control-min);
  padding: 0;
  border-radius: 50%;
  border-color: var(--color-border-strong);
  color: var(--color-action-secondary-text);
  background: var(--color-action-secondary);
}

.composer-reply-target {
  border-left-color: var(--color-action-primary);
  background: var(--color-feedback-progress-surface);
}

.composer-reply-label {
  color: var(--color-feedback-progress);
}

.composer-reply-text {
  color: var(--color-text-primary);
}

.attachment {
  border-color: var(--color-border-subtle);
  border-radius: var(--radius-control);
  background: var(--color-surface-secondary);
}

.attachment-more {
  color: var(--color-text-inverse);
  background: var(--color-surface-scrim);
}

.attachment-status,
.file-size {
  color: var(--color-text-secondary);
}

.album-download {
  color: var(--color-text-link);
  text-decoration: none;
}

.file-attachment {
  border-color: var(--color-border-subtle);
  border-radius: var(--radius-control);
  color: var(--color-text-primary);
  background: var(--color-surface-secondary);
}

.file-badge {
  color: var(--color-action-primary-text);
  background: var(--color-action-primary);
}

.file-download {
  color: var(--color-text-link);
}

.send-loading,
.error-dialog,
.confirm-dialog,
.account-dialog,
.notification-dialog,
.initial-password-dialog,
.photo-viewer {
  background: var(--color-surface-scrim);
  backdrop-filter: none;
}

.send-loading-card,
.error-dialog-card,
.confirm-dialog-card,
.account-card,
.notification-dialog-card,
.initial-password-card,
.onboarding-card,
.login-card {
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-overlay);
  color: var(--color-text-primary);
  background: var(--color-surface-overlay);
  box-shadow: var(--shadow-overlay);
}

.notification-dialog {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--color-surface-scrim);
}

.notification-dialog[hidden] {
  display: none;
}

.notification-dialog-card {
  width: min(440px, 100%);
  padding: 24px;
}

.notification-dialog-card h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.notification-source-preview {
  max-height: 84px;
  margin: 0 0 16px;
  overflow: auto;
  color: var(--color-text-secondary);
  font-size: 12px;
}

.notification-dialog-card form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
}

.notification-dialog-card label {
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.notification-dialog-card select,
.notification-dialog-card textarea {
  width: 100%;
  min-height: var(--size-control-min);
}

.notification-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.notification-dialog-actions button {
  min-height: var(--size-control-min);
}

.notification-dialog-actions .cancel {
  border-color: var(--color-border-strong);
  color: var(--color-action-secondary-text);
  background: var(--color-action-secondary);
}

.send-spinner {
  border-color: var(--color-surface-tertiary);
  border-top-color: var(--color-feedback-progress);
}

.send-loading-card strong,
.error-dialog-card strong,
.confirm-dialog-card strong,
.account-card h2,
.initial-password-card h2,
.onboarding-card h2,
.login-card h1 {
  color: var(--color-text-primary);
}

.send-loading-card span,
.error-dialog-card p,
.confirm-dialog-card p,
.account-card p,
.initial-password-card p,
.onboarding-card p,
.login-card p {
  color: var(--color-text-secondary);
}

.error-dialog-card {
  border-color: var(--color-feedback-negative-border);
}

.error-dialog-card strong {
  color: var(--color-feedback-negative);
}

.confirm-dialog-card {
  border-color: var(--color-feedback-progress-border);
}

.confirm-dialog-card strong {
  color: var(--color-feedback-progress);
}

.initial-password-card {
  border-color: var(--color-feedback-warning-border);
}

.initial-password-card h2 {
  color: var(--color-feedback-warning);
}

.confirm-dialog-actions .cancel,
.account-actions .cancel {
  border-color: var(--color-border-strong);
  color: var(--color-action-secondary-text);
  background: var(--color-action-secondary);
}

.confirm-photo-preview,
.confirm-file-preview {
  border-color: var(--color-border-subtle);
  background: var(--color-surface-secondary);
}

.confirm-file-preview {
  color: var(--color-text-primary);
}

.confirm-photo-more {
  color: var(--color-text-inverse);
  background: var(--color-surface-scrim);
}

.photo-viewer-card {
  color: var(--color-text-inverse);
}

.photo-viewer-image {
  border-radius: var(--radius-control);
}

.photo-viewer-count {
  color: var(--color-text-inverse);
}

.onboarding-dialog {
  background: transparent;
}

.onboarding-card {
  border-color: var(--color-feedback-positive-border);
}

.onboarding-progress {
  color: var(--color-feedback-positive);
}

.onboarding-step-copy {
  border-color: var(--color-border-subtle);
  border-radius: var(--radius-control);
  background: var(--color-surface-secondary);
}

.onboarding-step-copy strong {
  color: var(--color-text-primary);
}

.onboarding-step-copy span {
  color: var(--color-text-secondary);
}

.onboarding-actions {
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}

.onboarding-actions-right {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.onboarding-actions button {
  min-width: 72px;
  min-height: var(--size-control-min);
  padding-inline: 14px;
  border-radius: var(--radius-action);
}

#onboardingSkip {
  min-width: auto;
  border-color: transparent;
  color: var(--color-text-secondary);
  background: transparent;
}

#onboardingSkip:hover:not(:disabled) {
  color: var(--color-text-primary);
  background: var(--color-surface-hover);
}

#onboardingSkip:active:not(:disabled) {
  background: var(--color-surface-pressed);
}

#onboardingPrevious {
  border-color: var(--color-border-strong);
  color: var(--color-action-secondary-text);
  background: transparent;
}

#onboardingPrevious:hover:not(:disabled) {
  border-color: var(--color-border-focus);
  color: var(--color-text-primary);
  background: var(--color-surface-hover);
}

#onboardingPrevious:active:not(:disabled) {
  background: var(--color-surface-pressed);
}

#onboardingDone {
  padding-inline: 18px;
  box-shadow: inset 0 0 0 1px var(--color-action-primary-pressed);
}

.onboarding-highlight {
  outline-color: var(--color-feedback-positive);
  border-radius: var(--radius-control);
  box-shadow: 0 0 0 7px var(--color-feedback-positive-surface);
}

.onboarding-highlight::after {
  color: var(--color-text-inverse);
  background: var(--color-feedback-positive);
}

.login-screen {
  background: var(--color-page);
}

.login-card {
  width: min(360px, 100%);
  padding: 26px;
}

.login-card input,
.account-card input,
.account-card select,
.initial-password-card input {
  min-height: var(--size-input-prominent);
}

.error-dialog-actions button,
.confirm-dialog-actions button,
.account-actions button,
.onboarding-actions button {
  min-height: var(--size-control-min);
}

.global-search-close,
.message-search-clear,
.photo-viewer-close {
  width: var(--size-control-min);
  min-width: var(--size-control-min);
  height: var(--size-control-min);
  min-height: var(--size-control-min);
  padding: 0;
  border-radius: 50%;
}

.photo-viewer button {
  min-width: var(--size-control-min);
  min-height: var(--size-control-min);
}

@media (max-width: 1024px) and (min-width: 761px) {
  header {
    height: 44px;
    padding-inline: 12px;
  }

  header strong {
    font-size: 14px;
  }

  .session {
    gap: 6px;
  }

  main {
    height: calc(100dvh - 44px);
  }

  .tab {
    min-height: 42px;
  }

  .detail {
    min-height: 42px;
    padding-block: 2px;
  }

  .detail button {
    min-height: 38px;
  }
}

@media (max-width: 900px) and (min-width: 761px) {
  main {
    --sidebar-width: 300px;
  }

  .detail {
    padding-inline: 10px;
  }

}

@media (max-width: 760px) {
  header {
    height: 52px;
    padding: 0 10px 0 12px;
  }

  header strong {
    font-size: 13px;
  }

  main {
    height: calc(100dvh - 52px);
  }

  .sidebar-resizer {
    display: none;
  }

  .main-panel {
    height: 100%;
  }

  body.chat-open > header {
    display: none;
  }

  body.chat-open > main {
    height: 100dvh;
  }

  body.profile-open > header {
    display: none;
  }

  body.profile-open > main {
    height: 100dvh;
  }

  body.profile-open aside,
  body.profile-open #chatPanel,
  body.profile-open #settingsEmptyPanel {
    display: none;
  }

  body.profile-open #profilePanel,
  body.profile-open #userManagementPanel {
    display: grid;
    height: 100%;
  }

  .sidebar-bottom-tabs {
    min-height: calc(56px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
  }

  .sidebar-bottom-tab {
    min-height: 56px;
  }

  #replyForm {
    min-height: 56px;
    padding: 8px 9px calc(8px + env(safe-area-inset-bottom));
  }

  .settings-panel {
    padding: 16px 12px;
  }

  .profile-toolbar {
    min-height: 58px;
    padding-inline: 10px;
  }

  .profile-content {
    padding: 22px 12px calc(28px + env(safe-area-inset-bottom));
  }

  .user-management-content {
    padding: 12px 10px calc(20px + env(safe-area-inset-bottom));
  }

  .user-management-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .user-management-actions {
    grid-template-columns: 1fr;
  }

  .user-management-actions button,
  .user-management-role-select {
    width: 100%;
  }

  .tabs {
    padding-inline: 10px;
  }

  .room,
  .room-row {
    min-height: 68px;
  }

  .room {
    padding: 10px 8px 9px 12px;
  }

  .room-list-avatar {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .room-list-avatar-topic {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
  }

  .room-group-block.grouped-room.expanded {
    margin: 4px 6px 8px;
  }

  .room-group-topics {
    padding-left: 30px;
  }

  .room-group-topics > .room-topic::before {
    left: -10px;
    width: 10px;
  }

  .room-group-topics > .room-topic::after {
    left: -10px;
  }

  .room-pin,
  .room-select,
  .room-drag-handle {
    flex-basis: var(--size-control-min);
  }

  .detail {
    min-height: 44px;
    padding: 2px 10px;
  }

  #messages {
    padding: 12px 9px;
  }

  .message {
    gap: 6px;
    margin-bottom: 9px;
  }

  .avatar {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .bubble {
    max-width: calc(100% - 40px);
    padding: 8px 10px 7px;
  }

  .content {
    font-size: 14px;
  }

  .meta {
    flex-wrap: wrap;
    row-gap: 2px;
  }

  #replyForm {
    gap: 7px;
    padding: 6px 9px calc(6px + env(safe-area-inset-bottom));
  }

  .composer-language {
    --size-composer-language: 96px;
    font-size: 11px;
  }

  #replyText {
    font-size: 16px;
  }

  .new-message-notice {
    bottom: calc(56px + env(safe-area-inset-bottom));
  }

  .login-screen,
  .send-loading,
  .error-dialog,
  .confirm-dialog,
  .account-dialog,
  .notification-dialog,
  .initial-password-dialog {
    padding: 16px;
  }

  .login-card,
  .send-loading-card,
  .error-dialog-card,
  .confirm-dialog-card,
  .account-card,
  .notification-dialog-card,
  .initial-password-card,
  .onboarding-card {
    padding: 20px;
  }
}

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

  .send-spinner,
  .room-loading-spinner,
  .album-sending-progress::after,
  .onboarding-highlight,
  .message.search-result-target .bubble {
    animation: none !important;
  }
}
