#my-profile {
  grid-column: 2;
  grid-row: 3;
  margin-top: 0;
  margin-left: 12px;
  margin-right: 0;
  text-align: left;
  width: fit-content;
}
.profile {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) 88px;
  grid-template-rows: 24px 16px 18px;
  column-gap: 10px;
  row-gap: 2px;
  padding: 12px;
  align-items: center;
}
.profile-details,
.profile-name-row {
  display: contents;
}
.profile #my-avatar {
  width: 62px;
  height: 62px;
  grid-column: 1;
  grid-row: 1 / 4;
  align-self: center;
}
.profile-name-row #my-name {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  max-width: none;
}
.profile #my-status {
  grid-column: 2;
  grid-row: 2;
  margin: 0;
  white-space: nowrap;
}
#theme-picker {
  grid-column: 3;
  grid-row: 1;
  width: 88px;
  min-width: 0;
  flex-shrink: 0;
  padding: 3px;
  font-size: 10px;
  height: 24px;
}
.profile #logout {
  grid-column: 3;
  grid-row: 3;
  justify-self: end;
  margin: 0;
  padding: 0;
  font-size: 10px;
  line-height: 18px;
}
body[data-theme]:not([data-theme="classic"]) {
  background: var(--bg);
  color: var(--text);
  border-color: var(--line);
}
body[data-theme]:not([data-theme="classic"])
  :is(
    .xp-window,
    .sidebar-scroll,
    .profile-card,
    .profile-bio,
    .buddy-panel,
    .chat-panel,
    #profile-editor,
    #profile-dialog
  ) {
  background: var(--panel);
  color: var(--text);
  border-color: var(--line);
}
body[data-theme]:not([data-theme="classic"])
  :is(
    .profile,
    .statusbar,
    .buddy-toolbar,
    .room-info,
    .im-person,
    .call-panel,
    .composer,
    .composer-tools,
    .category-heading,
    .appearance-controls,
    .appearance-example,
    #emoticon-picker
  ) {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}
body[data-theme]:not([data-theme="classic"]) .messages {
  background: var(--bg);
  scrollbar-color: var(--line) var(--bg);
}
body[data-theme]:not([data-theme="classic"])
  :is(button:not(.status-light), select) {
  background: linear-gradient(var(--button-top), var(--button-bottom));
  color: var(--text);
  border-color: var(--line);
  text-shadow: none;
}
body[data-theme]:not([data-theme="classic"]) button:hover {
  border-color: var(--cyan);
}
/* Native select popups cannot paint the closed control's gradient. Supply
   a solid fallback and explicit option colors, including editor dropdowns. */
body[data-theme]:not([data-theme="classic"]) select {
  background-color: var(--panel);
}
body[data-theme]:not([data-theme="classic"]) :is(option, optgroup) {
  background-color: var(--panel);
  color: var(--text);
}
body[data-theme]:not([data-theme="classic"]) option:checked {
  background-color: var(--surface);
  color: var(--text);
}
body[data-theme]:not([data-theme="classic"]) :is(input, textarea) {
  background: var(--input);
  color: var(--text);
  border-color: var(--line);
}
body[data-theme]:not([data-theme="classic"])
  :is(
    label,
    .section-label,
    .muted,
    .history-note,
    .empty-buddies,
    .category-empty,
    .composer-hint,
    .buddy-footer,
    .small,
    .statusbar,
    .empty-chat,
    .message-meta time,
    .room-info-actions
  ) {
  color: var(--muted);
}
body[data-theme]:not([data-theme="classic"])
  :is(.quiet, #my-profile, .im-person button) {
  background: transparent;
  color: var(--cyan);
}
body[data-theme]:not([data-theme="classic"]) :is(.titlebar, #window-chrome) {
  background: linear-gradient(var(--title-top), var(--title-bottom));
  color: var(--title-text);
  border-color: var(--line);
}
body[data-theme]:not([data-theme="classic"]) #window-caption {
  color: var(--title-text);
}
body[data-theme]:not([data-theme="classic"]) #window-menu {
  background: transparent;
}
body[data-theme]:not([data-theme="classic"])
  :is(.window-circle, .dialog-close-icon) {
  background: linear-gradient(var(--title-top), var(--title-bottom));
  color: var(--title-text);
  border-color: var(--line);
}
body[data-theme]:not([data-theme="classic"])
  :is(.window-circle:hover, .window-circle:focus-visible) {
  background: var(--cyan);
  color: var(--bg);
  box-shadow: 0 0 6px var(--cyan);
}
body[data-theme]:not([data-theme="classic"]) :is(.contact, .room) {
  background: transparent;
  color: var(--text);
}
body[data-theme]:not([data-theme="classic"])
  :is(
    .contact.active,
    .room.active,
    .tabs .selected,
    button[aria-pressed="true"]:not(.status-light)
  ) {
  background: var(--surface);
  border-color: var(--cyan);
  color: var(--text);
}
body[data-theme]:not([data-theme="classic"])
  :is(.primary, #toast, .upload-button) {
  background: linear-gradient(var(--button-top), var(--button-bottom));
  color: var(--text);
  border-color: var(--line);
}
body[data-theme]:not([data-theme="classic"])
  :is(.online-label, .message-meta strong, .room-topic strong, .empty-chat h3) {
  color: var(--cyan);
}
body[data-theme]:not([data-theme="classic"])
  :is(.avatar:not(:has(img)), .category-toggle) {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}
body[data-theme]:not([data-theme="classic"])
  :is(#profile-editor, #profile-dialog, .sidebar-scroll, .messages) {
  scrollbar-color: var(--line) var(--bg);
}
/* Profile bios retain their existing reading surface. */
body[data-theme]:not([data-theme="classic"])
  :is(#profile-bio, #profile-preview) {
  background: #102437;
  color: #e0edf8;
  border-color: var(--line);
}
body[data-theme]:not([data-theme="classic"])
  :is(#profile-bio, #profile-preview) {
  padding: 12px;
  border-radius: 4px;
  margin: 10px 0;
}
.profile-hero {
  --text: #e0edf8;
}

body[data-theme]:not([data-theme="classic"]) :is(button.contact, button.room) {
  background: transparent;
  box-shadow: none;
  border-color: transparent;
}
body[data-theme]:not([data-theme="classic"])
  :is(button.contact.active, button.room.active) {
  background: var(--surface);
  border-color: var(--line);
}
body[data-theme]:not([data-theme="classic"]) #my-status {
  color: var(--text);
}
body[data-theme]:not([data-theme="classic"]) #buddy-count {
  color: var(--muted);
}
body[data-theme]:not([data-theme="classic"]) #presence-notice {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}
body[data-theme]:not([data-theme="classic"]) .compose-row {
  background: var(--input);
}

/* A shared, gently lifted reading/writing surface for the colored dark themes. */
body[data-theme="classic"] {
  --chat-surface: #122638;
}
body[data-theme="evergreen"] {
  --chat-surface: #16372c;
}
body[data-theme="amethyst"] {
  --chat-surface: #2c2040;
}
body[data-theme="sunburst"] {
  --chat-surface: #3b2419;
}
body[data-theme="ruby"] {
  --chat-surface: #3b1c29;
}
body[data-theme="lagoon"] {
  --chat-surface: #15363d;
}
body:is(
    [data-theme="classic"],
    [data-theme="evergreen"],
    [data-theme="amethyst"],
    [data-theme="sunburst"],
    [data-theme="ruby"],
    [data-theme="lagoon"]
  )
  :is(.chat-main .messages, .compose-row, .styled-composer) {
  background: var(--chat-surface);
}
