:root {
  color-scheme: light;
  --bg: #f1f4f8;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --material: rgba(255, 255, 255, 0.92);
  --material-soft: rgba(246, 249, 252, 0.9);
  --surface-soft: #f6f8fb;
  --surface-card: #edf2f7;
  --surface-strong: #dfe7f1;
  --surface-dark: #1b2430;
  --surface-dark-elevated: #283443;
  --surface-dark-soft: #223040;
  --line: #e4ebf3;
  --line-strong: #cfd9e6;
  --text: #171b22;
  --body: #343a45;
  --muted: #7a828e;
  --muted-soft: #a9b1bc;
  --accent: #315fa8;
  --accent-dark: #244b88;
  --accent-soft: rgba(49, 95, 168, 0.12);
  --accent-faint: rgba(49, 95, 168, 0.07);
  --accent-gold: #c8ab63;
  --accent-gold-dark: #af934f;
  --danger: #c64545;
  --success: #5db872;
  --bubble-owner: #315fa8;
  --bubble-visitor: #c8ab63;
  --code: #1b2430;
  --on-primary: #ffffff;
  --on-dark: #f5f5f1;
  --on-dark-soft: #aeb3b4;
  --soft-dark: rgba(47, 70, 97, 0.16);
  --soft-dark-subtle: rgba(47, 70, 97, 0.10);
  --soft-light: rgba(255, 255, 255, 0.95);
  --shadow-soft: 0 18px 42px rgba(47, 70, 97, 0.13);
  --shadow-subtle: 0 10px 24px rgba(47, 70, 97, 0.10);
  --shadow-inset: inset 0 1px 3px rgba(47, 70, 97, 0.08), 0 1px 0 rgba(255, 255, 255, 0.9);
  --blur: blur(16px) saturate(1.04);
  --login-active-card-top: clamp(88px, 12svh, 112px);
  --font-display: "Noto Sans CJK SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", "Heiti SC", ui-sans-serif, system-ui, sans-serif;
  --font-ui: "Noto Sans CJK SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", "Heiti SC", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
}

body.app-fixed-mode,
body.chat-mode {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

html.chat-mode-root,
html.app-fixed-mode-root {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--tchat-keyboard);
}

#app {
  height: 100%;
}

body.app-fixed-mode #app,
body.chat-mode #app {
  position: fixed;
  right: 0;
  left: 0;
  overflow: hidden;
}

body.app-fixed-mode #app {
  top: var(--visual-viewport-top, 0px);
  height: var(--visual-viewport-height, 100dvh);
}

body.chat-mode #app {
  top: 0;
  height: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-primary);
  cursor: pointer;
  min-height: 40px;
  padding: 0 20px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  box-shadow: 0 10px 22px rgba(49, 95, 168, 0.20);
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease, color 160ms ease;
}

button:hover {
  background: var(--accent-dark);
  box-shadow: 0 8px 18px rgba(49, 95, 168, 0.22);
}

button:active {
  transform: translateY(1px);
  box-shadow: 0 4px 10px rgba(49, 95, 168, 0.18);
}

button.secondary {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 8px 18px rgba(47, 70, 97, 0.08);
}

button.secondary:hover {
  background: var(--panel-strong);
  border-color: var(--line-strong);
}

button.secondary.active {
  border-color: rgba(49, 95, 168, 0.35);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

button.danger {
  background: var(--danger);
  box-shadow: 0 10px 22px rgba(198, 69, 69, 0.18);
}

button.compact {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcfe;
  color: var(--text);
  padding: 10px 14px;
  box-shadow: inset 0 1px 2px rgba(47, 70, 97, 0.06), 0 8px 18px rgba(47, 70, 97, 0.06);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--panel-strong);
  box-shadow: inset 0 1px 2px rgba(47, 70, 97, 0.06), 0 0 0 3px rgba(49, 95, 168, 0.16);
}

textarea {
  min-height: 70px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.page {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.chat-page {
  width: 100vw;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  grid-template-rows: auto minmax(0, 1fr);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--material);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: 0 12px 30px rgba(47, 70, 97, 0.08);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.topbar-leading {
  display: flex;
  align-items: center;
  min-width: 0;
}

.chat-topbar {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) minmax(0, 2.2fr) minmax(72px, 1fr);
}

.chat-topbar .topbar-leading {
  justify-self: start;
}

.chat-topbar .topbar-actions {
  justify-self: end;
  flex-wrap: nowrap;
  min-width: 0;
}

.chat-topbar .brand {
  justify-items: center;
  min-width: 0;
  text-align: center;
}

.chat-topbar .brand > strong,
.chat-topbar .brand > .brand-subtitle {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand {
  display: grid;
  gap: 1px;
}

.brand strong {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.16;
  letter-spacing: 0;
}

.brand-title-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-count-toggle {
  display: inline;
  flex: 0 0 auto;
  min-width: 0;
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  color: inherit;
  font: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  vertical-align: baseline;
  margin-left: 0;
  box-shadow: none !important;
  transform: none;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.member-count-toggle:hover,
.member-count-toggle:focus,
.member-count-toggle:focus-visible {
  outline: 0;
  background: transparent !important;
  color: var(--accent-dark);
  text-decoration: none;
  opacity: 0.78;
  box-shadow: none !important;
}

.member-count-toggle:active {
  transform: none;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.32;
  letter-spacing: 0;
}

.chat-topbar .brand strong {
  position: relative;
  max-width: calc(100% - 54px);
  overflow: visible;
  font-size: 26px;
  line-height: 1.08;
}

.chat-topbar .brand-title-text {
  display: block;
  max-width: 100%;
}

.chat-topbar .member-count-toggle {
  position: absolute;
  left: 100%;
  top: 50%;
  margin-left: 8px;
  transform: translateY(-50%);
}

.chat-topbar .member-count-toggle:active {
  transform: translateY(-50%);
}

.chat-topbar .brand > .brand-subtitle {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
}

.home {
  width: min(760px, calc(100vw - 32px));
  margin: 28px auto;
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 18px;
}

.dashboard {
  width: min(1080px, calc(100vw - 32px));
}

.dashboard-page {
  width: 100vw;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.dashboard-page .topbar {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
}

.dashboard-page .brand {
  grid-column: 2;
  min-width: 0;
  justify-items: center;
  text-align: center;
}

.dashboard-page .brand strong {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.08;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-page .topbar-actions {
  grid-column: 3;
  justify-self: end;
  margin-left: 0;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: minmax(280px, 0.78fr) minmax(420px, 1.24fr) minmax(300px, 0.98fr);
  grid-template-rows: minmax(0, 1fr);
  align-content: stretch;
  align-items: stretch;
  gap: 18px;
  width: min(1360px, calc(100vw - 32px));
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  padding: 28px 0;
  overflow: hidden;
  overscroll-behavior: contain;
  scroll-padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

.usage-panel {
  grid-column: 1;
  grid-row: 1;
}

.dashboard-history-panel {
  grid-column: 3;
  grid-row: 1;
}

.create-room-panel {
  grid-column: 2;
  grid-row: 1;
}

.dashboard-shell > .panel {
  height: 100%;
  min-height: 0;
}

.user-shell-page {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.app-shell-main {
  width: min(980px, calc(100vw - 28px));
  min-height: 0;
  margin: 0 auto;
  padding: 22px 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.app-tab-panel {
  display: grid;
  gap: 14px;
  min-height: 100%;
}

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

.app-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 2px 0;
}

.app-section-heading h1 {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 28px;
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: 0;
}

.app-section-heading p {
  max-width: 58ch;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.app-search-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-strong);
  box-shadow: var(--shadow-subtle);
}

.app-search-field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.app-search-field input {
  min-height: 38px;
  border: 0;
  background: transparent;
  box-shadow: none;
  font: inherit;
}

.app-search-field input:focus {
  outline: none;
  box-shadow: none;
}

.app-list-scroll {
  min-height: 0;
  padding-bottom: 10px;
}

.create-group-card,
.settings-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel-strong);
  box-shadow: var(--shadow-soft);
}

.create-group-card h2,
.settings-card h2 {
  margin: 0;
  color: var(--text);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.16;
}

.create-group-card p,
.settings-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.settings-tab-panel {
  align-content: start;
}

.settings-tab-panel .usage-panel {
  gap: 16px;
}

.settings-tab-panel > .account-admin-panel {
  background: var(--surface-dark);
  box-shadow: var(--shadow-soft);
}

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

.contact-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 70px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel-strong);
  box-shadow: var(--shadow-subtle);
}

.contact-avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(228, 236, 246, 0.58)),
    #eaf1f8;
  color: var(--accent-strong);
  font-size: 20px;
  font-weight: 800;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 8px 18px rgba(47, 70, 97, 0.12);
}

.contact-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.contact-main strong {
  overflow: hidden;
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-main small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}

.group-member-picker {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(245, 249, 253, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.group-member-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.group-member-picker-header strong {
  color: var(--text);
  font-size: 14px;
}

.group-member-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
}

.group-member-option {
  display: grid;
  grid-template-columns: auto 32px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid rgba(210, 224, 239, 0.86);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.group-member-option input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.group-member-option .contact-avatar {
  width: 32px;
  height: 32px;
  font-size: 14px;
}

.app-tabbar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: min(980px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 10px 0 max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(216, 228, 241, 0.78);
  background: var(--material);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.app-tabbar button {
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  font-size: 13px;
  font-weight: 800;
}

.app-tabbar button.active {
  border-color: #d6e4f3;
  background: linear-gradient(180deg, #ffffff 0%, #eef5fc 100%);
  color: var(--accent-strong);
  box-shadow: 0 10px 20px rgba(47, 100, 174, 0.12);
}

.user-shell-page {
  background: #eef3f9;
}

.user-shell-page .topbar {
  min-height: 72px;
  border-bottom: 1px solid rgba(216, 228, 241, 0.72);
  background: rgba(255, 255, 255, 0.94);
}

.dashboard-circle-action {
  display: inline-grid;
  place-items: center;
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border: 1px solid #d7e4f2;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffffff, #f2f7fd);
  color: var(--text);
  font-size: 26px;
  font-weight: 500;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(47, 70, 97, 0.12);
}

.dashboard-circle-action[hidden] {
  display: none;
}

.app-search-field-compact {
  grid-template-columns: auto minmax(0, 1fr);
  min-height: 44px;
  margin: 2px 12px 8px;
  border: 0;
  border-radius: 10px;
  background: #e6ebf1;
  box-shadow: inset 0 1px 1px rgba(47, 70, 97, 0.04);
}

.app-search-field-compact span {
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
  color: #7f8793;
}

.app-search-field-compact input {
  min-height: 36px;
  color: var(--text);
  font-size: 16px;
}

.app-search-field-compact input::placeholder {
  color: #8c949f;
}

.user-shell-page .app-shell-main {
  width: min(720px, 100vw);
  padding: 14px 0 8px;
}

.user-shell-page .app-tab-panel {
  gap: 0;
}

.user-shell-page .app-tab-panel:not(.settings-tab-panel) {
  grid-template-rows: auto minmax(0, 1fr);
  align-content: stretch;
}

.user-shell-page .room-history,
.user-shell-page .contact-list {
  gap: 0;
  overflow: hidden;
  border-radius: 0;
  background: var(--panel);
}

.conversation-card-button,
.contact-card {
  min-height: 76px;
  border-width: 0 0 1px;
  border-color: rgba(223, 231, 241, 0.92);
  border-radius: 0;
  background: var(--panel);
  box-shadow: none;
}

.conversation-card-button:hover,
.conversation-card-button:focus-visible,
.contact-card:hover,
.contact-card:focus-visible {
  background: #f5f8fc;
  box-shadow: none;
}

.conversation-avatar,
.contact-avatar {
  overflow: hidden;
  border-radius: 12px;
  background: linear-gradient(135deg, #dce9f7, #ffffff 56%, #c7d9ee);
  color: var(--accent-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 6px 14px rgba(47, 70, 97, 0.10);
}

.conversation-avatar img,
.contact-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.conversation-title-row strong,
.contact-main strong {
  font-size: 17px;
  font-weight: 650;
}

.conversation-preview,
.conversation-meta,
.contact-main small {
  color: #7c8490;
  font-size: 14px;
  font-weight: 500;
}

.contact-card {
  grid-template-columns: 46px minmax(0, 1fr);
  width: 100%;
  padding: 12px 16px;
  color: var(--text);
  text-align: left;
}

.contact-card .contact-avatar {
  width: 46px;
  height: 46px;
  font-size: 18px;
}

.user-shell-page .room-card {
  min-height: 76px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border-width: 0 0 1px;
  border-color: rgba(223, 231, 241, 0.92);
  border-radius: 0;
  background: var(--panel);
  box-shadow: none;
}

.user-shell-page .room-card-main strong {
  font-size: 17px;
  font-weight: 650;
}

.user-shell-page .room-card-actions button {
  min-height: 34px;
  padding: 0 14px;
}

.dashboard-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(23, 27, 34, 0.36);
}

.dashboard-modal-backdrop[hidden],
.dashboard-modal[hidden] {
  display: none;
}

.dashboard-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 31;
  display: grid;
  gap: 14px;
  width: min(520px, calc(100vw - 28px));
  max-height: min(78dvh, 680px);
  padding: 18px;
  overflow-y: auto;
  border: 1px solid rgba(216, 228, 241, 0.94);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 60px rgba(47, 70, 97, 0.24);
  transform: translate(-50%, -50%);
}

.dashboard-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-modal-header strong {
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
}

.contact-profile-body,
.contact-profile-hero {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.contact-profile-avatar {
  width: 74px;
  height: 74px;
  border-radius: 20px;
  font-size: 28px;
}

.contact-profile-hero strong {
  color: var(--text);
  font-size: 24px;
  font-weight: 800;
}

.contact-profile-hero small {
  color: var(--muted);
  font-size: 14px;
}

.profile-settings-form {
  display: grid;
  gap: 12px;
}

.profile-settings-form > label,
.profile-name-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.profile-name-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.profile-name-field {
  min-width: 0;
}

.profile-settings-form input[type="text"] {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 14px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
}

.profile-settings-form .profile-name-field input[type="text"] {
  border-color: #303741;
  background: #24282e;
  color: var(--tchat-text);
  box-shadow: none;
}

.profile-settings-form .profile-name-field input[type="text"]::placeholder {
  color: #7f8894;
}

.profile-save-button {
  min-height: 44px;
  padding: 0 18px;
  white-space: nowrap;
}

.profile-avatar-preview {
  width: 56px;
  height: 56px;
  border-radius: 16px;
}

.dashboard-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 18;
  background: rgba(20, 20, 19, 0.34);
}

.dashboard-menu-backdrop[hidden],
.dashboard-menu-drawer[hidden] {
  display: none;
}

.dashboard-menu-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 20;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(520px, calc(100vw - 24px));
  height: 100vh;
  border-left: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: -16px 0 42px rgba(20, 20, 19, 0.14);
}

.dashboard-menu-drawer {
  grid-template-rows: auto minmax(0, 1fr);
  inset: 76px 24px auto auto;
  width: min(360px, calc(100vw - 24px));
  height: auto;
  max-height: min(72vh, 680px);
  overflow: hidden;
  border: 1px solid rgba(250, 249, 245, 0.08);
  border-radius: 22px;
  background: var(--surface-dark);
  color: var(--on-dark);
  border-left-color: rgba(250, 249, 245, 0.08);
}

.dashboard-menu-drawer .history-drawer-header {
  border-bottom-color: rgba(250, 249, 245, 0.08);
  background: var(--surface-dark-elevated);
}

.dashboard-menu-drawer .history-drawer-header strong {
  color: var(--on-dark);
}

.dashboard-menu-drawer .history-drawer-header button.secondary,
.dashboard-menu-drawer button.secondary {
  border-color: rgba(250, 249, 245, 0.12);
  background: var(--surface-dark-elevated);
  color: var(--on-dark);
}

.dashboard-menu-drawer .history-drawer-header button.secondary:hover,
.dashboard-menu-drawer button.secondary:hover {
  background: var(--surface-dark-soft);
  border-color: rgba(250, 249, 245, 0.20);
}

.dashboard-menu-actions {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.dashboard-menu-action {
  justify-content: center;
  min-height: 48px;
  width: 100%;
}

.dashboard-menu-actions .status {
  display: block;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
}

.dashboard-menu-actions .status.error {
  color: #ffb7b7;
}

.account-admin-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(250, 249, 245, 0.10);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
}

.account-admin-panel[hidden] {
  display: none;
}

.account-admin-header,
.account-admin-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.account-admin-header strong {
  font-size: 16px;
  color: var(--on-dark);
}

.account-admin-header span,
.account-admin-item small,
.account-admin-item em {
  color: rgba(255, 255, 255, 0.64);
  font-size: 12px;
  font-style: normal;
}

.settings-card .account-admin-header strong {
  color: var(--text);
}

.settings-card .account-admin-header span,
.settings-card .status {
  color: var(--muted);
}

.notification-control-panel {
  display: grid;
  gap: 10px;
}

.notification-action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.notification-action-row button {
  width: 100%;
  min-height: 44px;
}

.notification-hint,
.notification-test-result {
  font-size: 13px;
  line-height: 1.45;
}

.notification-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.notification-status-item {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.notification-status-item dt,
.notification-status-item dd {
  min-width: 0;
  margin: 0;
}

.notification-status-item dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

.notification-status-item dd {
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.notification-status-item.is-ready dd {
  color: var(--success);
}

.notification-status-item.is-waiting dd,
.notification-status-item.is-off dd,
.notification-status-item.is-unsupported dd {
  color: var(--muted);
}

.notification-status-item.is-failed dd {
  color: var(--danger);
}

@media (max-width: 520px) {
  .notification-action-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .notification-status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .notification-action-row button {
    min-width: 0;
    min-height: 42px;
    padding: 0 10px;
    font-size: 13px;
  }
}

.account-admin-form {
  display: grid;
  gap: 8px;
}

.account-admin-form input {
  min-height: 42px;
  width: 100%;
  border: 1px solid rgba(250, 249, 245, 0.12);
  border-radius: 14px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--on-dark);
  font: inherit;
}

.account-admin-form input::placeholder {
  color: rgba(255, 255, 255, 0.48);
}

.account-admin-form input:focus {
  outline: none;
  border-color: rgba(112, 163, 225, 0.8);
  box-shadow: 0 0 0 3px rgba(112, 163, 225, 0.22);
}

.settings-card .account-admin-form input {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
}

.settings-card .account-admin-form input::placeholder {
  color: #8a93a0;
}

.settings-card .password-eye-button {
  color: #7b8492;
}

.settings-card .password-eye-button:hover,
.settings-card .password-eye-button:focus-visible,
.settings-card .password-eye-button.is-showing {
  background: rgba(72, 122, 197, 0.10);
  color: var(--accent-strong);
}

.password-toggle-field {
  position: relative;
  display: block;
  width: 100%;
}

.password-toggle-field input {
  padding-right: 48px;
}

.password-eye-button {
  position: absolute;
  right: 14px;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, 0.62);
  box-shadow: none;
  transform: translateY(-50%);
}

.password-eye-button:hover,
.password-eye-button:focus-visible,
.password-eye-button.is-showing {
  background: rgba(255, 255, 255, 0.08);
  color: var(--on-dark);
}

.password-eye-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.account-admin-form > button {
  min-height: 42px;
}

.account-admin-list {
  display: grid;
  gap: 8px;
}

.account-admin-item {
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  align-items: flex-start;
}

.account-admin-identity {
  display: grid;
  min-width: 0;
  gap: 4px;
  flex: 1;
}

.account-admin-item strong {
  color: var(--on-dark);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.account-admin-usage {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.account-admin-usage span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.account-admin-usage b {
  color: var(--on-dark);
  font-size: 12px;
}

.account-admin-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
  flex-shrink: 0;
}

.account-admin-actions button {
  min-width: 64px;
}

.history-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--material);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.history-drawer-header strong {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.12;
}

.dashboard-menu-toggle,
.mobile-menu-toggle {
  position: relative;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 50%;
  font-size: 0;
  line-height: 0;
}

.dashboard-menu-toggle {
  display: inline-flex;
}

.dashboard-menu-toggle::before,
.dashboard-menu-toggle::after,
.mobile-menu-toggle::before,
.mobile-menu-toggle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.dashboard-menu-toggle::before,
.mobile-menu-toggle::before {
  box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
}

.dashboard-menu-toggle::after,
.mobile-menu-toggle::after {
  display: none;
}

.panel {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow-soft);
  align-self: start;
}

.dashboard-shell > .panel {
  align-self: stretch;
}

.usage-panel,
.create-room-panel,
.dashboard-history-panel {
  display: grid;
  align-content: start;
}

.usage-panel {
  gap: 18px;
}

.create-room-panel {
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
}

.create-room-panel p {
  max-width: 56ch;
}

.create-room-panel p,
.create-room-panel label,
.dashboard-room-form input,
.dashboard-room-form textarea,
.dashboard-history-heading .status,
.dashboard-history-list .status {
  font-size: 13px;
  line-height: 1.38;
}

.dashboard-history-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-history-heading h2 {
  margin-bottom: 0;
}

.dashboard-history-list {
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.dashboard-history-panel {
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
}

.dashboard-history-panel .dashboard-history-list {
  gap: 10px;
}

.dashboard-history-list .room-card {
  grid-template-columns: minmax(0, 1fr) 132px;
  align-items: start;
}

.dashboard-history-list .room-card-main strong {
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.24;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-history-list .room-card-main .status {
  overflow-wrap: anywhere;
}

.dashboard-history-list .room-card-actions {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 8px;
}

.dashboard-history-list .room-card-actions button {
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.dashboard-history-inline {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  min-height: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfcfe;
  box-shadow: inset 0 1px 2px rgba(47, 70, 97, 0.05);
}

.dashboard-room-form {
  align-content: stretch;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 0;
  height: 100%;
}

.dashboard-room-form textarea {
  min-height: 44px;
  height: 44px;
  resize: none;
}

.dashboard-form-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  align-items: center;
  gap: 12px;
  min-height: 58px;
}

.dashboard-page-footer {
  border-top: 1px solid var(--line);
  background: var(--material);
  box-shadow: 0 -12px 30px rgba(47, 70, 97, 0.08);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  padding: 12px 24px max(12px, env(safe-area-inset-bottom));
}

.dashboard-page-footer-inner {
  display: grid;
  grid-template-columns: minmax(280px, 0.78fr) minmax(420px, 1.24fr) minmax(300px, 0.98fr);
  gap: 18px;
  width: min(1360px, calc(100vw - 32px));
  margin: 0 auto;
}

.dashboard-page-footer .dashboard-form-footer {
  grid-column: 2 / 4;
}

.invite-ttl-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  min-height: 54px;
  gap: 10px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfcfe;
  box-shadow: inset 0 1px 2px rgba(47, 70, 97, 0.06), 0 8px 18px rgba(47, 70, 97, 0.06);
}

.invite-ttl-field span {
  grid-column: 2;
  grid-row: 1;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.15;
  white-space: nowrap;
}

.invite-ttl-field input {
  grid-column: 1;
  grid-row: 1;
  width: 42px;
  min-height: 24px;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.2;
  appearance: textfield;
  -moz-appearance: textfield;
}

.invite-ttl-field input:focus {
  background: transparent;
  box-shadow: none;
}

.invite-ttl-field input::-webkit-outer-spin-button,
.invite-ttl-field input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

.dashboard-form-footer button[type="submit"] {
  min-height: 54px;
  width: 132px;
  align-self: stretch;
  justify-self: end;
  padding: 0 14px;
  white-space: nowrap;
}

.usage-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 2px 12px;
}

.usage-heading h2 {
  margin-bottom: 0;
}

.usage-heading > strong {
  grid-row: span 2;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(44px, 6vw, 72px);
  font-weight: 400;
  line-height: 0.9;
}

.usage-heading > span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
}

.panel h1,
.panel h2 {
  margin: 0 0 14px;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.panel p {
  color: var(--muted);
  margin: 0 0 16px;
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: 0;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.usage-bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-card);
}

.usage-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.usage-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.usage-grid > div {
  position: relative;
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 72px;
  overflow: hidden;
  padding: 15px 14px 13px;
  border: 1px solid #d8e4f1;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.36)),
    linear-gradient(180deg, #fbfdff 0%, #eef4fb 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -1px 0 rgba(47, 70, 97, 0.04),
    0 10px 22px rgba(47, 70, 97, 0.12);
}

.usage-grid > div::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: rgba(49, 95, 168, 0.28);
}

.usage-grid > div:nth-child(2)::before {
  background: rgba(93, 184, 114, 0.34);
}

.usage-grid > div:nth-child(3)::before {
  background: rgba(200, 171, 99, 0.42);
}

.usage-grid span,
.usage-grid small {
  color: #6f7b8b;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.15;
}

.usage-grid strong {
  color: var(--text);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.usage-grid small {
  display: block;
}

.usage-note {
  margin-top: auto;
  padding-top: 4px;
  font-size: 13px;
}

.usage-description {
  margin: -2px 0 2px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.usage-sync-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.usage-sync-row button {
  flex: 0 0 auto;
}

.usage-sync-row .error {
  color: var(--danger);
}

.room-history {
  display: grid;
  gap: 12px;
}

.conversation-card {
  position: relative;
  min-width: 0;
}

.conversation-card-button {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 76px;
  padding: 12px 14px;
  border: 1px solid rgba(214, 228, 243, 0.86);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(246, 250, 254, 0.86)),
    var(--panel-strong);
  color: var(--text);
  text-align: left;
  box-shadow: var(--shadow-subtle);
}

.conversation-card-button:hover,
.conversation-card-button:focus-visible {
  border-color: rgba(72, 122, 197, 0.32);
  background:
    linear-gradient(180deg, #ffffff, #eef6ff),
    var(--panel-strong);
}

.conversation-avatar {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0) 38%),
    linear-gradient(145deg, #d9e9fb, #ffffff 52%, #bfd5ef);
  color: var(--accent-strong);
  font-size: 22px;
  font-weight: 900;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -10px 18px rgba(71, 105, 153, 0.08),
    0 10px 22px rgba(47, 70, 97, 0.14);
}

.conversation-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.conversation-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 10px;
}

.conversation-title-row strong,
.conversation-preview,
.conversation-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-title-row strong {
  color: var(--text);
  font-size: 16px;
  font-weight: 850;
}

.conversation-time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.conversation-preview {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.conversation-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  opacity: 0.85;
}

.conversation-unread-dot {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 0 0 4px rgba(49, 101, 177, 0.13);
}

.conversation-card.is-unread .conversation-title-row strong,
.conversation-card.is-unread .conversation-preview {
  color: var(--text);
}

.user-shell-page .room-history,
.user-shell-page .contact-list {
  gap: 0;
  align-content: start;
  overflow: auto;
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
}

.user-shell-page .conversation-card,
.user-shell-page .room-card,
.user-shell-page .contact-card {
  background: #ffffff;
}

.user-shell-page .conversation-card-button,
.user-shell-page .contact-card {
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 72px;
  padding: 10px 16px;
  border: 0;
  border-bottom: 1px solid rgba(222, 230, 240, 0.9);
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
}

.user-shell-page .conversation-card-button:hover,
.user-shell-page .conversation-card-button:focus-visible,
.user-shell-page .contact-card:hover,
.user-shell-page .contact-card:focus-visible {
  background: #f5f8fc;
  box-shadow: none;
}

.user-shell-page .conversation-avatar,
.user-shell-page .contact-avatar {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  font-size: 20px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 4px 10px rgba(47, 70, 97, 0.10);
}

.user-shell-page .conversation-title-row strong,
.user-shell-page .contact-main strong {
  font-size: 16px;
  font-weight: 720;
}

.user-shell-page .conversation-preview,
.user-shell-page .conversation-meta,
.user-shell-page .contact-main small {
  font-size: 13px;
  font-weight: 500;
}

.room-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: var(--panel);
  box-shadow: var(--shadow-subtle);
}

.room-card-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.room-card-actions {
  display: flex;
  align-items: start;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.room-preview {
  overflow-wrap: anywhere;
  border-radius: 10px;
  background: var(--code);
  color: var(--on-dark-soft);
  font-size: 14px;
  line-height: 1.43;
  padding: 10px 12px;
}

.chat-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 316px;
  gap: 0;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

.chat-main {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.timeline {
  --chat-edge: clamp(18px, 3vw, 46px);
  --avatar-size: 36px;
  --bubble-gap: 12px;
  overflow-y: auto;
  min-height: 0;
  padding: 22px var(--chat-edge);
  padding-bottom: calc(22px + env(safe-area-inset-bottom));
  scroll-padding-bottom: calc(22px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.message-row {
  display: flex;
  align-items: center;
  gap: var(--bubble-gap);
  width: 100%;
}

.message-row.owner {
  align-self: stretch;
  flex-direction: row-reverse;
}

.message-stack {
  display: grid;
  gap: 4px;
  min-width: 0;
  max-width: min(72%, calc(100% - var(--avatar-size) - var(--bubble-gap)));
}

.message-row.owner .message-stack {
  justify-items: end;
}

.message-avatar {
  appearance: none;
  -webkit-appearance: none;
  display: grid;
  flex: 0 0 var(--avatar-size);
  width: var(--avatar-size);
  height: var(--avatar-size);
  min-width: var(--avatar-size);
  min-height: var(--avatar-size);
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  padding: 0;
  background: transparent;
  color: var(--accent-dark);
  font-weight: 800;
  line-height: 1;
  box-shadow: none;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  overflow: hidden;
}

.message-avatar:disabled {
  cursor: default;
  opacity: 1;
}

.message-avatar:hover,
.message-avatar:active {
  background: transparent;
  box-shadow: none;
  transform: none;
}

.message-avatar img,
.member-avatar img,
.conversation-avatar img,
.contact-avatar img,
.profile-avatar-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.message-name {
  display: none;
}

.message-row.has-visible-name .message-name {
  display: block;
  color: #9099a5;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  padding: 0 2px 1px;
}

.time-notice {
  align-self: center;
  border-radius: 999px;
  background: transparent;
  color: var(--muted-soft);
  font-size: 12px;
  line-height: 1;
  padding: 2px 0;
}

.message {
  position: relative;
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 15px 15px 15px 5px;
  box-shadow: 0 10px 22px rgba(47, 70, 97, 0.10);
  padding: 11px 13px;
  background: var(--bubble-visitor);
  color: var(--on-primary);
}

.message-quote {
  display: grid;
  gap: 2px;
  width: 100%;
  max-width: 240px;
  margin: 0 0 7px;
  padding: 7px 9px;
  border: 0;
  border-left: 3px solid rgba(255, 255, 255, 0.62);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.16);
  color: inherit;
  text-align: left;
  box-shadow: none;
}

.message-quote strong,
.message-quote span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-quote strong {
  font-size: 12px;
  font-weight: 700;
}

.message-quote span {
  font-size: 12px;
  opacity: 0.82;
}

.message-mentions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.message-mentions span {
  border-radius: 999px;
  padding: 2px 7px;
  background: rgba(255, 255, 255, 0.16);
  color: inherit;
  font-size: 12px;
  font-weight: 700;
}

.recalled-message {
  opacity: 0.74;
  font-style: italic;
}

.message.owner {
  align-self: flex-end;
  border-color: transparent;
  border-radius: 15px 15px 5px 15px;
  background: var(--bubble-owner);
  color: var(--on-primary);
  box-shadow: 0 10px 22px rgba(49, 95, 168, 0.18);
}

.message-row.is-mentioned .message {
  border-color: rgba(202, 155, 46, 0.45);
  background:
    linear-gradient(135deg, rgba(245, 196, 82, 0.92), rgba(204, 120, 92, 0.90));
  box-shadow: 0 12px 28px rgba(202, 155, 46, 0.24);
}

.message-row.is-mentioned.owner .message {
  background:
    linear-gradient(135deg, rgba(53, 111, 197, 0.96), rgba(36, 89, 164, 0.96));
  box-shadow: 0 12px 28px rgba(49, 95, 168, 0.26), 0 0 0 2px rgba(245, 196, 82, 0.22);
}

.message-action-menu {
  position: fixed;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 16px;
  background: rgba(31, 41, 54, 0.94);
  box-shadow: 0 18px 42px rgba(22, 34, 48, 0.24);
  backdrop-filter: blur(16px) saturate(1.05);
  -webkit-backdrop-filter: blur(16px) saturate(1.05);
}

.message-action-menu button {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 12px;
  background: transparent;
  color: #fff;
  box-shadow: none;
  font-size: 13px;
  font-weight: 700;
}

.message-action-menu button:hover {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.message-inline-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: 100%;
  margin-top: 7px;
  padding: 5px;
  border: 1px solid rgba(138, 158, 184, 0.22);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 10px 24px rgba(47, 70, 97, 0.12);
  backdrop-filter: blur(14px) saturate(1.04);
  -webkit-backdrop-filter: blur(14px) saturate(1.04);
}

.message-row.owner .message-inline-actions {
  justify-self: end;
}

.message-inline-actions button {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--accent-dark);
  box-shadow: none;
  font-size: 13px;
  font-weight: 700;
}

.message-inline-actions button:active {
  background: rgba(49, 95, 168, 0.12);
}

.message::before {
  content: "";
  position: absolute;
  left: -5px;
  bottom: 11px;
  display: block;
  width: 10px;
  height: 10px;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: inherit;
  transform: rotate(45deg);
}

.message.owner::before {
  right: -5px;
  left: auto;
  border: 0;
}

.source {
  white-space: pre-wrap;
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: 0;
}

.attachment-link {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: min(260px, 64vw);
  color: inherit;
  text-decoration: none;
}

.attachment-icon {
  position: relative;
  display: block;
  width: 22px;
  height: 28px;
  border: 2px solid currentColor;
  border-radius: 5px;
  opacity: 0.9;
}

.attachment-icon::before {
  content: "";
  position: absolute;
  top: -2px;
  right: -2px;
  width: 9px;
  height: 9px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  border-radius: 0 5px 0 4px;
  background: rgba(255, 255, 255, 0.18);
}

.attachment-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.attachment-copy strong,
.attachment-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-copy strong {
  font-size: 14px;
  font-weight: 600;
}

.attachment-copy small {
  font-size: 11px;
  opacity: 0.78;
}

.attachment-image-link {
  appearance: none;
  -webkit-appearance: none;
  display: inline-grid;
  width: fit-content;
  max-width: min(180px, 42vw);
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
  color: inherit;
  cursor: zoom-in;
  font: inherit;
  line-height: 0;
  overflow: hidden;
  text-decoration: none;
  text-align: inherit;
}

.attachment-image {
  display: block;
  width: auto;
  height: auto;
  max-width: min(180px, 42vw);
  max-height: min(230px, 54vw);
  border-radius: 8px;
  object-fit: contain;
  background: #050607;
  box-shadow: none;
}

.chat-page .message:has(.attachment-image-link) {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  box-shadow: none;
}

.chat-page .message:has(.attachment-image-link)::before {
  display: none;
}

.chat-page .message-row.is-mentioned .message:has(.attachment-image-link),
.chat-page .message-row.is-mentioned.owner .message:has(.attachment-image-link) {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.image-preview-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 0;
  background: #000;
  cursor: zoom-out;
}

html:has(body.image-preview-open),
body.image-preview-open,
body.image-preview-open #app {
  background: #000;
}

html.image-preview-root-open {
  background: #000;
}

.image-preview-dialog {
  position: relative;
  display: grid;
  place-items: center;
  width: 100vw;
  height: var(--visual-viewport-height, 100vh);
  max-height: var(--visual-viewport-height, 100vh);
}

.image-preview-media {
  display: block;
  max-width: 100vw;
  max-height: var(--visual-viewport-height, 100vh);
  border-radius: 0;
  object-fit: contain;
  background: #000;
  box-shadow: none;
}

.composer {
  position: relative;
  z-index: 4;
  border-top: 1px solid var(--line);
  background: var(--material);
  padding: 14px 16px max(14px, env(safe-area-inset-bottom));
  display: grid;
  gap: 8px;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: 0 -12px 30px rgba(47, 70, 97, 0.08);
}

.composer > .status:empty {
  display: none;
}

.composer-meta,
.mention-suggestions {
  min-width: 0;
}

.composer-context {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 7px 9px;
  background: var(--panel);
  color: var(--muted);
  box-shadow: 0 8px 18px rgba(47, 70, 97, 0.08);
}

.composer-context span,
.composer-context strong,
.composer-context em {
  font-size: 12px;
  line-height: 1.2;
}

.composer-context strong,
.composer-context em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-context em {
  font-style: normal;
}

.composer-context button {
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  box-shadow: none;
}

.mention-suggestions {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 1px;
}

.mention-suggestions[hidden] {
  display: none;
}

.mention-suggestions button {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  box-shadow: none;
  font-size: 13px;
}

.composer-row {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.composer textarea {
  --composer-input-min-height: 44px;
  --composer-input-max-height: min(168px, 32dvh);
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  height: var(--composer-input-min-height);
  min-height: var(--composer-input-min-height);
  max-height: var(--composer-input-max-height);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 16px;
  line-height: 22px;
  overflow-y: hidden;
  resize: none;
  background: var(--panel);
  box-shadow: 0 8px 18px rgba(47, 70, 97, 0.08);
  letter-spacing: 0;
}

.file-upload-toggle {
  flex: 0 0 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  border-radius: 50%;
  padding: 0;
  color: var(--muted);
  font-size: 0;
  line-height: 1;
  background: var(--panel);
  box-shadow: 0 8px 18px rgba(47, 70, 97, 0.08);
}

.file-input {
  display: none;
}

.file-upload-icon {
  display: block;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.composer button[type="submit"] {
  flex: 0 0 64px;
  width: 64px;
  min-width: 0;
  min-height: 40px;
  border-radius: 999px;
  padding: 0 14px;
}

.composer-settings-toggle {
  flex: 0 0 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  place-items: center;
  position: relative;
  min-width: 40px;
  width: 40px;
  min-height: 40px;
  height: 40px;
  border-radius: 50%;
  padding: 0;
  font-size: 0;
  line-height: 0;
  background: var(--panel);
  box-shadow: 0 8px 18px rgba(47, 70, 97, 0.08);
  color: var(--accent-dark);
}

.composer-settings-toggle::before,
.composer-settings-toggle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.composer-settings-toggle::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.composer-settings-toggle.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.composer-language-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
}

.composer-language-bar:empty {
  display: none;
}

.composer-language-bar > span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.composer-language-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.quick-settings {
  display: grid;
  gap: 8px;
  width: 100%;
}

.quick-settings[hidden],
.quick-choice-panel[hidden] {
  display: none;
}

.quick-settings:empty {
  display: none;
}

.quick-action-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.quick-preference-tabs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.quick-action-button,
.choice-button {
  min-height: 36px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  border-radius: 8px;
  box-shadow: none;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
}

.quick-action-button:hover,
.choice-button:hover,
.choice-button.active {
  border-color: rgba(204, 120, 92, 0.42);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.quick-choice-panel {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  padding: 12px;
  box-shadow: var(--shadow-subtle);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.language-choice-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tone-choice-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.side {
  border-left: 1px solid rgba(250, 249, 245, 0.08);
  background: var(--surface-dark);
  color: var(--on-dark);
  padding: 16px;
  overflow-y: auto;
  min-height: 0;
}

.side strong,
.members-drawer strong {
  color: var(--on-dark);
  font-weight: 500;
}

.side .status,
.members-drawer .status {
  color: var(--on-dark-soft);
}

.side button.secondary,
.members-drawer button.secondary {
  border-color: rgba(250, 249, 245, 0.12);
  background: var(--surface-dark-elevated);
  color: var(--on-dark);
}

.side button.secondary:hover,
.members-drawer button.secondary:hover {
  background: var(--surface-dark-soft);
  border-color: rgba(250, 249, 245, 0.20);
}

.mobile-menu-toggle {
  display: none;
  position: relative;
  width: 40px;
  min-width: 40px;
  padding: 0;
  border-radius: 50%;
  font-size: 0;
  line-height: 0;
}

.mobile-menu-toggle::before,
.mobile-menu-toggle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.mobile-menu-toggle::before {
  box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
}

.mobile-menu-toggle::after {
  display: none;
}

.mobile-member-toggle {
  display: none;
}

.side-drawer-header {
  display: none;
}

.visitor-chat-page .chat-shell {
  grid-template-columns: 1fr;
  position: relative;
}

.visitor-chat-page .mobile-menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0;
}

.visitor-chat-page .mobile-member-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
}

.visitor-chat-page .side,
.visitor-chat-page .members-drawer {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  max-height: min(78dvh, 640px);
  border-top: 1px solid rgba(250, 249, 245, 0.08);
  border-left: 0;
  border-radius: 16px 16px 0 0;
  background: var(--surface-dark);
  box-shadow: 0 -1px 0 rgba(250, 249, 245, 0.08);
  transform: translateY(105%);
  transition: transform 180ms ease;
  padding: 0 16px 16px;
}

.side-open .visitor-chat-page .chat-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 19;
  background: rgba(20, 20, 19, 0.34);
}

.members-open .visitor-chat-page .chat-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 19;
  background: rgba(20, 20, 19, 0.34);
}

.side-open .visitor-chat-page .side {
  transform: translateY(0);
}

.members-open .visitor-chat-page .members-drawer {
  transform: translateY(0);
}

.visitor-chat-page .side-drawer-header {
  display: grid;
  position: sticky;
  top: 0;
  z-index: 2;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 58px;
  margin: 0 -16px 12px;
  padding: 12px 16px 10px;
  border-bottom: 1px solid rgba(250, 249, 245, 0.08);
  border-radius: 16px 16px 0 0;
  background: var(--surface-dark-elevated);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.visitor-chat-page .side-drawer-header strong {
  font-size: 18px;
}

.visitor-chat-page .side-close-button {
  position: relative;
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 50%;
  background: var(--surface-dark-soft);
  color: var(--on-dark);
}

.visitor-chat-page .side-close-button::before,
.visitor-chat-page .side-close-button::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 17px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: translate(-50%, -50%) rotate(45deg);
}

.visitor-chat-page .side-close-button::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.visitor-chat-page .side-close-button:hover {
  background: var(--surface-dark-elevated);
}

.visitor-chat-page .side-section {
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 12px;
}

.side-action-grid {
  grid-template-columns: 1fr 1fr;
}

.members-drawer {
  display: none;
  align-content: start;
  gap: 10px;
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  max-height: min(78dvh, 640px);
  border-top: 1px solid rgba(250, 249, 245, 0.08);
  border-left: 0;
  border-radius: 16px 16px 0 0;
  background: var(--surface-dark);
  color: var(--on-dark);
  box-shadow: 0 -1px 0 rgba(250, 249, 245, 0.08);
  padding: 0 16px 16px;
  overflow-y: auto;
  min-height: 0;
}

.members-open .members-drawer {
  display: grid;
}

.side-section {
  display: grid;
  gap: 10px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(250, 249, 245, 0.10);
}

.share-panel {
  display: none;
}

.member-list {
  display: grid;
  gap: 8px;
}

.member-card {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px;
  border: 1px solid rgba(250, 249, 245, 0.10);
  border-radius: 12px;
  background: var(--surface-dark-elevated);
  box-shadow: none;
}

.member-card.has-action {
  grid-template-columns: 40px minmax(0, 1fr) auto;
}

.member-card.is-left {
  opacity: 0.68;
}

.member-card.highlight {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(204, 120, 92, 0.22);
}

.member-avatar {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--on-dark);
  font-weight: 800;
  line-height: 1;
  box-shadow: none;
  overflow: hidden;
}

.member-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.member-copy span,
.member-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-copy small {
  color: var(--on-dark-soft);
  font-size: 12px;
}

.member-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.member-kick-button,
.member-rename-button {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
  white-space: nowrap;
}

.side-section:last-child {
  border-bottom: 0;
  margin-bottom: 0;
}

.network-links {
  display: grid;
  gap: 8px;
}

.provider-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.provider-badge {
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.25;
  padding: 7px 8px;
}

.provider-badge.ready {
  background: rgba(93, 184, 114, 0.14);
  color: #b9e7c4;
}

.provider-badge.missing {
  background: rgba(250, 249, 245, 0.08);
  color: var(--on-dark-soft);
}

.auto-route {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.side .auto-route {
  color: var(--on-dark-soft);
}

.qr {
  width: 220px;
  max-width: 100%;
  border: 1px solid rgba(250, 249, 245, 0.10);
  border-radius: 12px;
  box-shadow: none;
}

.status {
  color: var(--muted);
  font-size: 13px;
}

.error {
  color: var(--danger);
}

.system-notice {
  align-self: center;
  max-width: min(620px, 100%);
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 2px 8px;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.notice-name {
  display: inline;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent-dark);
  font: inherit;
  font-weight: 700;
  line-height: inherit;
  box-shadow: none;
  text-shadow: none;
  transform: none;
  appearance: none;
}

.notice-name:hover,
.notice-name:focus-visible,
.notice-name:active {
  background: transparent;
  color: var(--accent);
  text-decoration: underline;
  box-shadow: none;
  transform: none;
}

.owner-login-page {
  position: relative;
  isolation: isolate;
  height: var(--visual-viewport-height, 100svh);
  min-height: 100svh;
  grid-template-rows: 1fr;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 14%, rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0) 24%),
    radial-gradient(circle at 76% 82%, rgba(126, 147, 176, 0.30), rgba(126, 147, 176, 0) 42%),
    linear-gradient(145deg, #e8eef5 0%, #d7e2ee 54%, #edf3f8 100%);
}

.owner-login-page::before,
.owner-login-page::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 999px;
  pointer-events: none;
}

.owner-login-page::before {
  width: 360px;
  height: 360px;
  left: max(-110px, calc(50% - 520px));
  top: max(-90px, 5vh);
  background: rgba(255, 255, 255, 0.22);
  filter: blur(40px);
}

.owner-login-page::after {
  width: 420px;
  height: 420px;
  right: max(-150px, calc(50% - 560px));
  bottom: -160px;
  background: rgba(83, 105, 135, 0.24);
  filter: blur(42px);
}

.owner-login-shell {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  height: var(--visual-viewport-height, 100svh);
  min-height: 100svh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(22px, 6vw, 48px);
  padding-bottom: calc(clamp(22px, 6vw, 48px) + var(--login-keyboard-reserve, 0px));
  scroll-padding-bottom: calc(44px + var(--login-keyboard-reserve, 0px));
}

.owner-login-card {
  position: relative;
  display: grid;
  justify-items: center;
  width: min(420px, 100%);
  min-height: min(540px, calc(100svh - 44px));
  padding: 74px clamp(26px, 6vw, 44px) 42px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 44px;
  background:
    linear-gradient(145deg, rgba(250, 253, 255, 0.78) 0%, rgba(226, 235, 246, 0.88) 48%, rgba(205, 217, 232, 0.92) 100%),
    #dce6f1;
  box-shadow:
    32px 40px 72px rgba(47, 70, 97, 0.34),
    -14px -16px 34px rgba(255, 255, 255, 0.72),
    inset 1px 1px 0 rgba(255, 255, 255, 0.78),
    inset -8px -10px 18px rgba(91, 111, 137, 0.16);
}

.owner-login-card::before {
  content: "";
  position: absolute;
  inset: 18px;
  pointer-events: none;
  border-radius: 34px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.24), rgba(215, 226, 240, 0.18) 48%, rgba(129, 151, 181, 0.08) 100%);
  box-shadow:
    inset 10px 10px 22px rgba(104, 126, 154, 0.12),
    inset -12px -12px 24px rgba(255, 255, 255, 0.48),
    inset 1px 1px 0 rgba(255, 255, 255, 0.56),
    inset -1px -1px 0 rgba(88, 111, 141, 0.08);
}

.owner-login-card::after {
  content: "";
  position: absolute;
  left: 52px;
  right: 52px;
  bottom: -18px;
  z-index: -1;
  height: 28px;
  border-radius: 999px;
  background: rgba(57, 76, 103, 0.24);
  filter: blur(18px);
  pointer-events: none;
}

.owner-login-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  margin-bottom: 26px;
  border: 9px solid rgba(255, 255, 255, 0.88);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 24%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 33%),
    linear-gradient(145deg, #24334a 0%, #080c14 62%, #020408 100%);
  color: #f7fbff;
  box-shadow:
    13px 18px 28px rgba(72, 88, 109, 0.26),
    -9px -10px 18px rgba(255, 255, 255, 0.94),
    inset 3px 3px 8px rgba(255, 255, 255, 0.08),
    inset -7px -8px 16px rgba(0, 0, 0, 0.42);
}

.owner-login-mark::after {
  content: "";
  position: absolute;
  inset: 8px 10px auto;
  height: 24px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.owner-login-mark span {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  color: #ffffff;
  font-family: "PingFang SC", "Microsoft YaHei", "Heiti SC", var(--font-display);
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  text-shadow:
    0 2px 8px rgba(49, 95, 168, 0.45),
    0 -1px 0 rgba(255, 255, 255, 0.18);
  transform: translate(2px, -1px);
}

.owner-login-mark-globe span {
  width: 76px;
  height: 76px;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 76px;
  font-weight: 400;
  line-height: 1;
  text-shadow:
    0 16px 24px rgba(48, 67, 94, 0.24),
    0 2px 0 rgba(255, 255, 255, 0.38);
  transform: translate(0, 0);
}

.owner-login-mark-globe {
  border: 1px solid rgba(255, 255, 255, 0.72);
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.58) 0%, rgba(255, 255, 255, 0.22) 42%, rgba(150, 168, 194, 0.10) 70%, rgba(103, 121, 145, 0.18) 100%);
  box-shadow:
    12px 18px 30px rgba(72, 88, 109, 0.18),
    -9px -10px 18px rgba(255, 255, 255, 0.88),
    0 0 0 1px rgba(130, 150, 178, 0.06),
    inset 5px 6px 12px rgba(255, 255, 255, 0.36),
    inset -8px -9px 18px rgba(72, 88, 109, 0.15);
}

.owner-login-mark-globe::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 9px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.98) 0%, rgba(232, 239, 248, 0.78) 42%, rgba(136, 158, 188, 0.32) 100%);
  box-shadow:
    inset 2px 2px 4px rgba(255, 255, 255, 0.74),
    inset -4px -5px 9px rgba(92, 113, 141, 0.16);
  pointer-events: none;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.owner-login-mark-globe::after {
  inset: 11px 17px auto;
  height: 18px;
  display: block;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0));
  opacity: 0.7;
}

.owner-login-copy {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-bottom: 58px;
  text-align: center;
}

.owner-login-copy h1 {
  margin: 0;
  color: var(--tchat-blue, var(--accent));
  font-family: var(--font-display);
  font-size: clamp(34px, 8vw, 42px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: 0;
}

#ownerLoginTitle {
  color: var(--tchat-green);
}

.owner-login-copy p {
  max-width: 18em;
  margin: 0;
  color: #6f7c8d;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0.08em;
}

.owner-login-form {
  display: grid;
  width: 100%;
  gap: 22px;
}

.owner-login-field {
  position: relative;
  display: block;
  color: var(--muted);
}

.owner-login-label {
  position: absolute;
  left: 58px;
  top: 50%;
  z-index: 1;
  color: #8993a1;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  transform: translateY(-50%);
  transition: opacity 140ms ease, transform 140ms ease;
  pointer-events: none;
}

.owner-login-field:focus-within .owner-login-label,
.owner-login-field:has(input:not(:placeholder-shown)) .owner-login-label {
  opacity: 0;
  transform: translateY(-50%) translateX(8px);
}

.owner-login-icon {
  position: absolute;
  left: 22px;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: #1d2530;
  transform: translateY(-50%);
  pointer-events: none;
}

.owner-login-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.owner-login-field input {
  min-height: 64px;
  padding: 0 22px 0 58px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background:
    linear-gradient(145deg, rgba(222, 230, 240, 0.96), rgba(247, 250, 253, 0.86)),
    #e8eef6;
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  box-shadow:
    inset 9px 9px 16px rgba(94, 111, 134, 0.20),
    inset -10px -10px 18px rgba(255, 255, 255, 0.98),
    0 1px 0 rgba(255, 255, 255, 0.92),
    0 9px 18px rgba(104, 121, 143, 0.08);
}

.owner-login-field.has-password-toggle input {
  padding-right: 62px;
}

.owner-login-field .password-eye-button {
  right: 18px;
  color: #263241;
}

.owner-login-field .password-eye-button:hover,
.owner-login-field .password-eye-button:focus-visible,
.owner-login-field .password-eye-button.is-showing {
  background: rgba(49, 95, 168, 0.10);
  color: #173c78;
}

.owner-login-field input:focus {
  background:
    linear-gradient(145deg, rgba(232, 239, 247, 0.98), rgba(255, 255, 255, 0.9)),
    #f1f6fb;
  box-shadow:
    inset 7px 7px 13px rgba(94, 111, 134, 0.16),
    inset -9px -9px 17px rgba(255, 255, 255, 0.98),
    0 0 0 4px rgba(49, 95, 168, 0.12),
    0 9px 18px rgba(104, 121, 143, 0.08);
}

.owner-login-form button[type="submit"] {
  position: relative;
  overflow: hidden;
  min-height: 64px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background:
    radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0) 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0) 44%),
    linear-gradient(145deg, #2ed6cb 0%, #08b8dc 50%, #0798ec 100%);
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  box-shadow:
    14px 17px 28px rgba(3, 142, 212, 0.32),
    -8px -8px 16px rgba(255, 255, 255, 0.78),
    inset 1px 1px 0 rgba(255, 255, 255, 0.46),
    inset -2px -6px 12px rgba(2, 96, 177, 0.26);
}

.owner-login-form button[type="submit"]::before {
  content: "";
  position: absolute;
  inset: 6px 18px auto;
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0));
  opacity: 0.82;
  pointer-events: none;
}

.owner-login-form button[type="submit"]::after {
  content: "";
  position: absolute;
  inset: auto 18px 7px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(0, 84, 151, 0), rgba(0, 84, 151, 0.16));
  pointer-events: none;
}

.owner-login-form button[type="submit"]:hover {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0) 42%),
    linear-gradient(145deg, #20d0c9 0%, #05add6 48%, #078bdd 100%);
  box-shadow:
    10px 14px 24px rgba(3, 132, 201, 0.34),
    -6px -6px 13px rgba(255, 255, 255, 0.74),
    inset 0 1px 0 rgba(255, 255, 255, 0.44),
    inset 0 -4px 10px rgba(2, 96, 177, 0.25);
}

.owner-login-form button[type="submit"]:active {
  box-shadow:
    5px 7px 14px rgba(3, 132, 201, 0.24),
    -4px -4px 10px rgba(255, 255, 255, 0.68),
    inset 0 3px 8px rgba(2, 96, 177, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.owner-login-form button[type="submit"]:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.owner-login-form .status {
  min-height: 22px;
  margin-top: -6px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
}

@media (max-width: 520px) {
  .owner-login-shell {
    padding: 18px;
  }

  .owner-login-card {
    min-height: min(520px, calc(100svh - 36px));
    padding: 56px 26px 34px;
    border-radius: 36px;
  }

  .owner-login-mark {
    width: 92px;
    height: 92px;
    margin-bottom: 24px;
    border-width: 9px;
  }

  .owner-login-mark span {
    font-size: 31px;
  }

  .owner-login-mark-globe span {
    width: 76px;
    height: 76px;
    font-size: 76px;
    transform: translate(0, 0);
  }

  .owner-login-copy {
    margin-bottom: 42px;
  }

  .owner-login-copy p {
    font-size: 12px;
    letter-spacing: 0.05em;
  }

  .owner-login-field input,
  .join-language-button,
  .owner-login-form button[type="submit"] {
    min-height: 58px;
  }

}

.join-box {
  width: min(460px, calc(100vw - 32px));
  margin: 42px auto;
}

.join-select-field .owner-login-label {
  display: none;
}

.join-select-field:focus-within .owner-login-label {
  display: none;
}

.join-language-button {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 64px;
  width: 100%;
  padding: 0 70px 0 58px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background:
    linear-gradient(145deg, rgba(222, 230, 240, 0.96), rgba(247, 250, 253, 0.86)),
    #e8eef6;
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  text-align: left;
  box-shadow:
    inset 9px 9px 16px rgba(94, 111, 134, 0.20),
    inset -10px -10px 18px rgba(255, 255, 255, 0.98),
    0 1px 0 rgba(255, 255, 255, 0.92),
    0 9px 18px rgba(104, 121, 143, 0.08);
}

.join-language-button::after {
  content: "";
  position: absolute;
  right: 32px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 2px solid rgba(122, 130, 142, 0.72);
  border-bottom: 2px solid rgba(122, 130, 142, 0.72);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

.join-language-button:focus {
  outline: none;
  box-shadow:
    inset 7px 7px 13px rgba(94, 111, 134, 0.16),
    inset -9px -9px 17px rgba(255, 255, 255, 0.98),
    0 0 0 4px rgba(49, 95, 168, 0.12),
    0 9px 18px rgba(104, 121, 143, 0.08);
}

.join-language-menu {
  position: absolute;
  z-index: 8;
  left: 50%;
  top: calc(100% + 10px);
  width: min(100%, 420px);
  max-height: min(360px, 48svh);
  padding: 8px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(64, 74, 87, 0.98), rgba(34, 48, 69, 0.98)),
    #273447;
  color: #f5f8fc;
  text-align: center;
  transform: translateX(-50%);
  box-shadow:
    0 18px 34px rgba(31, 43, 60, 0.30),
    inset 1px 1px 0 rgba(255, 255, 255, 0.14);
  -webkit-overflow-scrolling: touch;
}

.join-language-menu[hidden] {
  display: none;
}

.join-language-option {
  display: block;
  min-height: 42px;
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
}

.join-language-option:hover,
.join-language-option:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.10);
}

.join-language-option[aria-selected="true"] {
  background: linear-gradient(145deg, #5f94ed, #3d78dc);
  color: #ffffff;
}

@media (max-width: 520px) {
  .join-language-menu {
    position: fixed;
    left: 50%;
    top: 50%;
    width: min(320px, calc(100vw - 44px));
    max-height: min(460px, calc(100dvh - 210px));
    transform: translate(-50%, -50%);
  }

  .join-language-option {
    min-height: 40px;
    font-size: 17px;
  }
}

@media (max-width: 860px) {
  .home {
    grid-template-columns: 1fr;
  }

  .dashboard-page {
    height: 100%;
    max-height: 100%;
  }

  .chat-page {
    height: 100%;
  }

  .chat-shell {
    grid-template-columns: 1fr;
    position: relative;
  }

  .dashboard-page .topbar {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    min-height: 64px;
    padding: 8px 16px;
  }

  .dashboard-page .brand strong {
    font-size: 29px;
    font-weight: 700;
    line-height: 1.08;
  }

  .dashboard-page .topbar-actions {
    grid-column: 3;
    justify-self: end;
    flex-wrap: nowrap;
    gap: 6px;
  }

  .dashboard-page .topbar-actions button {
    min-height: 36px;
    padding: 0 10px;
    font-size: 13px;
  }

  .dashboard-page .topbar-actions .dashboard-menu-toggle {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    font-size: 0;
  }

  .dashboard-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 104px minmax(0, 1fr) clamp(204px, 27svh, 224px);
    align-content: stretch;
    gap: 8px;
    width: 100%;
    height: 100%;
    padding: 8px 12px 8px;
    overflow-x: hidden;
    overflow-y: auto;
    scroll-padding-bottom: calc(80px + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
  }

  .dashboard-shell > .panel {
    height: 100%;
    min-height: 0;
    overflow: hidden;
    padding: 9px 14px;
    border-radius: 14px;
  }

  .usage-panel,
  .create-room-panel,
  .dashboard-history-panel {
    grid-column: 1;
  }

  .usage-panel {
    grid-row: 1;
  }

  .dashboard-history-panel {
    grid-row: 2;
  }

  .create-room-panel {
    grid-row: 3;
  }

  .usage-panel {
    grid-template-columns: minmax(96px, 0.72fr) minmax(0, 1.28fr);
    grid-template-rows: 8px minmax(0, 1fr);
    align-items: center;
    gap: 6px 10px;
  }

  .dashboard-page .panel h1,
  .dashboard-page .panel h2 {
    margin-bottom: 0;
    font-size: 20px;
    line-height: 1.12;
    font-weight: 600;
    letter-spacing: 0;
  }

  .usage-heading {
    grid-column: 1;
    grid-row: 1 / 3;
    display: grid;
    grid-template-columns: 1fr;
    align-content: center;
    align-items: start;
    gap: 2px;
  }

  .usage-heading h2 {
    font-size: 20px;
  }

  .usage-heading > strong {
    grid-row: auto;
    font-size: clamp(30px, 9vw, 38px);
  }

  .usage-heading > span {
    align-self: start;
    font-size: 12px;
  }

  .usage-bar {
    grid-column: 2;
    grid-row: 1;
    height: 7px;
  }

  .usage-grid {
    grid-column: 2;
    grid-row: 2;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  .usage-grid > div {
    min-height: 56px;
    gap: 5px;
    padding: 10px 9px 8px;
    border-radius: 10px;
  }

  .usage-grid span,
  .usage-grid small {
    font-size: 9px;
  }

  .usage-grid strong {
    font-size: clamp(13px, 3.5vw, 16px);
    line-height: 1.1;
  }

  .usage-note {
    display: none;
  }

  .usage-sync-row {
    display: none;
  }

  .create-room-panel {
    grid-template-rows: auto auto auto;
    align-content: center;
    gap: 5px;
    padding: 14px;
  }

  .create-room-panel p {
    margin: 0;
    font-size: 12px;
    line-height: 1.2;
  }

  .dashboard-room-form {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    align-content: start;
    gap: 5px;
    height: auto;
  }

  .dashboard-history-panel .dashboard-history-list {
    padding-bottom: 16px;
  }

  .dashboard-room-form > label {
    gap: 4px;
    font-size: 12px;
  }

  .dashboard-room-form > label:nth-of-type(1),
  .dashboard-room-form > label:nth-of-type(2) {
    grid-column: 1 / -1;
  }

  .dashboard-room-form > label:nth-of-type(1) {
    grid-row: 1;
  }

  .dashboard-room-form > label:nth-of-type(2) {
    grid-row: 2;
  }

  .dashboard-form-footer {
    grid-template-columns: minmax(0, 1fr) 96px;
    gap: 8px;
    min-height: 44px;
  }

  .dashboard-page-footer {
    min-height: 64px;
    padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  }

  .dashboard-page-footer-inner {
    display: block;
    width: 100%;
  }

  .dashboard-room-form input,
  .dashboard-room-form textarea {
    padding: 8px 10px;
    font-size: 16px;
    line-height: 1.35;
  }

  .invite-ttl-field {
    grid-template-columns: auto minmax(0, 1fr);
    min-height: 44px;
    padding: 5px 12px;
    border-radius: 14px;
  }

  .invite-ttl-field span {
    font-size: 10px;
    line-height: 1.15;
  }

  .invite-ttl-field input {
    min-height: 20px;
    width: 34px;
    padding: 0;
    font-size: 15px;
  }

  .dashboard-form-footer button[type="submit"] {
    width: 96px;
    min-height: 44px;
    padding: 0 8px;
    font-size: 12px;
  }

  .dashboard-room-form textarea {
    height: 34px;
    min-height: 34px;
    resize: none;
  }

  .dashboard-menu-drawer {
    inset: auto 8px calc(76px + env(safe-area-inset-bottom)) 8px;
    width: auto;
    height: auto;
    max-height: min(78dvh, 640px);
    border-top: 1px solid var(--line);
    border-left: 0;
    border-radius: 22px;
  }

  .dashboard-menu-actions {
    max-height: 100%;
    padding-bottom: max(18px, env(safe-area-inset-bottom));
  }

  .dashboard-history-heading .status {
    font-size: 11px;
  }

  .dashboard-history-list {
    gap: 6px;
  }

  .dashboard-history-list .room-card {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 8px;
    border-radius: 10px;
  }

  .dashboard-history-list .room-card-main {
    gap: 1px;
  }

  .dashboard-history-list .room-card-main strong {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dashboard-history-list .room-card-main .status {
    font-size: 10px;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dashboard-history-list .room-preview {
    display: none;
  }

  .dashboard-history-list .room-card-actions {
    display: grid;
    grid-template-columns: 1fr;
    align-content: center;
    gap: 4px;
  }

  .dashboard-history-list .room-card-actions button {
    min-height: 26px;
    padding: 0 7px;
    font-size: 10px;
  }

  .dashboard-menu-drawer {
    border-top-color: rgba(250, 249, 245, 0.08);
  }

  .topbar {
    align-items: center;
    gap: 8px;
    min-height: 64px;
    padding: 8px 16px;
  }

  .brand {
    min-width: 0;
  }

  .brand strong {
    font-size: 24px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .brand-subtitle {
    max-width: 58vw;
    font-size: 17px;
    font-weight: 500;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-actions {
    flex: 0 0 auto;
    margin-left: auto;
  }

  .chat-topbar {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 40px;
  }

  .chat-topbar .topbar-actions {
    margin-left: 0;
  }

  .chat-topbar .brand {
    max-width: 100%;
  }

  .chat-topbar .brand strong {
    font-size: 25px;
    line-height: 1.08;
  }

  .chat-topbar .brand > .brand-subtitle {
    max-width: 100%;
    font-size: 12px;
    line-height: 1.2;
  }

  .chat-page .home-button {
    display: none;
  }

  .mobile-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
  }

  .mobile-member-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 12px;
  }

  .timeline {
    --chat-edge: clamp(12px, 3.2vw, 20px);
    --avatar-size: 36px;
    --bubble-gap: clamp(8px, 2vw, 12px);
    gap: 12px;
    padding: 14px var(--chat-edge);
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
    background: var(--bg);
  }

  .message-row {
    width: 100%;
    gap: var(--bubble-gap);
  }

  .message-row.owner {
    align-self: stretch;
  }

  .message-stack {
    max-width: min(82%, calc(100% - var(--avatar-size) - var(--bubble-gap)));
  }

  .message-avatar {
    flex: 0 0 var(--avatar-size);
    width: var(--avatar-size);
    height: var(--avatar-size);
    border-radius: 50%;
    background: var(--panel-strong);
    box-shadow: none;
  }

  .message-name {
    display: none;
  }

  .time-notice {
    background: transparent;
    color: var(--muted-soft);
    padding: 2px 0;
  }

  .message {
    position: relative;
    width: fit-content;
    max-width: 100%;
    border: 1px solid var(--line);
    border-radius: 15px 15px 15px 5px;
    box-shadow: 0 10px 22px rgba(47, 70, 97, 0.10);
    padding: 11px 13px;
    background: var(--bubble-visitor);
    color: var(--on-primary);
  }

  .message.owner {
    border-color: transparent;
    border-radius: 15px 15px 5px 15px;
    background: var(--bubble-owner);
    color: var(--on-primary);
    box-shadow: 0 10px 22px rgba(49, 95, 168, 0.18);
  }

  .message::before {
    content: "";
    position: absolute;
    left: -5px;
    bottom: 11px;
    display: block;
    width: 10px;
    height: 10px;
    border-left: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: inherit;
    transform: rotate(45deg);
  }

  .message.owner::before {
    right: -5px;
    left: auto;
    border: 0;
  }

  .source {
    font-size: 16px;
    line-height: 1.55;
  }

  .system-notice {
    max-width: 94%;
    border-radius: 0;
    padding: 2px 8px;
  }

  .composer {
    gap: 8px;
    min-height: 64px;
    padding: 10px 16px max(10px, env(safe-area-inset-bottom));
  }

  .composer-row {
    display: flex;
    gap: 8px;
    align-items: center;
  }

  .composer textarea {
    order: 1;
    --composer-input-max-height: min(154px, 30dvh);
    height: var(--composer-input-min-height);
    min-height: var(--composer-input-min-height);
    max-height: var(--composer-input-max-height);
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 16px;
    line-height: 22px;
    resize: none;
  }

  .composer-settings-toggle {
    order: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    place-items: center;
    position: relative;
    min-width: 40px;
    width: 40px;
    min-height: 40px;
    height: 40px;
    border-radius: 50%;
    padding: 0;
    color: var(--accent-dark);
    font-size: 0;
    line-height: 0;
  }

  .composer-settings-toggle::before,
  .composer-settings-toggle::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transform: translate(-50%, -50%);
  }

  .composer-settings-toggle::after {
    transform: translate(-50%, -50%) rotate(90deg);
  }

  .composer-settings-toggle.active {
    background: var(--accent-soft);
    color: var(--accent-dark);
  }

  .file-upload-toggle {
    order: 2;
    min-width: 40px;
    min-height: 40px;
    border-radius: 50%;
  }

  .composer button[type="submit"] {
    display: none;
  }

  .choice-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .side {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    max-height: min(78dvh, 640px);
    border-top: 1px solid rgba(250, 249, 245, 0.08);
    border-left: 0;
    border-radius: 16px 16px 0 0;
    background: var(--surface-dark);
    color: var(--on-dark);
    box-shadow: 0 -1px 0 rgba(250, 249, 245, 0.08);
    transform: translateY(105%);
    transition: transform 180ms ease;
    padding: 0 16px 16px;
  }

  .side-open .chat-shell::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 19;
    background: rgba(20, 20, 19, 0.34);
  }

  .members-open .chat-shell::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 19;
    background: rgba(20, 20, 19, 0.34);
  }

  .side-open .side {
    transform: translateY(0);
  }

  .side-drawer-header {
    display: grid;
  }

  .side-drawer-header {
    position: sticky;
    top: 0;
    z-index: 2;
    grid-template-columns: 1fr auto;
    align-items: center;
    min-height: 58px;
    margin: 0 -16px 12px;
    padding: 12px 16px 10px;
    border-bottom: 1px solid rgba(250, 249, 245, 0.08);
    border-radius: 16px 16px 0 0;
    background: var(--surface-dark-elevated);
    backdrop-filter: var(--blur);
    -webkit-backdrop-filter: var(--blur);
  }

  .side-drawer-header strong {
    font-size: 18px;
  }

  .side-close-button {
    position: relative;
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0;
    border-radius: 50%;
    background: var(--surface-dark-soft);
    color: var(--on-dark);
  }

  .side-close-button::before,
  .side-close-button::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 17px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transform: translate(-50%, -50%) rotate(45deg);
  }

  .side-close-button::after {
    transform: translate(-50%, -50%) rotate(-45deg);
  }

  .side-close-button:hover {
    background: var(--surface-dark-elevated);
  }

  .side-section {
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 12px;
  }

  .share-panel {
    display: grid;
  }

  .qr {
    width: 160px;
    justify-self: center;
  }

  .room-card {
    grid-template-columns: 1fr;
  }

  .room-card-actions {
    justify-content: stretch;
  }

  .room-card-actions button {
    flex: 1 1 140px;
  }
}

@media (max-width: 430px) {
  .choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tone-choice-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.owner-login-language {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 7px 8px 7px 20px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 999px;
  background:
    linear-gradient(145deg, rgba(229, 236, 246, 0.90), rgba(250, 252, 255, 0.78)),
    #e8eef6;
  box-shadow:
    inset 5px 5px 12px rgba(94, 111, 134, 0.12),
    inset -8px -8px 14px rgba(255, 255, 255, 0.80);
}

.owner-login-language span {
  color: #6f7c8d;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.owner-login-language select {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--text);
  box-shadow: none;
  font-size: 15px;
  font-weight: 800;
}

.chat-back-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: currentColor;
  box-shadow: none;
}

.chat-back-button svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-back-button:hover,
.chat-back-button:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.conversation-card {
  overflow: hidden;
}

.conversation-swipe {
  position: relative;
  display: grid;
  min-width: 0;
}

.conversation-delete-action {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
  width: 86px;
  min-height: 0;
  border-radius: 0;
  background: #d74a4a;
  color: #fff;
  box-shadow: none;
  font-size: 15px;
  font-weight: 800;
  transform: translateX(-100%);
}

.conversation-card-button {
  position: relative;
  z-index: 2;
  transition: transform 180ms ease, background 160ms ease;
}

.conversation-card.is-swipe-open .conversation-card-button {
  transform: translateX(86px);
}

.conversation-card.is-swipe-open .conversation-delete-action {
  transform: translateX(0);
}

body.app-fixed-mode .user-shell-page {
  background: #111315;
  color: #f3f4f6;
}

.user-shell-page .topbar,
.chat-page .topbar,
.composer {
  border-color: #25292e;
  background: rgba(17, 19, 21, 0.96);
  color: #f3f4f6;
  box-shadow: none;
}

.user-shell-page .brand strong,
.chat-page .brand strong {
  color: #f3f4f6;
}

.user-shell-page .brand-subtitle,
.chat-page .brand-subtitle {
  color: #a0a7b0;
}

.user-shell-page .app-shell-main {
  background: #181b1f;
}

.user-shell-page .room-history,
.user-shell-page .contact-list {
  background: #181b1f;
}

.app-search-field-compact {
  display: flex;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 24px);
  border: 0;
  background: #24272b;
  color: #b5bbc4;
  box-shadow: none;
}

.app-search-field-compact:focus-within {
  justify-content: flex-start;
}

.app-search-field-compact span {
  color: #8d949d;
}

.app-search-field-compact input {
  flex: 0 0 64px;
  min-width: 0;
  color: #f2f4f6;
  text-align: center;
  appearance: none;
  -webkit-appearance: none;
}

.app-search-field-compact input:focus,
.app-search-field-compact input:not(:placeholder-shown) {
  flex: 1 1 auto;
  text-align: left;
}

.app-search-field-compact input::placeholder {
  color: #8d949d;
  opacity: 1;
}

.user-shell-page .conversation-card,
.user-shell-page .room-card,
.user-shell-page .contact-card {
  background: #181b1f;
}

.user-shell-page .conversation-card-button,
.user-shell-page .contact-card {
  border-bottom-color: #292d33;
  background: #181b1f;
  color: #f3f4f6;
}

.user-shell-page .conversation-card-button:hover,
.user-shell-page .conversation-card-button:focus-visible,
.user-shell-page .contact-card:hover,
.user-shell-page .contact-card:focus-visible {
  background: #20242a;
}

.user-shell-page .conversation-avatar,
.user-shell-page .contact-avatar {
  background:
    linear-gradient(145deg, #2a3038 0%, #15181d 100%);
  color: #e8eef7;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.user-shell-page .conversation-title-row strong,
.user-shell-page .contact-main strong,
.settings-card h2,
.settings-card strong {
  color: #f3f4f6;
}

.user-shell-page .conversation-preview,
.user-shell-page .conversation-meta,
.user-shell-page .conversation-time,
.user-shell-page .contact-main small,
.settings-card p,
.settings-card label,
.settings-card .status {
  color: #8f98a3;
}

.app-tabbar {
  border-top-color: #292d33;
  background: rgba(17, 19, 21, 0.98);
}

.app-tabbar button {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
  min-height: 50px;
  color: #8f98a3;
  font-size: 11px;
  font-weight: 700;
}

.app-tabbar button.active {
  border-color: transparent;
  background: transparent;
  color: #4b8dff;
  box-shadow: none;
}

.app-tabbar-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  opacity: 0.72;
  filter: grayscale(1) brightness(1.7);
}

.app-tabbar button.active .app-tabbar-icon {
  opacity: 1;
  filter: none;
}

.settings-card,
.account-admin-panel,
.dashboard-modal {
  border-color: #30353c;
  background: #1b1f24;
  color: #f3f4f6;
  box-shadow: none;
}

.settings-card input,
.settings-card textarea,
.settings-card select,
.dashboard-modal input,
.dashboard-modal textarea,
.dashboard-modal select,
.group-member-picker,
.group-member-option {
  border-color: #30353c;
  background: #24282e;
  color: #f3f4f6;
  box-shadow: none;
}

.profile-avatar-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.profile-avatar-row strong {
  display: block;
}

.profile-avatar-row small {
  display: block;
  margin-top: 2px;
  color: #8f98a3;
  font-size: 12px;
}

.avatar-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.avatar-picker-option {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-height: 0;
  padding: 8px;
  border: 1px solid #30353c;
  border-radius: 18px;
  background: #24282e;
  box-shadow: none;
}

.avatar-picker-option:hover,
.avatar-picker-option:focus-visible {
  background: #2c333d;
  box-shadow: 0 0 0 2px rgba(6, 199, 85, 0.22);
}

.avatar-picker-option img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.avatar-upload-option {
  display: grid;
  place-items: center;
  min-height: 48px;
  border: 1px dashed #46515e;
  border-radius: 16px;
  background: #24282e;
  color: #dbe2ea;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}

.avatar-upload-option input {
  display: none;
}

.avatar-picker-hint {
  margin: 0;
  color: #8f98a3;
  font-size: 12px;
}

.settings-select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  color: #8f98a3;
  font-size: 13px;
  font-weight: 700;
}

.settings-select-row select {
  min-height: 40px;
  min-width: 128px;
  border-radius: 14px;
  padding: 0 34px 0 12px;
}

.dashboard-circle-action {
  border-color: #30353c;
  background: #24282e;
  color: #c8d0da;
  box-shadow: none;
}

.more-dots-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  font-size: 0;
  line-height: 0;
}

.more-dots-button::before,
.more-dots-button::after,
.dashboard-menu-toggle.more-dots-button::before,
.dashboard-menu-toggle.more-dots-button::after,
.mobile-menu-toggle.more-dots-button::before,
.mobile-menu-toggle.more-dots-button::after {
  display: none;
  content: none;
}

.more-dots-button > span {
  position: relative;
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: -8px 0 0 currentColor, 8px 0 0 currentColor;
}

.chat-page {
  background: #181b1f;
  color: #f3f4f6;
}

.timeline {
  background: #20242a;
}

.composer textarea {
  border-color: #30353c;
  background: #171a1f;
  color: #f3f4f6;
  box-shadow: none;
}

.composer textarea::placeholder {
  color: #8f98a3;
}

.composer-settings-toggle,
.file-upload-toggle {
  border-color: #30353c;
  background: #171a1f;
  color: #8f98a3;
  box-shadow: none;
}

.composer-settings-toggle:hover,
.file-upload-toggle:hover,
.composer-settings-toggle:focus-visible,
.file-upload-toggle:focus-visible {
  background: #20242a;
  color: #d9e0e8;
  box-shadow: none;
}

.brand strong {
  font-weight: 750;
}

.chat-topbar .brand strong {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.12;
}

.message-row.is-assistant .message {
  border-color: rgba(92, 170, 226, 0.30);
  background: linear-gradient(135deg, #263647, #1c2732);
  color: #eff6ff;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.16);
}

.message-row.is-assistant .message-avatar {
  color: inherit;
}

/* Final TChat keyboard-dark overrides, 2026-05-23. Keep this block last. */
:root {
  --tchat-keyboard: #202124;
  --tchat-keyboard-border: #34383f;
  --tchat-panel: #24272d;
  --tchat-panel-soft: #2a2e35;
  --tchat-panel-strong: #1b1f24;
  --tchat-input: #17191d;
  --tchat-control: #15181c;
  --tchat-control-hover: #1b2027;
  --tchat-text: #f2f4f7;
  --tchat-subtext: #a5adb8;
  --tchat-muted: #7d8794;
  --tchat-blue: #4b8dff;
  --tchat-green: #34c759;
}

html,
body,
#app {
  background: var(--tchat-keyboard);
}

body.app-fixed-mode .user-shell-page,
.chat-page {
  background: var(--tchat-keyboard);
  color: var(--tchat-text);
}

.user-shell-page .topbar,
.chat-page .topbar,
.app-tabbar,
.composer {
  border-color: var(--tchat-keyboard-border);
  background: var(--tchat-keyboard);
  color: var(--tchat-text);
  box-shadow: none;
}

.user-shell-page .app-shell-main,
.user-shell-page .room-history,
.user-shell-page .contact-list,
.timeline,
.chat-page .chat-shell,
.chat-page .chat-main {
  background: var(--tchat-panel);
}

.brand strong,
.chat-topbar .brand strong,
.user-shell-page .brand strong {
  color: var(--tchat-text);
  font-size: 18px;
  font-weight: 650;
  line-height: 1.14;
}

.app-search-field-compact {
  min-height: 42px;
  gap: 7px;
  border-color: transparent;
  background: #181a1d;
  color: var(--tchat-subtext);
}

.app-search-field-compact span {
  flex: 0 0 auto;
  color: #9199a5;
  font-size: 19px;
  line-height: 1;
}

.app-search-field-compact input {
  flex: 0 0 3.4em;
  width: 3.4em;
  min-height: 30px;
  padding: 0;
  color: var(--tchat-text);
  font-size: 17px;
  line-height: 22px;
}

.app-search-field-compact input::placeholder {
  color: #9199a5;
}

.app-search-field-compact input:focus,
.app-search-field-compact input:not(:placeholder-shown) {
  flex: 1 1 auto;
  width: auto;
}

.user-shell-page .conversation-card,
.user-shell-page .room-card,
.user-shell-page .contact-card,
.conversation-card-button,
.contact-card {
  background: var(--tchat-panel);
  color: var(--tchat-text);
}

.user-shell-page .conversation-card-button,
.user-shell-page .contact-card {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.user-shell-page .conversation-card-button:hover,
.user-shell-page .conversation-card-button:focus-visible,
.user-shell-page .contact-card:hover,
.user-shell-page .contact-card:focus-visible {
  background: var(--tchat-panel-soft);
}

.conversation-title-row strong,
.user-shell-page .conversation-title-row strong,
.contact-main strong,
.room-card-main strong,
.settings-card strong,
.settings-card h2,
.account-admin-panel strong,
.dashboard-modal strong {
  color: var(--tchat-text);
}

.conversation-preview,
.conversation-meta,
.conversation-time,
.contact-main small,
.room-card-main .status,
.settings-card,
.settings-card label,
.settings-card p,
.settings-card .status,
.account-admin-panel,
.dashboard-modal {
  color: var(--tchat-subtext);
}

.conversation-card.is-unread .conversation-title-row strong,
.conversation-card.is-unread .conversation-preview {
  color: var(--tchat-text);
}

.conversation-avatar {
  position: relative;
  overflow: visible;
}

.conversation-avatar img,
.contact-avatar img,
.message-avatar img,
.member-avatar img {
  display: block;
}

.message-avatar,
.member-avatar {
  border-color: rgba(255, 255, 255, 0.12);
  background: transparent;
  color: inherit;
  box-shadow: none;
}

.chat-page .message-avatar,
.chat-page .member-avatar,
.chat-page .chat-workspace-avatar {
  background: linear-gradient(145deg, #2a3038 0%, #15181d 100%);
}

.user-shell-page .conversation-avatar,
.user-shell-page .contact-avatar,
.user-shell-page .profile-avatar-preview {
  background: linear-gradient(145deg, #2a3038 0%, #15181d 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 10px rgba(0, 0, 0, 0.18);
}

.chat-page .message-avatar img,
.chat-page .member-avatar img,
.chat-page .chat-workspace-avatar img,
.user-shell-page .conversation-avatar img,
.user-shell-page .contact-avatar img,
.user-shell-page .profile-avatar-preview img {
  background: #20242a;
}

.avatar-image {
  /* Avatars stay fully opaque to avoid a visible fade-in flash every time the
     chat timeline is re-rendered after an SSE state-changed broadcast. */
  opacity: 1;
}

.avatar-image.is-loaded {
  opacity: 1;
}

.default-avatar-image {
  filter: brightness(0.78) saturate(0.78) contrast(1.04);
}

.message-row.is-assistant .message-avatar {
  color: inherit;
}

.conversation-unread-dot {
  position: absolute;
  top: -6px;
  right: -8px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 2px solid var(--tchat-panel);
  border-radius: 999px;
  background: var(--tchat-blue);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 0 0 4px rgba(75, 141, 255, 0.16);
}

.conversation-card {
  overflow: hidden;
}

.conversation-delete-action {
  right: 0;
  left: auto;
  transform: translateX(100%);
}

.conversation-card.is-swipe-open .conversation-card-button {
  transform: translateX(-86px);
}

.conversation-card.is-swipe-open .conversation-delete-action {
  transform: translateX(0);
}

.app-tabbar-icon-wrap {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 26px;
}

.app-tabbar-badge {
  position: absolute;
  top: -6px;
  right: -10px;
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border: 2px solid var(--tchat-keyboard);
  border-radius: 999px;
  background: var(--tchat-blue);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.app-tabbar-badge[hidden] {
  display: none;
}

.app-tabbar button.active {
  color: var(--tchat-blue);
}

.app-tabbar button.active .app-tabbar-icon {
  filter: brightness(0) saturate(100%) invert(55%) sepia(84%) saturate(2534%) hue-rotate(199deg) brightness(101%) contrast(101%);
}

.more-dots-button,
.dashboard-circle-action.more-dots-button,
.mobile-menu-toggle.more-dots-button {
  min-width: 44px;
  width: 44px;
  min-height: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: #cfd6df;
  box-shadow: none;
}

.more-dots-button:hover,
.more-dots-button:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
}

.chat-page button.secondary.mobile-menu-toggle.more-dots-button,
.chat-page button.secondary.mobile-menu-toggle.more-dots-button:hover,
.chat-page button.secondary.mobile-menu-toggle.more-dots-button:focus-visible,
.chat-page button.secondary.mobile-menu-toggle.more-dots-button:active {
  border-color: transparent;
  background: transparent;
  color: #cfd6df;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}

.more-dots-button.tone-honorific > span {
  box-shadow: -8px 0 0 var(--tchat-blue), 8px 0 0 currentColor;
}

.more-dots-button.tone-casual > span {
  box-shadow: -8px 0 0 currentColor, 8px 0 0 var(--tchat-green);
}

.composer textarea {
  border-color: var(--tchat-keyboard-border);
  background: var(--tchat-input);
  color: var(--tchat-text);
  box-shadow: none;
}

.composer textarea::placeholder {
  color: #929aa6;
}

button.composer-gpt-toggle,
button.composer-settings-toggle,
button.file-upload-toggle {
  border: 1.5px solid #4b535f;
  background: var(--tchat-control);
  color: #d7dde5;
  box-shadow: none;
}

button.composer-gpt-toggle {
  flex: 0 0 44px;
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  width: 44px;
  min-height: 40px;
  height: 40px;
  border-radius: 999px;
  padding: 0;
}

button.composer-gpt-toggle img {
  width: 22px;
  height: 22px;
  filter: brightness(0) saturate(100%) invert(86%) sepia(6%) saturate(471%) hue-rotate(176deg) brightness(96%) contrast(91%);
}

button.composer-gpt-toggle span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

button.composer-gpt-toggle:hover,
button.composer-gpt-toggle:focus-visible,
button.composer-settings-toggle:hover,
button.composer-settings-toggle:focus-visible,
button.file-upload-toggle:hover,
button.file-upload-toggle:focus-visible {
  border-color: #737d8d;
  background: var(--tchat-control-hover);
  color: #ffffff;
}

button.composer-gpt-toggle.active {
  border-color: #69a0ff;
  background: #2f66bd;
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.20), 0 8px 18px rgba(75, 141, 255, 0.22);
}

button.composer-gpt-toggle.active img {
  filter: brightness(0) invert(1);
}

button.composer-settings-toggle.active {
  border-color: #69a0ff;
  background: #263a58;
  color: #dbe9ff;
}

html,
body.chat-mode,
body.chat-mode #app,
body.chat-mode .chat-page {
  background: var(--tchat-keyboard);
}

body.chat-mode {
  color-scheme: dark;
}

.chat-page .topbar,
.chat-page .chat-topbar,
.chat-page .composer {
  background: var(--tchat-keyboard);
  border-color: var(--tchat-keyboard-border);
}

.chat-page .topbar {
  box-shadow: none;
}

.chat-page .chat-shell,
.chat-page .chat-main {
  background: var(--tchat-panel);
}

.owner-login-mark-logo {
  width: 96px;
  height: 96px;
  border: 0;
  border-radius: 24px;
  background: transparent;
  color: inherit;
  box-shadow:
    12px 18px 30px rgba(72, 88, 109, 0.20),
    -8px -9px 18px rgba(255, 255, 255, 0.82);
}

.owner-login-mark-logo::before,
.owner-login-mark-logo::after {
  display: none;
}

.owner-login-mark-logo img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: contain;
}

.owner-login-shell.login-keyboard-active {
  place-items: start center;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: var(--login-active-card-top) 18px 0;
  scroll-padding-bottom: 0;
}

.owner-login-shell.login-keyboard-active .owner-login-card {
  min-height: auto;
  max-height: calc(100% - var(--login-active-card-top) - 8px);
  overflow: hidden;
  padding-top: 34px;
  padding-bottom: 30px;
}

.owner-login-shell.login-keyboard-active .owner-login-card::after {
  opacity: 0.22;
}

.owner-login-shell.login-keyboard-active .owner-login-mark-logo {
  width: 76px;
  height: 78px;
  margin-bottom: 16px;
  border-radius: 19px;
}

.owner-login-shell.login-keyboard-active .owner-login-copy {
  margin-bottom: 24px;
}

.owner-login-shell.login-keyboard-active .owner-login-copy p {
  display: none;
}

.owner-login-shell.login-keyboard-active .owner-login-copy h1 {
  font-size: clamp(30px, 7vw, 38px);
}

.owner-login-shell.login-keyboard-active .owner-login-form {
  gap: 16px;
}

.owner-login-shell.login-keyboard-active .owner-login-form .status {
  min-height: 18px;
}

.side {
  background: #17202a;
  color: var(--tchat-text);
}

.side-section,
.side-group-tools {
  color: var(--tchat-text);
}

.side .status,
.message-name {
  color: var(--tchat-subtext);
}

.settings-tab-panel {
  color: var(--tchat-text);
}

.settings-card,
.account-admin-panel,
.dashboard-modal {
  border-color: #343a43;
  background: var(--tchat-panel-strong);
  color: var(--tchat-text);
}

.settings-card h2,
.settings-card strong,
.settings-card .account-admin-header strong,
.account-admin-panel .account-admin-header strong,
.account-admin-item strong {
  color: var(--tchat-text);
}

.settings-card p,
.settings-card label,
.settings-card .status,
.settings-card .account-admin-header span,
.account-admin-panel .account-admin-header span,
.account-admin-item small,
.account-admin-item em {
  color: #98a2ad;
}

.settings-card input,
.settings-card textarea,
.settings-card select,
.settings-card .account-admin-form input {
  border-color: #363d46;
  background: #24282e;
  color: var(--tchat-text);
}

.settings-card input::placeholder,
.settings-card textarea::placeholder,
.settings-card .account-admin-form input::placeholder {
  color: #7f8894;
}

.settings-tab-panel .usage-grid > div {
  border-color: #3a424d;
  background: linear-gradient(180deg, #252a31 0%, #1c2026 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.settings-tab-panel .usage-heading > strong,
.settings-tab-panel .usage-grid strong,
.settings-tab-panel .account-admin-usage b {
  color: #f8fafc;
}

.settings-tab-panel .usage-heading > span,
.settings-tab-panel .usage-grid span,
.settings-tab-panel .usage-grid small {
  color: #9ba5b2;
}

.account-admin-container {
  display: grid;
  gap: 12px;
}

.account-admin-list-shell {
  max-height: min(42dvh, 430px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.account-admin-list-shell .account-admin-list {
  padding: 8px;
}

@media (max-width: 860px) {
  .user-shell-page .topbar,
  .chat-page .topbar {
    background: var(--tchat-keyboard);
  }

  .user-shell-page .brand strong,
  .chat-page .brand strong,
  .chat-topbar .brand strong {
    font-size: 18px;
    font-weight: 700;
  }

  .user-shell-page .app-shell-main {
    padding-top: 10px;
  }

  button.composer-gpt-toggle {
    order: 0;
    flex-basis: 42px;
    width: 42px;
    min-width: 42px;
    height: 40px;
  }

  .composer textarea {
    order: 1;
  }

  .owner-login-shell.login-keyboard-active {
    padding: var(--login-active-card-top) 18px 0;
  }

  .owner-login-shell.login-keyboard-active .owner-login-card {
    width: 100%;
    padding: 28px 24px 26px;
    border-radius: 30px;
  }

  .owner-login-shell.login-keyboard-active .owner-login-mark-logo {
    width: 68px;
    height: 70px;
    margin-bottom: 12px;
    border-radius: 17px;
  }

  .owner-login-shell.login-keyboard-active .owner-login-copy {
    margin-bottom: 20px;
  }

  .owner-login-shell.login-keyboard-active .owner-login-copy p {
    display: none;
  }
}

/* TChat compact mobile keyboard and chat refinements, 2026-05-23. */
body.keyboard-active:not(.chat-mode),
body.keyboard-active:not(.chat-mode) #app,
body.keyboard-active:not(.chat-mode) .owner-login-page,
body.keyboard-active:not(.chat-mode) .owner-login-shell {
  background: var(--tchat-keyboard);
  color-scheme: dark;
}

body.keyboard-active:not(.chat-mode) .owner-login-page::before,
body.keyboard-active:not(.chat-mode) .owner-login-page::after {
  opacity: 0.08;
}

body.is-standalone-app.keyboard-active:not(.chat-mode) #app,
body.is-standalone-app.keyboard-active:not(.chat-mode) .owner-login-page,
body.is-standalone-app.keyboard-active:not(.chat-mode) .owner-login-shell {
  top: 0;
  height: 100%;
  min-height: 0;
}

.app-search-icon {
  display: block;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  opacity: 0.72;
  filter: brightness(0) saturate(100%) invert(68%) sepia(8%) saturate(336%) hue-rotate(178deg) brightness(90%) contrast(87%);
}

.app-search-field-compact:focus-within .app-search-icon {
  opacity: 0.9;
}

.dashboard-history-list.is-empty {
  min-height: min(54dvh, 520px);
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
}

.dashboard-history-list.is-empty .empty-state {
  width: 100%;
  padding: 24px;
  color: var(--tchat-subtext);
  font-size: 15px;
  line-height: 1.45;
  text-align: center;
}

.chat-page .composer {
  min-height: 52px;
  gap: 4px;
  padding: 7px 14px max(7px, env(safe-area-inset-bottom));
}

body.chat-mode.keyboard-active .composer {
  padding-bottom: 4px;
}

.chat-page .composer-row {
  gap: 7px;
}

.chat-page .composer textarea {
  --composer-input-min-height: 40px;
  --composer-input-max-height: min(132px, 26dvh);
  height: var(--composer-input-min-height);
  min-height: var(--composer-input-min-height);
  max-height: var(--composer-input-max-height);
  padding: 9px 13px;
  line-height: 20px;
}

body.chat-mode.keyboard-active .timeline {
  padding-bottom: 8px;
}

.chat-page .timeline {
  --bubble-tail-size: 8px;
}

.chat-page .timeline.is-empty {
  display: grid;
  place-items: center;
  align-content: center;
  justify-items: center;
  text-align: center;
}

.chat-empty-state {
  width: min(100%, 260px);
  color: var(--tchat-subtext);
  font-size: 15px;
  line-height: 1.45;
  text-align: center;
}

.chat-page .message-row {
  align-items: flex-start;
}

.chat-page .message-stack {
  max-width: min(74%, calc(100% - (var(--avatar-size) * 2) - (var(--bubble-gap) * 2)));
}

.chat-page .message {
  min-height: 0;
  padding: 6px 10px;
  border-radius: 13px 13px 13px 5px;
  box-shadow: 0 7px 16px rgba(0, 0, 0, 0.12);
}

.chat-page .message.owner {
  border-radius: 13px 13px 5px 13px;
}

.chat-page .message::before {
  width: var(--bubble-tail-size);
  height: var(--bubble-tail-size);
  left: calc(var(--bubble-tail-size) / -2);
  top: calc(var(--avatar-size) / 2);
  bottom: auto;
  transform: translateY(-50%) rotate(45deg);
}

.chat-page .message.owner::before {
  right: calc(var(--bubble-tail-size) / -2);
  left: auto;
}

.chat-page .message-row.is-assistant .message-avatar {
  border-color: transparent;
  background: transparent;
  overflow: visible;
}

.chat-page .message-row.is-assistant .message-avatar img {
  border-radius: 0;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.chat-page .source {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.28;
}

@media (max-width: 860px) {
  .chat-page .composer {
    min-height: 50px;
    padding: 6px 12px max(6px, env(safe-area-inset-bottom));
  }

  body.chat-mode.keyboard-active .composer {
    padding-bottom: 3px;
  }

  .chat-page .composer textarea {
    --composer-input-min-height: 40px;
    --composer-input-max-height: min(128px, 25dvh);
    padding: 9px 13px;
    line-height: 20px;
  }

  .chat-page .message {
    padding: 6px 10px;
  }

  .chat-page .message-stack {
    max-width: calc(100% - (var(--avatar-size) * 2) - (var(--bubble-gap) * 2));
  }

  .chat-page .source {
    font-size: 15px;
    line-height: 1.28;
  }
}

/* TChat final dark-surface refinements, 2026-05-23. */
html,
body.app-fixed-mode,
body.app-fixed-mode #app {
  background: var(--tchat-keyboard);
  overscroll-behavior: none;
}

body.app-fixed-mode .dashboard-page,
body.app-fixed-mode .user-shell-page,
body.chat-mode .chat-page {
  background: var(--tchat-keyboard);
}

.chat-page .quick-action-button,
.chat-page .choice-button {
  border-color: #3c4552;
  background: var(--tchat-control);
  color: #d7dde5;
  box-shadow: none;
}

.chat-page .quick-action-button:hover,
.chat-page .choice-button:hover {
  border-color: #5b6675;
  background: var(--tchat-control-hover);
  color: #ffffff;
}

.chat-page .quick-action-button.active,
.chat-page .choice-button.active {
  border-color: #69a0ff;
  background: #263a58;
  color: #dbe9ff;
}

.chat-page .quick-choice-panel {
  border-color: #343b46;
  background: var(--tchat-panel-strong);
  color: var(--tchat-text);
  box-shadow: none;
}

.settings-tab-panel #usagePanel .usage-description {
  grid-column: 1 / -1;
  width: 100%;
  max-width: none;
  margin: 0;
  color: #9ba5b2;
  font-size: 12px;
  line-height: 1.32;
  text-wrap: pretty;
}

.settings-tab-panel #usagePanel .usage-sync-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-top: 0;
}

.settings-tab-panel #usagePanel .usage-sync-row button {
  min-height: 32px;
  padding: 0 11px;
}

.provider-settings-card .api-status-panel {
  display: grid;
  gap: 10px;
}

.provider-settings-card .provider-badge {
  display: block;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 14px;
}

.provider-settings-card .auto-route {
  color: #9ba5b2;
  font-size: 13px;
  line-height: 1.45;
}

.group-member-option {
  grid-template-columns: 22px 40px minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
}

.group-member-option .contact-avatar {
  justify-self: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 12px;
  overflow: hidden;
}

.group-member-option .contact-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
}

.group-member-option > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 860px) {
  .chat-page .topbar {
    min-height: 48px;
    padding: 4px 10px;
  }

  .chat-page .chat-topbar {
    grid-template-columns: 36px minmax(0, 1fr) 36px;
  }

  .chat-page .mobile-menu-toggle,
  .chat-page .chat-back-button,
  .chat-page .more-dots-button,
  .chat-page .mobile-menu-toggle.more-dots-button {
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
  }

  .chat-page .timeline {
    gap: 9px;
    padding-top: 10px;
  }

  .chat-page .composer {
    min-height: 44px;
    gap: 2px;
    padding: 4px 10px 0;
  }

  body.chat-mode.keyboard-active .composer {
    padding-bottom: 0;
  }

  .chat-page .composer-row {
    gap: 6px;
  }

  .chat-page .composer textarea {
    --composer-input-min-height: 38px;
    padding: 8px 12px;
    line-height: 20px;
  }

  button.composer-gpt-toggle,
  button.composer-settings-toggle,
  button.file-upload-toggle {
    flex-basis: 38px;
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
  }

  .settings-tab-panel #usagePanel {
    gap: 7px 9px;
  }

  .settings-tab-panel #usagePanel .usage-description {
    font-size: 11px;
    line-height: 1.28;
  }

  .settings-tab-panel #usagePanel .usage-sync-row {
    grid-column: 1 / -1;
    align-items: center;
  }

  .settings-tab-panel #usagePanel .usage-sync-row span {
    flex: 1 1 150px;
    min-width: 0;
  }
}

/* TChat embedded header search and separator cleanup, 2026-05-23. */
.user-shell-page .topbar,
.chat-page .topbar {
  border-bottom: 0;
}

.app-tabbar,
.chat-page .composer {
  border-top: 0;
}

.dashboard-page .topbar {
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  grid-template-rows: auto auto;
  align-content: center;
  row-gap: 10px;
  min-height: auto;
  padding: 10px 16px 12px;
}

.dashboard-page .topbar .topbar-extra {
  grid-column: 1 / -1;
  width: 100%;
}

.dashboard-page .topbar .topbar-extra[hidden],
.dashboard-header-searches [hidden] {
  display: none;
}

.dashboard-header-searches {
  display: grid;
  width: 100%;
}

.dashboard-page .topbar .app-search-field-compact {
  width: 100%;
  min-height: 42px;
  margin: 0;
  border: 0;
  border-radius: 10px;
  background: #181a1d;
}

.dashboard-page .topbar .app-search-field-compact input {
  min-height: 30px;
}

.user-shell-page .app-shell-main {
  padding-top: 0;
}

@media (max-width: 860px) {
  .dashboard-page .topbar {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    padding: 8px 16px 10px;
  }
}

/* TChat admin language, usage card, and compact viewport fixes, 2026-05-23. */
:root {
  --tchat-header: #181a1d;
}

.dashboard-page .topbar {
  background: var(--tchat-keyboard);
}

.dashboard-page .topbar .app-search-field-compact {
  background: var(--tchat-header);
}

.chat-page .chat-main {
  grid-template-rows: minmax(0, 1fr) max-content;
  min-height: 0;
}

.chat-page .composer {
  flex-shrink: 0;
  min-height: max-content;
}

.chat-page .timeline {
  min-height: 0;
}

.settings-tab-panel #usagePanel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 12px;
  overflow: hidden;
  padding: 16px;
}

.settings-tab-panel #usagePanel .usage-heading {
  grid-column: 1 / -1;
  grid-row: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 2px 12px;
}

.settings-tab-panel #usagePanel .usage-heading h2 {
  min-width: 0;
  margin: 0;
  color: var(--tchat-text);
  font-size: clamp(22px, 5.6vw, 30px);
  line-height: 1.08;
}

.settings-tab-panel #usagePanel .usage-heading > strong {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: end;
  color: var(--tchat-text);
  font-size: clamp(42px, 14vw, 64px);
  line-height: 0.9;
  text-align: right;
}

.settings-tab-panel #usagePanel .usage-heading > span {
  color: var(--tchat-subtext);
  font-size: 12px;
  line-height: 1.2;
}

.settings-tab-panel #usagePanel .usage-bar {
  grid-column: 1 / -1;
  grid-row: auto;
  width: 100%;
  height: 8px;
  background: #2b3037;
}

.settings-tab-panel #usagePanel .usage-grid {
  grid-column: 1 / -1;
  grid-row: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.settings-tab-panel #usagePanel .usage-grid > div {
  min-width: 0;
  min-height: 62px;
  padding: 10px 10px 9px;
  border-radius: 12px;
}

.settings-tab-panel #usagePanel .usage-grid span {
  min-width: 0;
  color: var(--tchat-subtext);
  font-size: 11px;
  line-height: 1.18;
}

.settings-tab-panel #usagePanel .usage-grid strong {
  color: var(--tchat-text);
  font-size: clamp(18px, 5.2vw, 24px);
  line-height: 1.05;
  word-break: keep-all;
  overflow-wrap: normal;
}

.settings-tab-panel #usagePanel .usage-description {
  grid-column: 1 / -1;
  max-width: none;
  margin: 0;
  color: var(--tchat-subtext);
  font-size: 13px;
  line-height: 1.42;
  text-wrap: auto;
  word-break: normal;
  overflow-wrap: normal;
}

.settings-tab-panel #usagePanel .usage-sync-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 0;
}

.settings-tab-panel #usagePanel .usage-sync-row button {
  min-height: 36px;
  padding: 0 13px;
  border-color: #4b535f;
  background: #f5f7fa;
  color: #12161b;
  box-shadow: none;
}

.settings-tab-panel #usagePanel .usage-sync-row span {
  flex: 1 1 auto;
  min-width: 0;
  color: #8f98a4;
  font-size: 12px;
  line-height: 1.3;
}

@media (max-width: 860px) {
  .settings-tab-panel #usagePanel {
    gap: 10px;
    padding: 14px;
  }

  .settings-tab-panel #usagePanel .usage-heading h2 {
    font-size: clamp(22px, 6vw, 28px);
  }

  .settings-tab-panel #usagePanel .usage-grid {
    gap: 7px;
  }

  .settings-tab-panel #usagePanel .usage-grid strong {
    font-size: clamp(17px, 5vw, 22px);
  }

  .settings-tab-panel #usagePanel .usage-description {
    font-size: 12px;
    line-height: 1.36;
  }
}

@media (max-height: 560px) and (orientation: landscape) {
  .chat-page .topbar {
    min-height: 42px;
    padding-top: 3px;
    padding-bottom: 3px;
  }

  .chat-page .timeline {
    gap: 7px;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .chat-page .composer {
    min-height: 42px;
    padding-top: 3px;
    padding-bottom: 0;
  }

  .chat-page .composer-row {
    gap: 5px;
  }

  .chat-page .composer textarea {
    --composer-input-min-height: 36px;
    padding-top: 7px;
    padding-bottom: 7px;
  }

  button.composer-gpt-toggle,
  button.composer-settings-toggle,
  button.file-upload-toggle {
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    flex-basis: 36px;
  }
}

/* TChat dark palette unification and compact dashboard headers, 2026-05-23. */
:root {
  --tchat-blue: #3aa7f5;
  --tchat-blue-dark: #2188dc;
  --tchat-blue-soft: #22364b;
  --tchat-blue-border: #54b7ff;
  --accent: var(--tchat-blue);
  --accent-dark: var(--tchat-blue-dark);
  --bubble-owner: var(--tchat-blue);
}

button {
  box-shadow: 0 10px 22px rgba(58, 167, 245, 0.20);
}

button:hover {
  box-shadow: 0 8px 18px rgba(58, 167, 245, 0.22);
}

body.app-fixed-mode button.secondary:not(.more-dots-button):not(.password-eye-button),
body.chat-mode button.secondary:not(.more-dots-button):not(.password-eye-button) {
  border-color: #3a424d;
  background: var(--tchat-control);
  color: #d7dde5;
  box-shadow: none;
}

body.app-fixed-mode button.secondary:not(.more-dots-button):not(.password-eye-button):hover,
body.app-fixed-mode button.secondary:not(.more-dots-button):not(.password-eye-button):focus-visible,
body.chat-mode button.secondary:not(.more-dots-button):not(.password-eye-button):hover,
body.chat-mode button.secondary:not(.more-dots-button):not(.password-eye-button):focus-visible {
  border-color: #596575;
  background: var(--tchat-control-hover);
  color: var(--tchat-text);
  box-shadow: none;
}

body.app-fixed-mode button.secondary:disabled,
body.chat-mode button.secondary:disabled {
  border-color: #303741;
  background: #1b1f24;
  color: #697382;
}

.owner-login-form button[type="submit"],
.dashboard-room-form button[type="submit"],
.account-admin-form > button,
.composer button[type="submit"] {
  background: linear-gradient(145deg, #5cc2ff 0%, var(--tchat-blue) 48%, var(--tchat-blue-dark) 100%);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(58, 167, 245, 0.24);
}

.owner-login-form button[type="submit"]:hover,
.dashboard-room-form button[type="submit"]:hover,
.account-admin-form > button:hover,
.composer button[type="submit"]:hover {
  background: linear-gradient(145deg, #70cbff 0%, #45b2fb 48%, #257fd1 100%);
  box-shadow: 0 10px 22px rgba(58, 167, 245, 0.28);
}

#ownerLoginForm button[type="submit"],
.join-login-form button[type="submit"] {
  border-color: rgba(46, 214, 203, 0.30);
  background:
    radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.46), rgba(255, 255, 255, 0) 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0) 44%),
    linear-gradient(145deg, #2ed6cb 0%, #08b8dc 50%, #0798ec 100%);
  color: #ffffff;
  box-shadow:
    0 12px 24px rgba(3, 142, 212, 0.30),
    inset 1px 1px 0 rgba(255, 255, 255, 0.52),
    inset -2px -6px 12px rgba(2, 96, 177, 0.24);
}

#ownerLoginForm button[type="submit"]::after,
.join-login-form button[type="submit"]::after {
  background: linear-gradient(180deg, rgba(0, 84, 151, 0), rgba(0, 84, 151, 0.16));
}

#ownerLoginForm button[type="submit"]:hover,
.join-login-form button[type="submit"]:hover {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0) 42%),
    linear-gradient(145deg, #20d0c9 0%, #05add6 48%, #078bdd 100%);
  box-shadow:
    0 10px 22px rgba(3, 132, 201, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.50),
    inset 0 -4px 10px rgba(2, 96, 177, 0.22);
}

#ownerLoginForm button[type="submit"]:active,
.join-login-form button[type="submit"]:active {
  box-shadow:
    0 6px 14px rgba(3, 132, 201, 0.26),
    inset 0 3px 8px rgba(2, 96, 177, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.26);
}

.chat-page .quick-action-button.active,
.chat-page .choice-button.active,
button.composer-gpt-toggle.active,
button.composer-settings-toggle.active {
  border-color: var(--tchat-blue-border);
  background: var(--tchat-blue-soft);
  color: #dff1ff;
  box-shadow: none;
}

.app-tabbar button.active {
  background: transparent;
  color: var(--tchat-blue);
  box-shadow: none;
}

.app-tabbar-badge,
.conversation-unread-dot {
  background: var(--tchat-blue);
}

.app-tabbar button.active .app-tabbar-icon {
  filter: brightness(0) saturate(100%) invert(64%) sepia(73%) saturate(1334%) hue-rotate(176deg) brightness(102%) contrast(96%);
}

.settings-tab-panel > .account-admin-panel,
.settings-card,
.dashboard-modal {
  border-color: #303741;
  background: var(--tchat-panel-strong);
  color: var(--tchat-text);
}

.settings-card .notification-status-item {
  border-color: #303741;
  background: #20242a;
}

.settings-card .notification-status-item dt {
  color: #8f98a3;
}

.settings-card .notification-status-item dd {
  color: var(--tchat-text);
}

.settings-card .notification-status-item.is-ready dd {
  color: var(--tchat-green);
}

.settings-card .notification-status-item.is-waiting dd,
.settings-card .notification-status-item.is-off dd,
.settings-card .notification-status-item.is-unsupported dd {
  color: #98a2ad;
}

.settings-card .notification-status-item.is-failed dd {
  color: #ff8f8f;
}

.account-admin-list-shell {
  border-color: #303741;
  background: #20242a;
}

.account-admin-item {
  border: 1px solid #303741;
  background: #24282e;
  color: var(--tchat-text);
}

.account-admin-usage span {
  border: 1px solid #303741;
  background: #1b1f24;
  color: #aeb7c4;
}

.settings-card input,
.settings-card textarea,
.settings-card select,
.settings-card .account-admin-form input,
.dashboard-modal input,
.dashboard-modal textarea,
.dashboard-modal select,
.group-member-picker,
.group-member-option {
  border-color: #303741;
  background: #24282e;
  color: var(--tchat-text);
  box-shadow: none;
}

.settings-tab-panel #usagePanel .usage-sync-row button {
  border-color: #3a424d;
  background: var(--tchat-control);
  color: #d7dde5;
  box-shadow: none;
}

.settings-tab-panel #usagePanel .usage-sync-row button:not(:disabled) {
  border-color: transparent;
  background: linear-gradient(145deg, #5cc2ff 0%, var(--tchat-blue) 48%, var(--tchat-blue-dark) 100%);
  color: #ffffff;
}

.settings-tab-panel #usagePanel .usage-sync-row button:not(:disabled):hover,
.settings-tab-panel #usagePanel .usage-sync-row button:not(:disabled):focus-visible {
  background: linear-gradient(145deg, #70cbff 0%, #45b2fb 48%, #257fd1 100%);
}

.dashboard-page .topbar.topbar-has-extra {
  grid-template-columns: minmax(0, 1fr) 40px;
  grid-template-rows: 40px;
  align-items: center;
  align-content: center;
  column-gap: 8px;
  row-gap: 0;
  min-height: 48px;
  padding: 4px 12px;
}

.dashboard-page .topbar.topbar-has-extra .brand {
  grid-column: 1;
  grid-row: 1;
  z-index: 2;
  justify-self: start;
  min-width: 0;
  max-width: clamp(64px, 18vw, 102px);
  pointer-events: none;
}

.dashboard-page .topbar.topbar-has-extra .brand strong {
  overflow: hidden;
  color: var(--tchat-text);
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-page .topbar.topbar-has-extra .topbar-actions {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
}

.dashboard-page .topbar.topbar-has-extra .topbar-extra {
  grid-column: 1;
  grid-row: 1;
  z-index: 1;
  width: 100%;
  padding-left: clamp(74px, 17vw, 108px);
}

.dashboard-page .topbar.topbar-has-extra .app-search-field-compact {
  min-height: 38px;
  height: 38px;
  margin: 0;
  border-radius: 10px;
  background: var(--tchat-header);
}

.dashboard-page .topbar.topbar-has-extra .app-search-field-compact input {
  min-height: 28px;
  font-size: 16px;
}

@media (max-width: 430px) {
  .dashboard-page .topbar.topbar-has-extra {
    grid-template-columns: minmax(0, 1fr) 36px;
    padding: 4px 10px;
  }

  .dashboard-page .topbar.topbar-has-extra .topbar-extra {
    padding-left: 70px;
  }

  .dashboard-page .topbar.topbar-has-extra .app-search-field-compact {
    min-height: 36px;
    height: 36px;
  }
}

/* TChat title/header and composer corrections, 2026-05-23. */
.dashboard-page .topbar.topbar-has-extra {
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  grid-template-rows: 32px 38px;
  align-items: center;
  row-gap: 6px;
  min-height: 88px;
  padding: 7px 12px 8px;
}

.dashboard-page .topbar.topbar-has-extra .brand {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  max-width: 100%;
  pointer-events: auto;
  text-align: center;
}

.dashboard-page .topbar.topbar-has-extra .brand strong {
  justify-content: center;
  width: 100%;
  font-size: 18px;
  font-weight: 720;
}

.dashboard-page .topbar.topbar-has-extra .topbar-actions {
  grid-column: 3;
  grid-row: 1;
}

.dashboard-page .topbar.topbar-has-extra .topbar-extra {
  grid-column: 1 / -1;
  grid-row: 2;
  padding-left: 0;
}

.dashboard-page .topbar.topbar-has-extra .app-search-field-compact {
  height: 38px;
  min-height: 38px;
}

.chat-page .composer {
  min-height: 56px;
  gap: 6px;
  padding: 7px 12px max(7px, env(safe-area-inset-bottom));
}

body.chat-mode.keyboard-active .composer {
  padding-bottom: 5px;
}

.chat-page .composer-row {
  align-items: center;
  gap: 8px;
}

.chat-page .composer textarea {
  --composer-input-min-height: 42px;
  padding: 10px 13px;
  line-height: 20px;
}

button.composer-gpt-toggle,
button.composer-settings-toggle,
button.file-upload-toggle {
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  flex-basis: 42px;
}

button.composer-gpt-toggle {
  position: relative;
  border-color: #4b535f;
  background: #111418;
  color: #d7dde5;
}

button.composer-gpt-toggle.active,
button.composer-gpt-toggle[aria-pressed="true"] {
  border-color: #7ed3ff;
  background: linear-gradient(145deg, #5cc2ff 0%, var(--tchat-blue) 48%, var(--tchat-blue-dark) 100%);
  color: #ffffff;
  box-shadow:
    0 0 0 3px rgba(58, 167, 245, 0.22),
    0 10px 20px rgba(58, 167, 245, 0.28);
}

button.composer-gpt-toggle.active::after,
button.composer-gpt-toggle[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  right: 4px;
  top: 4px;
  width: 7px;
  height: 7px;
  border: 1.5px solid #ffffff;
  border-radius: 999px;
  background: #34c759;
}

button.composer-gpt-toggle.active img,
button.composer-gpt-toggle[aria-pressed="true"] img {
  filter: brightness(0) invert(1);
}

body.chat-mode button.composer-gpt-toggle.secondary.active,
body.chat-mode button.composer-gpt-toggle.secondary[aria-pressed="true"],
body.app-fixed-mode button.composer-gpt-toggle.secondary.active,
body.app-fixed-mode button.composer-gpt-toggle.secondary[aria-pressed="true"] {
  border-color: #7ed3ff;
  background: linear-gradient(145deg, #5cc2ff 0%, var(--tchat-blue) 48%, var(--tchat-blue-dark) 100%);
  color: #ffffff;
  box-shadow:
    0 0 0 3px rgba(58, 167, 245, 0.22),
    0 10px 20px rgba(58, 167, 245, 0.28);
}

@media (max-width: 860px) {
  .chat-page .topbar.chat-topbar {
    --chat-status-reserve: max(env(safe-area-inset-top), 4px);
    box-sizing: border-box;
    min-height: calc(48px + var(--chat-status-reserve));
    padding: var(--chat-status-reserve) 10px 0;
    align-items: center;
  }

  .chat-page .chat-topbar .topbar-leading,
  .chat-page .chat-topbar .brand,
  .chat-page .chat-topbar .topbar-actions {
    align-self: center;
  }

  .dashboard-page .topbar.topbar-has-extra {
    grid-template-columns: 36px minmax(0, 1fr) 36px;
    grid-template-rows: 30px 38px;
    min-height: 86px;
    padding: 6px 10px 8px;
  }

  .chat-page .composer {
    min-height: 54px;
    gap: 5px;
    padding: 7px 12px max(7px, env(safe-area-inset-bottom));
  }

  body.chat-mode.keyboard-active .composer {
    padding-bottom: 5px;
  }

  .chat-page .composer-row {
    gap: 7px;
  }

  .chat-page .composer textarea {
    --composer-input-min-height: 42px;
    padding: 10px 13px;
  }

  button.composer-gpt-toggle,
  button.composer-settings-toggle,
  button.file-upload-toggle {
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    flex-basis: 42px;
  }
}

@media (max-width: 860px) and (max-height: 560px) {
  .chat-page .topbar.chat-topbar {
    --chat-status-reserve: max(env(safe-area-inset-top), 24px);
  }
}

body.chat-mode.keyboard-active .quick-settings {
  display: none !important;
}

body.chat-mode.keyboard-active .composer {
  gap: 0;
  padding-top: 6px;
  padding-bottom: 2px;
}

body.chat-mode.keyboard-active .composer > .status:empty {
  display: none !important;
}

/* TChat iPad-first workspace shell, 2026-05-24. */
.chat-page .chat-shell {
  grid-template-columns: minmax(0, 1fr);
}

.chat-page .chat-workspace-sidebar {
  display: none;
}

.chat-page .side {
  position: fixed;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  z-index: 22;
  width: min(360px, calc(100vw - 36px));
  max-height: min(calc(var(--visual-viewport-height, 100dvh) - 48px), 640px);
  min-height: 0;
  padding: 0 16px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 22px;
  background: #17202a;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
  opacity: 0;
  transform: translate(-50%, calc(-50% + 12px)) scale(.98);
  transition: transform 180ms ease, opacity 160ms ease;
}

body:not(.side-open) .chat-page .side {
  display: none !important;
}

body:not(.side-open) .visitor-chat-page .side {
  display: none !important;
}

body:not(.members-open) .chat-page .members-drawer {
  display: none !important;
}

.chat-page .side-drawer-header {
  display: grid;
  position: sticky;
  top: 0;
  z-index: 2;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 58px;
  margin: 0 -16px 12px;
  padding: 12px 16px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px 22px 0 0;
  background: #17202a;
}

.chat-page .side-close-button {
  position: relative;
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  background: #20242a;
  color: var(--tchat-text);
  box-shadow: none;
}

.chat-page .side-close-button::before,
.chat-page .side-close-button::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 17px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: translate(-50%, -50%) rotate(45deg);
}

.chat-page .side-close-button::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.chat-page .side-close-button:hover,
.chat-page .side-close-button:focus-visible {
  border-color: #596575;
  background: var(--tchat-control-hover);
  box-shadow: none;
  transform: none;
}

.side-open .chat-page .chat-shell::before,
.members-open .chat-page .chat-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 21;
  background: rgba(8, 10, 12, 0.42);
}

.side-open .chat-page .side {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

@media (min-width: 768px) {
  .dashboard-page .topbar,
  .dashboard-page .app-shell-main,
  .dashboard-page .app-tabbar {
    width: min(760px, 100vw);
  }
}

@media (min-width: 900px) and (orientation: landscape) {
  .dashboard-page .topbar,
  .dashboard-page .app-shell-main,
  .dashboard-page .app-tabbar,
  .chat-page .topbar.chat-topbar,
  .chat-page .chat-shell {
    width: min(1180px, 100vw);
    margin-right: auto;
    margin-left: auto;
  }

  .dashboard-page .topbar,
  .dashboard-page .app-shell-main,
  .dashboard-page .app-tabbar {
    max-width: 860px;
  }

  .chat-page .chat-shell {
    grid-template-columns: minmax(280px, 34%) minmax(0, 1fr);
  }

  .chat-page .chat-workspace-sidebar {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    background: #181b1f;
  }

  .chat-workspace-header {
    display: grid;
    gap: 2px;
    padding: 14px 14px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  }

  .chat-workspace-header strong {
    color: var(--tchat-text);
    font-size: 18px;
    line-height: 1.12;
  }

  .chat-workspace-header span {
    overflow: hidden;
    color: var(--tchat-subtext);
    font-size: 12px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .chat-workspace-list {
    min-height: 0;
    padding: 8px 8px 14px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .chat-workspace-section {
    display: grid;
    gap: 4px;
    padding-bottom: 12px;
  }

  .chat-workspace-section > strong {
    padding: 8px 8px 5px;
    color: var(--tchat-muted);
    font-size: 11px;
    font-weight: 750;
    line-height: 1.2;
  }

  .chat-workspace-item {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 62px;
    padding: 8px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--tchat-text);
    box-shadow: none;
    text-align: left;
  }

  .chat-workspace-item:hover,
  .chat-workspace-item:focus-visible,
  .chat-workspace-item.active {
    background: var(--tchat-panel-soft);
    box-shadow: none;
  }

  .chat-workspace-avatar {
    position: relative;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    overflow: hidden;
    border-radius: 10px;
    background: #24282e;
  }

  .chat-workspace-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .chat-workspace-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
  }

  .chat-workspace-copy > span {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 8px;
  }

  .chat-workspace-copy strong,
  .chat-workspace-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .chat-workspace-copy strong {
    color: var(--tchat-text);
    font-size: 14px;
    font-weight: 750;
    line-height: 1.2;
  }

  .chat-workspace-copy time,
  .chat-workspace-copy small,
  .chat-workspace-empty {
    color: var(--tchat-subtext);
    font-size: 11px;
    line-height: 1.3;
  }

  .chat-workspace-empty {
    padding: 8px;
  }
}

/* TChat notification and navigation visual cleanup, 2026-05-24. */
body.app-fixed-mode .notification-control-panel button.secondary,
body.chat-mode .notification-control-panel button.secondary {
  border-color: #3a424d;
  background: var(--tchat-control);
  color: #d7dde5;
  box-shadow: none;
}

body.app-fixed-mode .notification-control-panel button.secondary:hover,
body.app-fixed-mode .notification-control-panel button.secondary:focus-visible,
body.chat-mode .notification-control-panel button.secondary:hover,
body.chat-mode .notification-control-panel button.secondary:focus-visible {
  border-color: #596575;
  background: var(--tchat-control-hover);
  color: var(--tchat-text);
  box-shadow: none;
}

body.app-fixed-mode .notification-status-item,
body.chat-mode .notification-status-item {
  border-color: #303741;
  background: #20242a;
  box-shadow: none;
}

body.app-fixed-mode .notification-status-item dt,
body.chat-mode .notification-status-item dt,
body.app-fixed-mode .notification-hint,
body.chat-mode .notification-hint,
body.app-fixed-mode .notification-test-result,
body.chat-mode .notification-test-result {
  color: #98a2ad;
}

body.app-fixed-mode .notification-status-item dd,
body.chat-mode .notification-status-item dd {
  color: var(--tchat-text);
}

body.app-fixed-mode .notification-status-item.is-ready dd,
body.chat-mode .notification-status-item.is-ready dd {
  color: var(--tchat-green);
}

body.app-fixed-mode .notification-status-item.is-failed dd,
body.chat-mode .notification-status-item.is-failed dd {
  color: #ff8f8f;
}

.user-shell-page .conversation-card-button,
.user-shell-page .contact-card {
  background: var(--tchat-panel);
}

.user-shell-page .conversation-card-button:hover,
.user-shell-page .conversation-card-button:focus,
.user-shell-page .conversation-card-button:focus-visible,
.user-shell-page .conversation-card-button:active,
.user-shell-page .contact-card:hover,
.user-shell-page .contact-card:focus,
.user-shell-page .contact-card:focus-visible,
.user-shell-page .contact-card:active {
  background: var(--tchat-panel-soft);
  box-shadow: none;
  transform: none;
}

.app-tabbar button {
  border-color: transparent;
  box-shadow: none;
}

.app-tabbar button:hover,
.app-tabbar button:focus,
.app-tabbar button:focus-visible,
.app-tabbar button:active {
  border-color: transparent;
  background: transparent;
  color: #8f98a3;
  box-shadow: none;
  transform: none;
}

.app-tabbar button.active,
.app-tabbar button.active:hover,
.app-tabbar button.active:focus,
.app-tabbar button.active:focus-visible,
.app-tabbar button.active:active {
  border-color: transparent;
  background: transparent;
  color: var(--tchat-blue);
  box-shadow: none;
  transform: none;
}

/* TChat mobile header and tabbar alignment, 2026-05-24. */
:root {
  --tchat-safe-area-top: env(safe-area-inset-top);
  --tchat-safe-area-bottom: env(safe-area-inset-bottom);
  --tchat-dashboard-safe-top: max(6px, var(--tchat-safe-area-top));
  --tchat-dashboard-title-height: 32px;
  --tchat-dashboard-search-height: 34px;
  --tchat-dashboard-header-gap: 4px;
  --tchat-dashboard-bottom-pad: 5px;
  --tchat-dashboard-header-total-height: calc(var(--tchat-dashboard-safe-top) + var(--tchat-dashboard-title-height) + var(--tchat-dashboard-header-gap) + var(--tchat-dashboard-search-height) + var(--tchat-dashboard-bottom-pad));
  --tchat-chat-safe-top: max(26px, var(--tchat-safe-area-top));
  --tchat-chat-title-height: 40px;
  --tchat-chat-bottom-pad: 4px;
  --tchat-chat-header-total-height: calc(var(--tchat-chat-safe-top) + var(--tchat-chat-title-height) + var(--tchat-chat-bottom-pad));
  --tchat-dashboard-title-only-height: var(--tchat-chat-header-total-height);
  --tchat-tabbar-safe-bottom: min(18px, max(10px, var(--tchat-safe-area-bottom)));
  --tchat-tabbar-top-pad: 10px;
  --tchat-tabbar-visual-bottom-pad: max(4px, calc(var(--tchat-tabbar-safe-bottom) - 6px));
  --tchat-tabbar-control-height: 46px;
  --tchat-tabbar-total-height: calc(4px + var(--tchat-tabbar-control-height) + var(--tchat-tabbar-safe-bottom));
  --tchat-tabbar-label-height: 16px;
  --tchat-tabbar-label-font-size: 12px;
  --tchat-composer-footer-min-height: 56px;
  --tchat-composer-safe-bottom: 7px;
  --tchat-composer-keyboard-bottom: 0px;
}

.user-shell-page {
  grid-template-rows: var(--tchat-dashboard-header-total-height) minmax(0, 1fr) var(--tchat-tabbar-total-height);
}

body.app-fixed-mode:not(.keyboard-active) #app,
body.chat-mode:not(.keyboard-active) #app {
  height: var(--visual-viewport-height, 100dvh);
}

body.is-standalone-app.app-fixed-mode:not(.keyboard-active) #app,
body.is-standalone-app.chat-mode:not(.keyboard-active) #app {
  top: 0;
  height: 100%;
}

body.is-standalone-app.chat-mode #app {
  top: 0;
  height: 100%;
}

body.is-standalone-app.app-fixed-mode.keyboard-active #app,
body.is-standalone-app.chat-mode.keyboard-active #app,
body.is-standalone-app.chat-mode:has(#messageInput:focus) #app {
  top: 0;
  height: 100%;
}

body.chat-mode:has(#messageInput:focus) #app {
  top: 0;
  height: 100%;
}

body.is-standalone-app.chat-mode.keyboard-active .chat-page,
body.is-standalone-app.chat-mode:has(#messageInput:focus) .chat-page {
  grid-template-rows: var(--tchat-chat-header-total-height) minmax(0, calc(100% - var(--tchat-chat-header-total-height) - var(--keyboard-overlay-height, 0px)));
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

body.chat-mode:has(#messageInput:focus) .chat-page {
  grid-template-rows: var(--tchat-chat-header-total-height) minmax(0, calc(100% - var(--tchat-chat-header-total-height) - var(--keyboard-overlay-height, 0px)));
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

body.is-standalone-app.chat-mode.keyboard-active .chat-page .topbar.chat-topbar,
body.is-standalone-app.chat-mode:has(#messageInput:focus) .chat-page .topbar.chat-topbar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 20;
  width: 100%;
  margin-right: auto;
  margin-left: auto;
}

body.chat-mode:has(#messageInput:focus) .chat-page .topbar.chat-topbar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 20;
  width: 100%;
  margin-right: auto;
  margin-left: auto;
}

body.is-standalone-app.chat-mode.keyboard-active .chat-page .chat-shell,
body.is-standalone-app.chat-mode:has(#messageInput:focus) .chat-page .chat-shell {
  grid-row: 2;
  height: 100%;
  max-height: 100%;
  min-height: 0;
}

body.chat-mode:has(#messageInput:focus) .chat-page .chat-shell {
  grid-row: 2;
  height: 100%;
  max-height: 100%;
  min-height: 0;
}

body.is-standalone-app.is-iphone-13-pro-max.app-fixed-mode:not(.keyboard-active) {
  --tchat-dashboard-safe-top: 2px;
  --tchat-dashboard-title-height: 32px;
  --tchat-dashboard-search-height: 32px;
  --tchat-dashboard-header-gap: 5px;
  --tchat-dashboard-bottom-pad: 4px;
  --tchat-dashboard-header-total-height: calc(var(--tchat-dashboard-safe-top) + var(--tchat-dashboard-title-height) + var(--tchat-dashboard-header-gap) + var(--tchat-dashboard-search-height) + var(--tchat-dashboard-bottom-pad));
  --tchat-chat-safe-top: 26px;
  --tchat-chat-title-height: 40px;
  --tchat-chat-bottom-pad: 4px;
  --tchat-chat-header-total-height: calc(var(--tchat-chat-safe-top) + var(--tchat-chat-title-height) + var(--tchat-chat-bottom-pad));
  --tchat-dashboard-title-only-height: var(--tchat-chat-header-total-height);
  --tchat-tabbar-safe-bottom: 36px;
  --tchat-tabbar-visual-bottom-pad: 30px;
  --tchat-tabbar-total-height: calc(4px + var(--tchat-tabbar-control-height) + var(--tchat-tabbar-safe-bottom));
}

body.is-standalone-app.is-iphone-13-pro-max.chat-mode:not(.keyboard-active) {
  --tchat-composer-footer-min-height: 88px;
  --tchat-composer-safe-bottom: 34px;
}

.dashboard-page .topbar.topbar-has-extra {
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  grid-template-rows: var(--tchat-dashboard-title-height) var(--tchat-dashboard-search-height);
  align-content: start;
  align-items: center;
  row-gap: var(--tchat-dashboard-header-gap);
  box-sizing: border-box;
  height: var(--tchat-dashboard-header-total-height);
  min-height: var(--tchat-dashboard-header-total-height);
  padding: var(--tchat-dashboard-safe-top) 14px var(--tchat-dashboard-bottom-pad);
}

.dashboard-page .topbar:not(.topbar-has-extra) {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  grid-template-rows: var(--tchat-chat-title-height);
  align-content: start;
  align-items: center;
  box-sizing: border-box;
  height: var(--tchat-dashboard-title-only-height);
  min-height: var(--tchat-dashboard-title-only-height);
  padding: var(--tchat-chat-safe-top) 14px var(--tchat-chat-bottom-pad);
}

.dashboard-page .topbar:not(.topbar-has-extra) .brand,
.dashboard-page .topbar:not(.topbar-has-extra) .topbar-actions {
  align-self: center;
}

.dashboard-page .topbar:not(.topbar-has-extra) .brand strong {
  font-size: 18px;
  line-height: var(--tchat-chat-title-height);
}

.dashboard-page .topbar.topbar-has-extra .brand,
.dashboard-page .topbar.topbar-has-extra .topbar-actions {
  align-self: center;
}

.dashboard-page .topbar.topbar-has-extra .brand strong {
  font-size: 18px;
  line-height: var(--tchat-dashboard-title-height);
}

.dashboard-page .topbar.topbar-has-extra .topbar-extra {
  align-self: stretch;
  padding-left: 0;
}

.dashboard-page .topbar.topbar-has-extra .app-search-field-compact {
  height: var(--tchat-dashboard-search-height);
  min-height: var(--tchat-dashboard-search-height);
}

.dashboard-page .topbar.topbar-has-extra .app-search-field-compact input {
  min-height: 30px;
  font-size: 16px;
}

.dashboard-page .app-shell-main {
  height: 100%;
  min-height: 0;
}

.chat-page {
  grid-template-rows: var(--tchat-chat-header-total-height) minmax(0, calc(100% - var(--tchat-chat-header-total-height) - var(--keyboard-overlay-height, 0px)));
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

.chat-page .topbar.chat-topbar {
  --chat-header-safe-area: var(--tchat-chat-safe-top);
  --chat-header-title-height: var(--tchat-chat-title-height);
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 20;
  box-sizing: border-box;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  width: 100%;
  margin-right: auto;
  margin-left: auto;
  height: var(--tchat-chat-header-total-height);
  min-height: var(--tchat-chat-header-total-height);
  padding: var(--chat-header-safe-area) 10px var(--tchat-chat-bottom-pad);
  align-items: center;
}

.chat-page .chat-shell {
  grid-row: 2;
  height: 100%;
  max-height: 100%;
  min-height: 0;
}

.chat-page .chat-shell,
.chat-page .chat-main,
.chat-page .timeline {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.chat-page .timeline {
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y;
}

.chat-page .message-row,
.chat-page .message-stack,
.chat-page .message,
.chat-page .source,
.chat-page .message-mentions,
.chat-page .message-quote,
.chat-page .message-inline-actions {
  min-width: 0;
}

.chat-page .message-row,
.chat-page .message,
.chat-page .source,
.chat-page .message-mentions,
.chat-page .message-quote,
.chat-page .message-inline-actions {
  max-width: 100%;
}

.chat-page .source {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.chat-page .chat-topbar .topbar-leading,
.chat-page .chat-topbar .brand,
.chat-page .chat-topbar .topbar-actions {
  align-self: center;
}

.chat-page .chat-topbar .brand strong {
  font-size: 18px;
  line-height: 1.2;
}

.chat-page .mobile-menu-toggle,
.chat-page .chat-back-button,
.chat-page .more-dots-button,
.chat-page .mobile-menu-toggle.more-dots-button {
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
}

.chat-page .composer {
  box-sizing: border-box;
  min-height: var(--tchat-composer-footer-min-height);
  padding: 7px 12px var(--tchat-composer-safe-bottom);
  flex-shrink: 0;
}

.app-tabbar {
  box-sizing: border-box;
  height: var(--tchat-tabbar-total-height);
  min-height: var(--tchat-tabbar-total-height);
  padding: var(--tchat-tabbar-top-pad) 0 var(--tchat-tabbar-visual-bottom-pad);
  align-items: start;
}

.app-tabbar button {
  display: grid;
  grid-template-rows: 26px var(--tchat-tabbar-label-height);
  justify-items: center;
  align-content: center;
  align-items: center;
  gap: 2px;
  min-height: var(--tchat-tabbar-control-height);
  padding: 0;
  font-size: var(--tchat-tabbar-label-font-size);
  line-height: var(--tchat-tabbar-label-height);
}

.chat-page .quick-settings[hidden],
.chat-page .quick-settings:empty {
  display: none !important;
}

body.chat-mode.keyboard-active .composer .quick-settings,
body.chat-mode.keyboard-active .composer .quick-action-row,
body.chat-mode.keyboard-active .composer .quick-choice-panel,
body.chat-mode.keyboard-active .composer .mention-suggestions,
.chat-page .composer.composer-keyboard-focus .quick-settings,
.chat-page .composer.composer-keyboard-focus .quick-action-row,
.chat-page .composer.composer-keyboard-focus .quick-choice-panel,
.chat-page .composer.composer-keyboard-focus .mention-suggestions {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
}

body.chat-mode:has(#messageInput:focus) .quick-settings,
body.chat-mode.keyboard-active .quick-settings,
.chat-page .composer.composer-keyboard-focus .quick-settings {
  display: none !important;
}

body.chat-mode:has(#messageInput:focus) .composer,
body.chat-mode.keyboard-active .composer,
.chat-page .composer.composer-keyboard-focus {
  min-height: 44px;
  gap: 0;
  padding: 2px 10px var(--tchat-composer-keyboard-bottom);
}

body.chat-mode:has(#messageInput:focus) .composer-row,
body.chat-mode.keyboard-active .composer-row,
.chat-page .composer.composer-keyboard-focus .composer-row {
  gap: 6px;
}

body.chat-mode.keyboard-active .composer textarea,
.chat-page .composer.composer-keyboard-focus textarea {
  --composer-input-min-height: 42px;
  padding: 10px 14px;
  line-height: 22px;
}

body.chat-mode.keyboard-active .composer > .status:empty,
.chat-page .composer.composer-keyboard-focus > .status:empty {
  display: none !important;
}

.chat-page .message-row.is-assistant .message-avatar {
  border-color: #3a424d;
  border-radius: 50%;
  background: #111418;
  overflow: hidden;
}

.chat-page .message-row.is-assistant .assistant-avatar-mark {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: #111418;
}

.chat-page .message-row.is-assistant .assistant-avatar-mark img {
  display: block;
  width: 58%;
  height: 58%;
  border-radius: 0;
  background: transparent;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.chat-page .message:has(.attachment-image-link),
.chat-page .message.owner:has(.attachment-image-link),
.chat-page .message-row.is-mentioned .message:has(.attachment-image-link),
.chat-page .message-row.is-mentioned.owner .message:has(.attachment-image-link) {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  box-shadow: none !important;
  filter: none !important;
}

.chat-page .message:has(.attachment-image-link)::before,
.chat-page .message.owner:has(.attachment-image-link)::before,
.chat-page .message-row.is-mentioned .message:has(.attachment-image-link)::before,
.chat-page .message-row.is-mentioned.owner .message:has(.attachment-image-link)::before {
  display: none !important;
}

.chat-page .attachment-image-link,
.chat-page .attachment-image {
  box-shadow: none !important;
  filter: none !important;
}

.app-tabbar-icon-wrap {
  grid-row: 1;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
}

.app-tabbar-icon {
  display: block;
  width: 24px;
  height: 24px;
  transform-origin: center;
}

.app-tabbar button[data-dashboard-tab="groups"] .app-tabbar-icon {
  transform: scale(1.24);
}

.app-tabbar button > span:last-child {
  display: grid;
  grid-row: 2;
  place-items: center;
  align-self: center;
  width: 100%;
  height: var(--tchat-tabbar-label-height);
  min-height: var(--tchat-tabbar-label-height);
  font-size: var(--tchat-tabbar-label-font-size);
  font-weight: 700;
  line-height: var(--tchat-tabbar-label-height);
  text-align: center;
  white-space: nowrap;
}

.user-shell-page .app-shell-main,
.settings-tab-panel,
.chat-page .timeline {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.user-shell-page .app-shell-main::-webkit-scrollbar,
.settings-tab-panel::-webkit-scrollbar,
.chat-page .timeline::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

@media (max-width: 430px) {
  .dashboard-page .topbar.topbar-has-extra {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    padding: var(--tchat-dashboard-safe-top) 14px var(--tchat-dashboard-bottom-pad);
  }

  .dashboard-page .topbar.topbar-has-extra .topbar-extra {
    padding-left: 0;
  }
}

/* TChat settings page lighter surface, 2026-05-25. */
.settings-tab-panel {
  min-height: 100%;
  gap: 12px;
  padding: 12px;
  background: #282c33;
  color: var(--tchat-text);
}

.settings-tab-panel > .settings-card,
.settings-tab-panel > .account-admin-panel {
  border-color: #3d4550;
  background: #2e343d;
  color: var(--tchat-text);
  box-shadow: none;
}

.settings-tab-panel .settings-card h2,
.settings-tab-panel .settings-card strong,
.settings-tab-panel .settings-card .account-admin-header strong,
.settings-tab-panel .account-admin-panel .account-admin-header strong,
.settings-tab-panel .account-admin-item strong {
  color: #f5f7fa;
}

.settings-tab-panel .settings-card p,
.settings-tab-panel .settings-card label,
.settings-tab-panel .settings-card .status,
.settings-tab-panel .settings-card .account-admin-header span,
.settings-tab-panel .account-admin-panel .account-admin-header span,
.settings-tab-panel .account-admin-item small,
.settings-tab-panel .account-admin-item em,
.settings-tab-panel #usagePanel .usage-description,
.settings-tab-panel #usagePanel .usage-sync-row span {
  color: #b4beca;
}

.settings-tab-panel .settings-card input,
.settings-tab-panel .settings-card textarea,
.settings-tab-panel .settings-card select,
.settings-tab-panel .settings-card .account-admin-form input,
.settings-tab-panel .profile-settings-form .profile-name-field input[type="text"] {
  border-color: #48515e;
  background: #38404a;
  color: #f5f7fa;
}

.settings-tab-panel .settings-card input::placeholder,
.settings-tab-panel .settings-card textarea::placeholder,
.settings-tab-panel .settings-card .account-admin-form input::placeholder,
.settings-tab-panel .profile-settings-form .profile-name-field input[type="text"]::placeholder {
  color: #a5afbc;
}

.settings-tab-panel #usagePanel .usage-bar {
  background: #39414b;
}

.settings-tab-panel #usagePanel .usage-grid > div,
.settings-tab-panel .settings-card .notification-status-item,
.settings-tab-panel .account-admin-list-shell,
.settings-tab-panel .account-admin-item {
  border-color: #46505c;
  background: #343b45;
  color: var(--tchat-text);
}

.settings-tab-panel .account-admin-usage span {
  border-color: #46505c;
  background: #3a424d;
  color: #c4ccd6;
}

.settings-tab-panel .settings-card .notification-status-item dt,
.settings-tab-panel #usagePanel .usage-grid span,
.settings-tab-panel #usagePanel .usage-grid small {
  color: #aeb7c4;
}

.settings-tab-panel .settings-card .notification-status-item dd,
.settings-tab-panel #usagePanel .usage-heading h2,
.settings-tab-panel #usagePanel .usage-heading > strong,
.settings-tab-panel #usagePanel .usage-grid strong,
.settings-tab-panel .account-admin-usage b {
  color: #ffffff;
}

.settings-tab-panel button.secondary:not(.more-dots-button):not(.password-eye-button),
.settings-tab-panel #usagePanel .usage-sync-row button {
  border-color: #6c879f;
  background: #4f6982;
  color: #f3f8fc;
  box-shadow: none;
}

.settings-tab-panel button.secondary:not(.more-dots-button):not(.password-eye-button):hover,
.settings-tab-panel button.secondary:not(.more-dots-button):not(.password-eye-button):focus-visible,
.settings-tab-panel #usagePanel .usage-sync-row button:not(:disabled):hover,
.settings-tab-panel #usagePanel .usage-sync-row button:not(:disabled):focus-visible {
  border-color: #82a6c4;
  background: #5d7892;
}

body.app-fixed-mode .settings-tab-panel button.secondary:not(.more-dots-button):not(.password-eye-button),
body.chat-mode .settings-tab-panel button.secondary:not(.more-dots-button):not(.password-eye-button),
body.app-fixed-mode .settings-tab-panel #usagePanel .usage-sync-row button,
body.chat-mode .settings-tab-panel #usagePanel .usage-sync-row button {
  border-color: #88a4bd;
  background: #607b96;
  color: #f5f9fc;
  box-shadow: none;
}

body.app-fixed-mode .settings-tab-panel button.secondary:not(.more-dots-button):not(.password-eye-button):hover,
body.app-fixed-mode .settings-tab-panel button.secondary:not(.more-dots-button):not(.password-eye-button):focus-visible,
body.chat-mode .settings-tab-panel button.secondary:not(.more-dots-button):not(.password-eye-button):hover,
body.chat-mode .settings-tab-panel button.secondary:not(.more-dots-button):not(.password-eye-button):focus-visible,
body.app-fixed-mode .settings-tab-panel #usagePanel .usage-sync-row button:not(:disabled):hover,
body.app-fixed-mode .settings-tab-panel #usagePanel .usage-sync-row button:not(:disabled):focus-visible,
body.chat-mode .settings-tab-panel #usagePanel .usage-sync-row button:not(:disabled):hover,
body.chat-mode .settings-tab-panel #usagePanel .usage-sync-row button:not(:disabled):focus-visible {
  border-color: #9fb9d0;
  background: #7290aa;
  color: #ffffff;
}
