/*
 * @sigmashake/design-tokens - app shell and component layer.
 *
 * Use this file with tokens.css. Load tokens.css first.
 * Every value comes from a var(--ss-*) token. This file has no raw color.
 * Every class starts with ss-. Plain CSS. No framework. No font file.
 *
 * Layout:  ss-app = search bar over (rail | sidebar | main | detail).
 * Theme:   dark is the default. Set data-theme="light", "contrast" or "dark" on a parent.
 *          The setting of the operating system does not change the theme.
 * Density: set data-density="compact" on a parent.
 * Detail:  set data-detail="open" on ss-app to show the detail pane.
 * Drawer:  below 768px the rail and sidebar leave the page.
 *          Set data-drawer="open" on ss-app to show them.
 *
 * Red is the mark. Use it for fills, badges, unread and selected marks, and the focus ring.
 * Do not use red for text. Text on a red fill is black.
 * Use ss-app for app and console products. Marketing and content products use the
 * tokens and the controls only. Overlays and games do not use this file.
 */

[class^="ss-"],
[class*=" ss-"],
[class^="ss-"]::before,
[class*=" ss-"]::before,
[class^="ss-"]::after,
[class*=" ss-"]::after {
  box-sizing: border-box;
}

/* Focus. One ring for every control. The offset keeps the ring clear of a red fill. */
:where([class^="ss-"], [class*=" ss-"]):focus-visible {
  outline: 2px solid var(--ss-focus-ring);
  outline-offset: 2px;
}

/* Thin scrollbars. */
:where(.ss-app, .ss-app *, .ss-menu, .ss-modal *, .ss-quickswitch *) {
  scrollbar-width: thin;
  scrollbar-color: var(--ss-border-strong) transparent;
}

/* ---------- Shell ---------- */

.ss-app {
  display: grid;
  grid-template-columns: var(--ss-shell-rail-w) var(--ss-shell-sidebar-w) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "search search search"
    "rail sidebar main";
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  background: var(--ss-bg-main);
  color: var(--ss-text-normal);
  color-scheme: var(--ss-scheme);
  font-family: var(--ss-font-ui);
  font-size: var(--ss-fs-sm);
  line-height: 1.25;
}

.ss-app[data-detail="open"] {
  grid-template-columns: var(--ss-shell-rail-w) var(--ss-shell-sidebar-w) minmax(0, 1fr) var(--ss-shell-detail-w);
  grid-template-areas:
    "search search search search"
    "rail sidebar main detail";
}

.ss-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.ss-icon {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Top search bar. */
.ss-searchbar {
  grid-area: search;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: calc((var(--ss-shell-header-h) - var(--ss-shell-search-h)) / 2) 12px;
  background: var(--ss-bg-rail);
  border-bottom: 1px solid var(--ss-border-sidebar);
  color: var(--ss-text-sidebar);
  color-scheme: dark;
}

.ss-searchbar-box {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  max-width: 640px;
  height: var(--ss-shell-search-h);
  min-height: 0;
  padding: 0 8px 0 12px;
  font-family: inherit;
  font-size: var(--ss-fs-sm);
  text-align: left;
  background: var(--ss-bg-sidebar-hover);
  border: 1px solid var(--ss-text-sidebar-muted);
  border-radius: var(--ss-radius-md);
  color: var(--ss-text-sidebar-muted);
  cursor: text;
  transition: border-color var(--ss-dur-fast) var(--ss-ease);
}

.ss-searchbar-box:hover {
  border-color: var(--ss-text-sidebar-header);
}

.ss-searchbar-box:focus-within {
  outline: 2px solid var(--ss-focus-ring);
  outline-offset: 2px;
}

.ss-searchbar-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ss-searchbar-box input {
  flex: 1;
  min-width: 0;
  height: 100%;
  min-height: 0;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--ss-text-sidebar-header);
  font-family: inherit;
  font-size: var(--ss-fs-sm);
}

.ss-searchbar-box input::placeholder {
  color: var(--ss-text-sidebar-muted);
}

.ss-searchbar-box input:focus-visible {
  outline: none;
}

/* Rail. */
.ss-rail {
  grid-area: rail;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--ss-bg-rail);
  color: var(--ss-text-sidebar-muted);
  color-scheme: dark;
  scrollbar-width: none;
}

.ss-rail-item {
  position: relative;
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  min-height: 0;
  padding: 4px;
  background: transparent;
  border: 0;
  color: var(--ss-text-sidebar-muted);
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: color var(--ss-dur-fast) var(--ss-ease);
}

.ss-rail-icon {
  display: grid;
  place-items: center;
  width: var(--ss-shell-rail-icon);
  height: var(--ss-shell-rail-icon);
  overflow: hidden;
  background: var(--ss-bg-sidebar-hover);
  border-radius: 50%;
  color: var(--ss-text-sidebar-header);
  font-size: var(--ss-fs-md);
  font-weight: 700;
  transition: border-radius var(--ss-dur) var(--ss-ease), background var(--ss-dur) var(--ss-ease);
}

.ss-rail-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ss-rail-label {
  max-width: calc(var(--ss-shell-rail-w) - 8px);
  overflow: hidden;
  font-size: var(--ss-fs-xs);
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Left pill: 8px wide. 8px high for unread, 20px for hover, 40px for selected. */
.ss-rail-item::before {
  content: "";
  position: absolute;
  top: calc(4px + var(--ss-shell-rail-icon) / 2);
  left: 0;
  width: 8px;
  height: 0;
  background: var(--ss-accent);
  border-radius: 0 4px 4px 0;
  transform: translateY(-50%);
  transition: height var(--ss-dur) var(--ss-ease);
}

.ss-rail-item[data-unread]::before {
  height: 8px;
}

.ss-rail-item:hover::before,
.ss-rail-item:focus-visible::before {
  height: 20px;
}

.ss-rail-item[aria-current="page"]::before,
.ss-rail-item[data-selected]::before {
  height: 40px;
}

.ss-rail-item:hover,
.ss-rail-item:focus-visible,
.ss-rail-item[aria-current="page"],
.ss-rail-item[data-selected] {
  color: var(--ss-text-sidebar-header);
}

.ss-rail-item:hover .ss-rail-icon,
.ss-rail-item:focus-visible .ss-rail-icon,
.ss-rail-item[aria-current="page"] .ss-rail-icon,
.ss-rail-item[data-selected] .ss-rail-icon {
  background: var(--ss-bg-sidebar-active);
  border-radius: 16px;
}

.ss-rail-item[data-unread] {
  color: var(--ss-text-sidebar);
}

/*
 * The pill as an element. Use <span class="ss-rail-pill"> inside ss-rail-item when the
 * markup needs a real node. It replaces the pseudo-element above and has the same sizes.
 */
.ss-rail-item:has(.ss-rail-pill)::before {
  content: none;
}

.ss-rail-pill {
  position: absolute;
  top: calc(4px + var(--ss-shell-rail-icon) / 2);
  left: 0;
  width: 8px;
  height: 0;
  background: var(--ss-accent);
  border-radius: 0 4px 4px 0;
  transform: translateY(-50%);
  transition: height var(--ss-dur) var(--ss-ease);
}

.ss-rail-item[data-unread] .ss-rail-pill {
  height: 8px;
}

.ss-rail-item:hover .ss-rail-pill,
.ss-rail-item:focus-visible .ss-rail-pill {
  height: 20px;
}

.ss-rail-item[aria-current="page"] .ss-rail-pill,
.ss-rail-item[data-selected] .ss-rail-pill {
  height: 40px;
}

/* A badge on a rail item sits on the top right of the icon. */
.ss-rail-item .ss-badge {
  position: absolute;
  top: 0;
  right: 6px;
  box-shadow: 0 0 0 3px var(--ss-bg-rail);
}

.ss-rail-sep {
  flex: none;
  width: 32px;
  height: 2px;
  margin: 4px 0;
  background: var(--ss-border-sidebar);
  border-radius: 1px;
}

/* Sidebar. */
.ss-sidebar {
  --presence-cut: var(--ss-bg-sidebar);
  grid-area: sidebar;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--ss-bg-sidebar);
  color: var(--ss-text-sidebar);
  color-scheme: dark;
}

.ss-sidebar-header {
  position: relative;
  z-index: 1;
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: var(--ss-shell-header-h);
  padding: 0 16px;
  border-bottom: 1px solid var(--ss-border-sidebar);
  box-shadow: var(--ss-shadow-low);
  color: var(--ss-text-sidebar-header);
  font-size: var(--ss-fs-md);
  font-weight: 700;
}

.ss-sidebar-body {
  flex: 1;
  min-height: 0;
  padding: 8px 8px 16px;
  overflow-y: auto;
}

.ss-section {
  margin-top: 16px;
}

.ss-section:first-child {
  margin-top: 0;
}

.ss-section-header {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  min-height: 0;
  padding: 4px 8px;
  background: transparent;
  border: 0;
  color: var(--ss-text-sidebar-muted);
  font-family: inherit;
  font-size: var(--ss-section-fs);
  font-weight: var(--ss-section-fw);
  letter-spacing: var(--ss-section-ls);
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--ss-dur-fast) var(--ss-ease);
}

.ss-section-header:hover {
  color: var(--ss-text-sidebar-header);
}

.ss-section-header::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  margin: 0 4px 2px 2px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform var(--ss-dur) var(--ss-ease);
}

.ss-section-header[aria-expanded="false"]::before {
  margin: 0 4px 0 0;
  transform: rotate(-45deg);
}

/* A collapsed section hides its read channels. An unread or current channel stays in view. */
.ss-section-header[aria-expanded="false"] + .ss-section-list .ss-channel:not([data-unread]):not([data-mention]):not([aria-current]):not([data-selected]) {
  display: none;
}

/* A channel row. Use an a element or a button element. Both look the same. */
.ss-channel {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: var(--ss-row-h);
  margin: 0;
  padding: 0 8px;
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: var(--ss-row-radius);
  color: var(--ss-text-sidebar-muted);
  font-family: inherit;
  font-size: var(--ss-fs-md);
  line-height: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--ss-dur-fast) var(--ss-ease), color var(--ss-dur-fast) var(--ss-ease);
}

.ss-channel-glyph {
  flex: none;
  width: 20px;
  text-align: center;
}

.ss-channel-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ss-channel:hover {
  background: var(--ss-bg-sidebar-hover);
  color: var(--ss-text-sidebar);
}

.ss-channel[data-unread] {
  color: var(--ss-text-sidebar-header);
  font-weight: 700;
}

.ss-channel[aria-current="page"],
.ss-channel[data-selected] {
  background: var(--ss-bg-sidebar-selected);
  color: var(--ss-text-sidebar-header);
}

/* A child channel sits one level under its parent. Example: a split pane of a session. */
.ss-channel--child {
  padding-left: 28px;
  font-size: var(--ss-fs-sm);
}

/*
 * A channel row with actions. Put a ss-channel and a ss-channel-actions in a ss-channel-row.
 * The actions are siblings of the channel. A button must not hold another button.
 * The actions appear on hover and on keyboard focus. They stay in the tab order.
 */
.ss-channel-row {
  position: relative;
}

.ss-channel-actions {
  position: absolute;
  top: 50%;
  right: 4px;
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--ss-bg-sidebar-hover);
  border-radius: var(--ss-radius-xs);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%);
  transition: opacity var(--ss-dur-fast) var(--ss-ease);
}

.ss-channel-row:hover > .ss-channel-actions,
.ss-channel-row:focus-within > .ss-channel-actions {
  opacity: 1;
  pointer-events: auto;
}

.ss-channel-row:hover > .ss-channel:not([aria-current="page"]):not([data-selected]) {
  background: var(--ss-bg-sidebar-hover);
  color: var(--ss-text-sidebar);
}

.ss-channel[aria-current="page"] ~ .ss-channel-actions,
.ss-channel[data-selected] ~ .ss-channel-actions {
  background: var(--ss-bg-sidebar-selected);
}

/* A touch screen has no hover. Show the actions. */
@media (hover: none) {
  .ss-channel-actions {
    opacity: 1;
    pointer-events: auto;
  }
}

/* A collapsed section hides a whole read row, with its actions. */
.ss-section-header[aria-expanded="false"] + .ss-section-list .ss-channel-row:not(:has(> :is(.ss-channel[data-unread], .ss-channel[data-mention], .ss-channel[aria-current], .ss-channel[data-selected]))) {
  display: none;
}

.ss-userpanel {
  --presence-cut: var(--ss-bg-rail);
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  height: var(--ss-shell-userpanel-h);
  padding: 0 8px;
  background: var(--ss-bg-rail);
  border-top: 1px solid var(--ss-border-sidebar);
  color: var(--ss-text-sidebar);
}

.ss-userpanel-text {
  flex: 1;
  min-width: 0;
  line-height: 1.2;
}

.ss-userpanel-name {
  display: block;
  overflow: hidden;
  color: var(--ss-text-sidebar-header);
  font-size: var(--ss-fs-sm);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ss-userpanel-status {
  display: block;
  overflow: hidden;
  color: var(--ss-text-sidebar-muted);
  font-size: var(--ss-fs-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Main pane. */
.ss-main {
  grid-area: main;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--ss-bg-main);
  color: var(--ss-text-normal);
}

.ss-header {
  display: flex;
  flex: none;
  align-items: center;
  gap: 12px;
  height: var(--ss-shell-header-h);
  padding: 0 16px;
  background: var(--ss-bg-header);
  border-bottom: 1px solid var(--ss-border-subtle);
}

.ss-header-title {
  flex: none;
  margin: 0;
  color: var(--ss-text-header);
  font-size: var(--ss-fs-md);
  font-weight: 700;
}

.ss-header-topic {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding-left: 12px;
  overflow: hidden;
  border-left: 1px solid var(--ss-border-subtle);
  color: var(--ss-text-muted);
  font-size: var(--ss-fs-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ss-header-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.ss-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.ss-iconbtn.ss-drawer-toggle {
  display: none;
}

/* Detail pane. */
.ss-detail {
  --presence-cut: var(--ss-bg-detail);
  grid-area: detail;
  display: none;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--ss-bg-detail);
  border-left: 1px solid var(--ss-border-subtle);
  color: var(--ss-text-normal);
}

.ss-app[data-detail="open"] .ss-detail {
  display: flex;
}

.ss-detail-header {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: var(--ss-shell-header-h);
  padding: 0 8px 0 16px;
  border-bottom: 1px solid var(--ss-border-subtle);
  color: var(--ss-text-header);
  font-size: var(--ss-fs-md);
  font-weight: 700;
}

.ss-detail-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/*
 * A members list for the detail pane. A row has a ss-presence dot, a name and a note.
 * Use a div, a li, an a or a button for a row. Put a ss-member-group heading above each group.
 */
.ss-members {
  margin: 0;
  padding: 8px 8px 16px;
  list-style: none;
}

.ss-member-group {
  margin: 0;
  padding: 16px 8px 4px;
  color: var(--ss-text-muted);
  font-size: var(--ss-section-fs);
  font-weight: var(--ss-section-fw);
  letter-spacing: var(--ss-section-ls);
  text-transform: uppercase;
}

.ss-members > .ss-member-group:first-child {
  padding-top: 8px;
}

.ss-member {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: var(--ss-row-h);
  margin: 0;
  padding: 4px 8px;
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: var(--ss-row-radius);
  color: var(--ss-text-normal);
  font-family: inherit;
  font-size: var(--ss-fs-sm);
  line-height: 1.25;
  text-align: left;
  text-decoration: none;
}

a.ss-member,
button.ss-member {
  cursor: pointer;
  transition: background var(--ss-dur-fast) var(--ss-ease);
}

.ss-member:hover {
  --presence-cut: var(--ss-bg-hover);
  background: var(--ss-bg-hover);
}

.ss-member[aria-current],
.ss-member[data-selected] {
  --presence-cut: var(--ss-bg-selected);
  background: var(--ss-bg-selected);
  color: var(--ss-text-header);
}

.ss-member-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ss-member-meta {
  flex: none;
  color: var(--ss-text-muted);
  font-size: var(--ss-fs-xs);
}

/* ---------- Messages ---------- */

.ss-msg-group {
  margin-top: var(--ss-msg-gap);
}

.ss-msg {
  position: relative;
  display: grid;
  grid-template-columns: var(--ss-msg-gutter) minmax(0, 1fr);
  padding: var(--ss-msg-pad) 16px var(--ss-msg-pad) 0;
  color: var(--ss-text-normal);
  font-size: var(--ss-fs-md);
  line-height: var(--ss-lh-msg);
}

.ss-msg:hover,
.ss-msg:focus-within {
  background: var(--ss-bg-hover);
}

.ss-msg[data-mention] {
  background: var(--ss-brand-tint);
  box-shadow: inset 2px 0 0 var(--ss-accent);
}

.ss-msg-avatar {
  grid-column: 1;
  width: var(--ss-msg-avatar);
  height: var(--ss-msg-avatar);
  margin: 2px 0 0 calc((var(--ss-msg-gutter) - var(--ss-msg-avatar)) / 2);
  background: var(--ss-bg-active);
  border-radius: 50%;
  color: var(--ss-text-header);
  font-weight: 700;
  line-height: var(--ss-msg-avatar);
  text-align: center;
}

.ss-msg-body {
  grid-column: 2;
  min-width: 0;
  overflow-wrap: anywhere;
}

.ss-msg-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.ss-msg-author {
  color: var(--ss-text-header);
  font-weight: 700;
}

.ss-msg-time {
  color: var(--ss-text-muted);
  font-size: var(--ss-fs-xs);
}

.ss-msg-text {
  margin: 0;
}

/* The reply count under a message. It is a link-style button. It is underlined, so it is not only a color. */
.ss-msg-replies {
  grid-column: 2;
  justify-self: start;
  margin-top: 4px;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--ss-text-link);
  font-family: inherit;
  font-size: var(--ss-fs-xs);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* A thread in the detail pane. The divider names the replies. */
.ss-thread {
  display: grid;
}

.ss-thread-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 16px;
  color: var(--ss-text-muted);
  font-size: var(--ss-fs-xs);
}

.ss-thread-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--ss-border-strong);
}

/* A compact row continues a group. It has no avatar. The time shows in the gutter on hover. */
.ss-msg-compact .ss-msg-time {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
  align-self: center;
  padding-right: 8px;
  visibility: hidden;
}

.ss-msg-compact:hover .ss-msg-time,
.ss-msg-compact:focus-within .ss-msg-time {
  visibility: visible;
}

.ss-msg-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: var(--ss-msg-gap) 16px 0;
  color: var(--ss-text-muted);
  font-size: var(--ss-fs-xs);
  font-weight: 700;
}

.ss-msg-divider::before,
.ss-msg-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--ss-border-subtle);
}

.ss-msg-toolbar {
  position: absolute;
  top: -16px;
  right: 16px;
  z-index: 2;
  display: none;
  align-items: center;
  gap: 2px;
  padding: 2px;
  background: var(--ss-bg-floating);
  border: 1px solid var(--ss-border-subtle);
  border-radius: var(--ss-radius-md);
  box-shadow: var(--ss-shadow-low);
}

.ss-msg:hover .ss-msg-toolbar,
.ss-msg:focus-within .ss-msg-toolbar {
  display: flex;
}

.ss-composer {
  display: flex;
  flex: none;
  align-items: flex-end;
  gap: 8px;
  margin: 0 16px 24px;
  padding: 6px 8px;
  background: var(--ss-bg-input);
  border: 1px solid var(--ss-border-strong);
  border-radius: var(--ss-radius-md);
}

.ss-composer:focus-within {
  outline: 2px solid var(--ss-focus-ring);
  outline-offset: 2px;
}

.ss-composer textarea,
.ss-composer-input {
  flex: 1;
  min-width: 0;
  min-height: 28px;
  max-height: 50vh;
  padding: 4px 0;
  background: transparent;
  border: 0;
  color: var(--ss-text-normal);
  font-family: inherit;
  font-size: var(--ss-fs-md);
  line-height: var(--ss-lh-msg);
  resize: none;
}

.ss-composer textarea::placeholder,
.ss-composer-input::placeholder {
  color: var(--ss-text-muted);
}

.ss-composer textarea:focus-visible,
.ss-composer-input:focus-visible {
  outline: none;
}

/* ---------- Controls ---------- */

.ss-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  min-height: 0;
  padding: 0 16px;
  background: var(--ss-bg-selected);
  border: 1px solid transparent;
  border-radius: var(--ss-radius-sm);
  color: var(--ss-text-header);
  font-family: var(--ss-font-ui);
  font-size: var(--ss-fs-sm);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--ss-dur-fast) var(--ss-ease), box-shadow var(--ss-dur-fast) var(--ss-ease);
}

.ss-btn--sm {
  height: 32px;
  padding: 0 12px;
}

.ss-btn:hover {
  background: var(--ss-bg-active);
}

.ss-btn:active {
  transform: translateY(1px);
}

/* Primary: red fill, black text. The hover mark is the white edge. */
.ss-btn--primary {
  background: var(--ss-accent);
  border-color: var(--ss-accent);
  color: var(--ss-text-on-accent);
  font-weight: 700;
}

.ss-btn--primary:hover {
  background: var(--ss-accent);
  box-shadow: inset 0 0 0 2px var(--ss-brand-edge);
}

.ss-btn--secondary {
  background: var(--ss-bg-selected);
  border-color: var(--ss-border-subtle);
}

/* Danger: a red border. The red fill appears on hover. */
.ss-btn--danger {
  background: transparent;
  border-color: var(--ss-accent);
  color: var(--ss-text-header);
}

.ss-btn--danger:hover {
  background: var(--ss-accent);
  color: var(--ss-text-on-accent);
}

.ss-btn--ghost {
  background: transparent;
  color: var(--ss-text-normal);
}

.ss-btn--ghost:hover {
  background: var(--ss-bg-hover);
  color: var(--ss-text-header);
}

.ss-btn--link {
  height: auto;
  padding: 0;
  background: transparent;
  color: var(--ss-text-link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ss-btn--link:hover {
  background: transparent;
}

.ss-btn:disabled,
.ss-btn[aria-disabled="true"] {
  background: var(--ss-bg-selected);
  border-color: transparent;
  box-shadow: none;
  color: var(--ss-text-muted);
  cursor: not-allowed;
  transform: none;
}

.ss-iconbtn {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  min-height: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: var(--ss-radius-sm);
  color: var(--ss-interactive-normal);
  cursor: pointer;
  transition: background var(--ss-dur-fast) var(--ss-ease), color var(--ss-dur-fast) var(--ss-ease);
}

.ss-iconbtn:hover {
  background: var(--ss-bg-hover);
  color: var(--ss-interactive-hover);
}

.ss-iconbtn:active,
.ss-iconbtn[aria-pressed="true"] {
  color: var(--ss-interactive-active);
}

.ss-iconbtn:disabled {
  color: var(--ss-interactive-muted);
  cursor: not-allowed;
}

.ss-searchbar .ss-iconbtn,
.ss-sidebar .ss-iconbtn,
.ss-userpanel .ss-iconbtn {
  color: var(--ss-text-sidebar-muted);
}

.ss-searchbar .ss-iconbtn:hover,
.ss-sidebar .ss-iconbtn:hover,
.ss-userpanel .ss-iconbtn:hover {
  background: var(--ss-bg-sidebar-hover);
  color: var(--ss-text-sidebar-header);
}

.ss-link {
  color: var(--ss-text-link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ss-input,
.ss-select,
.ss-textarea {
  display: block;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  background: var(--ss-bg-input);
  border: 1px solid var(--ss-border-strong);
  border-radius: var(--ss-radius-sm);
  color: var(--ss-text-normal);
  color-scheme: var(--ss-scheme);
  font-family: var(--ss-font-ui);
  font-size: var(--ss-fs-sm);
  line-height: 1.25;
}

.ss-textarea {
  min-height: 80px;
  resize: vertical;
}

.ss-input::placeholder,
.ss-textarea::placeholder {
  color: var(--ss-text-muted);
}

.ss-input:hover,
.ss-select:hover,
.ss-textarea:hover {
  border-color: var(--ss-interactive-hover);
}

.ss-input[aria-invalid="true"],
.ss-select[aria-invalid="true"],
.ss-textarea[aria-invalid="true"] {
  border-color: var(--ss-accent);
}

.ss-input:disabled,
.ss-select:disabled,
.ss-textarea:disabled {
  color: var(--ss-text-muted);
  cursor: not-allowed;
}

.ss-label {
  display: block;
  margin-bottom: 8px;
  color: var(--ss-text-muted);
  font-size: var(--ss-section-fs);
  font-weight: var(--ss-section-fw);
  letter-spacing: var(--ss-section-ls);
  text-transform: uppercase;
}

/* Modal. 440px by default. Use --md for 600px and --lg for 800px. */
.ss-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--ss-bg-backdrop);
  font-family: var(--ss-font-ui);
}

.ss-backdrop[data-align="top"] {
  align-items: start;
  padding-top: 12vh;
}

.ss-modal {
  display: flex;
  flex-direction: column;
  width: min(100%, 440px);
  max-height: 100%;
  overflow: hidden;
  background: var(--ss-bg-floating);
  border: 1px solid var(--ss-border-subtle);
  border-radius: var(--ss-radius-md);
  box-shadow: var(--ss-shadow-high);
  color: var(--ss-text-normal);
  color-scheme: var(--ss-scheme);
  font-size: var(--ss-fs-sm);
  line-height: 1.375;
}

.ss-modal--md {
  width: min(100%, 600px);
}

.ss-modal--lg {
  width: min(100%, 800px);
}

.ss-modal-header {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 16px 8px 24px;
  color: var(--ss-text-header);
  font-size: var(--ss-fs-lg);
  font-weight: 700;
}

.ss-modal-body {
  flex: 1;
  min-height: 0;
  padding: 8px 24px 16px;
  overflow-y: auto;
}

.ss-modal-footer {
  display: flex;
  flex: none;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  background: var(--ss-bg-detail);
  border-top: 1px solid var(--ss-border-subtle);
}

/* Menu. */
.ss-menu {
  min-width: 188px;
  padding: 6px;
  background: var(--ss-bg-floating);
  border: 1px solid var(--ss-border-subtle);
  border-radius: var(--ss-radius-sm);
  box-shadow: var(--ss-shadow-high);
  color: var(--ss-text-normal);
  font-family: var(--ss-font-ui);
  font-size: var(--ss-fs-sm);
}

.ss-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: var(--ss-row-h);
  padding: 6px 8px;
  background: transparent;
  border: 0;
  border-radius: var(--ss-radius-xs);
  color: var(--ss-text-normal);
  font-family: inherit;
  font-size: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.ss-menu-item:hover,
.ss-menu-item[aria-selected="true"] {
  background: var(--ss-bg-selected);
  color: var(--ss-text-header);
}

.ss-menu-item--danger:hover {
  background: var(--ss-accent);
  color: var(--ss-text-on-accent);
}

.ss-menu-sep {
  height: 1px;
  margin: 6px 4px;
  background: var(--ss-border-subtle);
}

/* Tooltip. It sits above its parent. Use --right to put it at the right. */
.ss-has-tooltip {
  position: relative;
}

.ss-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 1100;
  padding: 6px 10px;
  background: var(--ss-bg-rail);
  border: 1px solid var(--ss-border-sidebar);
  border-radius: var(--ss-radius-sm);
  box-shadow: var(--ss-shadow-high);
  color: var(--ss-text-sidebar-header);
  font-family: var(--ss-font-ui);
  font-size: var(--ss-fs-sm);
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%);
  transition: opacity var(--ss-dur-fast) var(--ss-ease), visibility 0s linear var(--ss-dur-fast);
}

.ss-tooltip--right {
  bottom: auto;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
}

.ss-has-tooltip:hover > .ss-tooltip,
.ss-has-tooltip:focus-visible > .ss-tooltip,
.ss-tooltip[data-open] {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

/* Toast. */
.ss-toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ss-toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 360px;
  padding: 12px 16px;
  background: var(--ss-bg-floating);
  border: 1px solid var(--ss-border-subtle);
  border-left: 4px solid var(--ss-accent);
  border-radius: var(--ss-radius-sm);
  box-shadow: var(--ss-shadow-high);
  color: var(--ss-text-normal);
  font-family: var(--ss-font-ui);
  font-size: var(--ss-fs-sm);
  line-height: 1.375;
}

/* Badge. A mention pill. --new is a label for a new item. Text on the red is black. */
.ss-badge {
  display: inline-block;
  flex: none;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  background: var(--ss-accent);
  border-radius: 8px;
  color: var(--ss-text-on-accent);
  font-size: var(--ss-fs-xs);
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.ss-badge--new {
  height: auto;
  padding: 1px 6px;
  border-radius: var(--ss-radius-xs);
  letter-spacing: var(--ss-section-ls);
  line-height: 1.25;
  text-transform: uppercase;
}

/* Avatar and presence. The status is also a shape, not only a color. */
.ss-avatar {
  position: relative;
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  background: var(--ss-bg-active);
  border-radius: 50%;
  color: var(--ss-text-header);
  font-size: var(--ss-fs-sm);
  font-weight: 700;
}

.ss-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.ss-avatar .ss-presence {
  position: absolute;
  right: -2px;
  bottom: -2px;
}

.ss-presence {
  position: relative;
  display: inline-block;
  flex: none;
  width: 12px;
  height: 12px;
  background: var(--ss-presence-offline);
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--presence-cut, var(--ss-bg-main));
}

.ss-presence--online {
  background: var(--ss-presence-online);
}

.ss-presence--idle {
  background: var(--ss-presence-idle);
}

.ss-presence--idle::after {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  width: 6px;
  height: 6px;
  background: var(--presence-cut, var(--ss-bg-main));
  border-radius: 50%;
}

.ss-presence--dnd {
  background: var(--ss-presence-dnd);
}

.ss-presence--dnd::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 2px;
  width: 8px;
  height: 2px;
  background: var(--presence-cut, var(--ss-bg-main));
  border-radius: 1px;
}

.ss-presence--offline {
  background: transparent;
  border: 3px solid var(--ss-presence-offline);
}

/* Switch. Use an input with type checkbox and role switch. */
.ss-switch {
  position: relative;
  flex: none;
  width: 40px;
  height: 24px;
  min-height: 0;
  padding: 0;
  margin: 0;
  background: var(--ss-bg-selected);
  border: 1px solid var(--ss-border-strong);
  border-radius: 12px;
  cursor: pointer;
  appearance: none;
  transition: background var(--ss-dur) var(--ss-ease);
}

.ss-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--ss-interactive-normal);
  border-radius: 50%;
  transition: transform var(--ss-dur) var(--ss-ease);
}

.ss-switch:checked {
  background: var(--ss-accent);
  border-color: var(--ss-accent);
}

.ss-switch:checked::after {
  background: var(--ss-text-on-accent);
  transform: translateX(16px);
}

.ss-switch:disabled {
  cursor: not-allowed;
}

/* Tabs. */
.ss-tabs {
  display: flex;
  gap: 16px;
  border-bottom: 1px solid var(--ss-border-subtle);
}

.ss-tab {
  min-height: 0;
  padding: 8px 0;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--ss-text-muted);
  font-family: var(--ss-font-ui);
  font-size: var(--ss-fs-sm);
  font-weight: 600;
  cursor: pointer;
}

.ss-tab:hover {
  color: var(--ss-text-normal);
}

.ss-tab[aria-selected="true"] {
  border-bottom-color: var(--ss-accent);
  color: var(--ss-text-header);
}

/* Keyboard key. */
.ss-kbd {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  background: var(--ss-bg-input);
  border: 1px solid var(--ss-border-strong);
  border-bottom-width: 2px;
  border-radius: var(--ss-radius-xs);
  color: var(--ss-text-muted);
  font-family: var(--ss-font-mono);
  font-size: var(--ss-fs-xs);
  line-height: 1.5;
  text-align: center;
}

.ss-searchbar .ss-kbd {
  background: transparent;
  border-color: var(--ss-text-sidebar-muted);
  color: var(--ss-text-sidebar-muted);
}

/* Quick switcher. It is a dialog on a top-aligned backdrop. Open it with Ctrl+K. */
.ss-quickswitch {
  width: min(100%, 560px);
  overflow: hidden;
  background: var(--ss-bg-floating);
  border: 1px solid var(--ss-border-subtle);
  border-radius: var(--ss-radius-md);
  box-shadow: var(--ss-shadow-high);
  color: var(--ss-text-normal);
  color-scheme: var(--ss-scheme);
  font-family: var(--ss-font-ui);
  font-size: var(--ss-fs-sm);
}

.ss-quickswitch-input {
  display: block;
  width: 100%;
  height: 56px;
  padding: 0 16px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ss-border-subtle);
  color: var(--ss-text-header);
  font-family: inherit;
  font-size: var(--ss-fs-lg);
}

.ss-quickswitch-input::placeholder {
  color: var(--ss-text-muted);
}

.ss-quickswitch-input:focus-visible {
  outline: none;
  box-shadow: inset 0 -2px 0 var(--ss-focus-ring);
}

.ss-quickswitch-list {
  max-height: 320px;
  padding: 8px;
  overflow-y: auto;
}

.ss-quickswitch-foot {
  display: flex;
  gap: 16px;
  padding: 8px 16px;
  background: var(--ss-bg-detail);
  border-top: 1px solid var(--ss-border-subtle);
  color: var(--ss-text-muted);
  font-size: var(--ss-fs-xs);
}

/* Card. */
.ss-card {
  padding: 16px;
  background: var(--ss-bg-floating);
  border: 1px solid var(--ss-border-subtle);
  border-radius: var(--ss-radius-md);
  color: var(--ss-text-normal);
  font-family: var(--ss-font-ui);
  font-size: var(--ss-fs-sm);
  line-height: 1.375;
}

.ss-card-title {
  margin: 0 0 4px;
  color: var(--ss-text-header);
  font-size: var(--ss-fs-md);
  font-weight: 700;
}

.ss-card--link {
  display: block;
  text-decoration: none;
  transition: border-color var(--ss-dur-fast) var(--ss-ease);
}

.ss-card--link:hover {
  border-color: var(--ss-border-strong);
}

/* Marketing nav for content sites. It stays on the black field in both themes. */
.ss-navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 64px;
  padding: 8px 24px;
  background: var(--ss-bg-rail);
  border-bottom: 1px solid var(--ss-border-sidebar);
  color: var(--ss-text-sidebar);
  color-scheme: dark;
  font-family: var(--ss-font-ui);
  font-size: var(--ss-fs-sm);
}

.ss-navbar a {
  color: var(--ss-text-sidebar);
  font-weight: 600;
  text-decoration: none;
}

.ss-navbar a:hover {
  color: var(--ss-text-sidebar-header);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.ss-navbar a[aria-current="page"] {
  color: var(--ss-text-sidebar-header);
  box-shadow: 0 2px 0 var(--ss-accent);
}

.ss-navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ss-text-sidebar-header);
  font-size: var(--ss-fs-md);
  font-weight: 800;
}

.ss-navbar-links {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
}

.ss-navbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* ---------- Settings overlay ---------- */

/*
 * A full-screen settings view. It covers the page and sits above ss-backdrop.
 * Put ss-settings-nav, ss-settings-content and ss-settings-close in it.
 * Use role="dialog" and aria-modal="true" on ss-settings. The close button must have an aria-label.
 * The nav uses the sidebar colors, so it stays black in the light theme.
 * Mark the open category with aria-current="page".
 */
/* The thin scrollbar rule near the top of this file does not cover this overlay. */
:where(.ss-settings, .ss-settings *) {
  scrollbar-width: thin;
  scrollbar-color: var(--ss-border-strong) transparent;
}

.ss-settings {
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: grid;
  grid-template-columns: minmax(218px, 1fr) minmax(0, 820px) minmax(96px, 1fr);
  grid-template-rows: minmax(0, 1fr);
  background: var(--ss-bg-main);
  color: var(--ss-text-normal);
  color-scheme: var(--ss-scheme);
  font-family: var(--ss-font-ui);
  font-size: var(--ss-fs-sm);
  line-height: 1.375;
}

.ss-settings-nav {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-height: 0;
  padding: 60px 6px 60px 20px;
  overflow-y: auto;
  background: var(--ss-bg-sidebar);
  color: var(--ss-text-sidebar);
}

.ss-settings-nav-heading,
.ss-settings-nav-item {
  width: 192px;
  max-width: 100%;
}

.ss-settings-nav-heading {
  margin: 16px 0 4px;
  padding: 0 10px;
  color: var(--ss-text-sidebar-muted);
  font-size: var(--ss-section-fs);
  font-weight: var(--ss-section-fw);
  letter-spacing: var(--ss-section-ls);
  text-transform: uppercase;
}

.ss-settings-nav-heading:first-child {
  margin-top: 0;
}

.ss-settings-nav-item {
  display: block;
  min-height: var(--ss-row-h);
  margin: 0 0 2px;
  padding: 6px 10px;
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: var(--ss-radius-xs);
  color: var(--ss-text-sidebar-muted);
  font-family: inherit;
  font-size: var(--ss-fs-md);
  line-height: 1.25;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--ss-dur-fast) var(--ss-ease), color var(--ss-dur-fast) var(--ss-ease);
}

.ss-settings-nav-item:hover {
  background: var(--ss-bg-sidebar-hover);
  color: var(--ss-text-sidebar);
}

.ss-settings-nav-item[aria-current="page"] {
  background: var(--ss-bg-sidebar-selected);
  color: var(--ss-text-sidebar-header);
}

/* The content column scrolls. 740px of content, 60px of space above and 40px at each side. */
.ss-settings-content {
  grid-column: 2;
  min-width: 0;
  min-height: 0;
  padding: 60px 40px 80px;
  overflow-y: auto;
  background: var(--ss-bg-main);
}

/* The close button is a ring. The ESC caption below it is not read aloud. */
.ss-settings-close {
  position: absolute;
  top: 60px;
  right: 24px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  min-height: 0;
  margin: 0;
  padding: 0;
  appearance: none;
  background: transparent;
  border: 2px solid var(--ss-interactive-normal);
  border-radius: 50%;
  color: var(--ss-interactive-normal);
  font-family: inherit;
  cursor: pointer;
  transition: background var(--ss-dur-fast) var(--ss-ease), color var(--ss-dur-fast) var(--ss-ease), border-color var(--ss-dur-fast) var(--ss-ease);
}

.ss-settings-close::after {
  content: "ESC";
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  color: var(--ss-text-muted);
  font-size: var(--ss-fs-xs);
  font-weight: 700;
  letter-spacing: var(--ss-section-ls);
  pointer-events: none;
  transform: translateX(-50%);
}

.ss-settings-close:hover {
  background: var(--ss-bg-hover);
  border-color: var(--ss-interactive-hover);
  color: var(--ss-interactive-hover);
}

/* ---------- Medium screens: the detail pane covers the main pane ---------- */

@media (max-width: 1199px) {
  .ss-app[data-detail="open"] {
    grid-template-columns: var(--ss-shell-rail-w) var(--ss-shell-sidebar-w) minmax(0, 1fr);
    grid-template-areas:
      "search search search"
      "rail sidebar main";
  }

  .ss-app {
    position: relative;
  }

  .ss-app[data-detail="open"] .ss-detail {
    position: absolute;
    top: calc(var(--ss-shell-header-h) + 1px);
    right: 0;
    bottom: 0;
    z-index: 3;
    width: min(var(--ss-shell-detail-w), 100%);
    box-shadow: var(--ss-shadow-high);
  }
}

/* ---------- Small screens: the rail and sidebar become a drawer ---------- */

@media (max-width: 767px) {
  .ss-app,
  .ss-app[data-detail="open"] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "search"
      "main";
  }

  .ss-rail,
  .ss-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 900;
    visibility: hidden;
    transition: transform var(--ss-dur-slow) var(--ss-ease), visibility 0s linear var(--ss-dur-slow);
  }

  .ss-rail {
    left: 0;
    width: var(--ss-shell-rail-w);
    transform: translateX(-100%);
  }

  .ss-sidebar {
    left: var(--ss-shell-rail-w);
    width: min(var(--ss-shell-sidebar-w), calc(100% - var(--ss-shell-rail-w)));
    transform: translateX(calc(-100% - var(--ss-shell-rail-w)));
  }

  .ss-app[data-drawer="open"] .ss-rail,
  .ss-app[data-drawer="open"] .ss-sidebar {
    visibility: visible;
    transform: none;
    transition-delay: 0s;
  }

  /* The scrim. A click on it reaches ss-app, so a script can close the drawer. */
  .ss-app[data-drawer="open"]::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 800;
    background: var(--ss-bg-backdrop);
  }

  .ss-app[data-detail="open"] .ss-detail {
    position: fixed;
    inset: 0;
    z-index: 850;
    width: auto;
    box-shadow: none;
  }

  .ss-iconbtn.ss-drawer-toggle {
    display: inline-grid;
  }

  .ss-header-topic {
    display: none;
  }

  .ss-msg {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .ss-msg-avatar {
    margin-left: 8px;
  }

  .ss-navbar {
    flex-wrap: wrap;
    padding: 8px 16px;
  }
}

/* A narrow screen. The nav is a row above the content. */
@media (max-width: 767px) {
  .ss-settings {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .ss-settings-nav {
    grid-column: 1;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: 8px 56px 8px 8px;
    overflow: auto hidden;
  }

  .ss-settings-nav-heading,
  .ss-settings-nav-item {
    flex: none;
    width: auto;
    margin: 0;
    white-space: nowrap;
  }

  .ss-settings-nav-heading {
    padding: 0 4px 0 12px;
  }

  .ss-settings-nav-heading:first-child {
    padding-left: 4px;
  }

  .ss-settings-content {
    grid-column: 1;
    padding: 24px 16px 48px;
  }

  .ss-settings-close {
    top: 6px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-color: var(--ss-text-sidebar-muted);
    color: var(--ss-text-sidebar-muted);
  }

  .ss-settings-close::after {
    display: none;
  }

  .ss-settings-close:hover {
    background: var(--ss-bg-sidebar-hover);
    border-color: var(--ss-text-sidebar-header);
    color: var(--ss-text-sidebar-header);
  }
}

/* The hidden attribute wins over the display rules above. Keep this rule near the end. */
:where([class^="ss-"], [class*=" ss-"])[hidden] {
  display: none;
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  [class^="ss-"],
  [class*=" ss-"],
  [class^="ss-"]::before,
  [class*=" ss-"]::before,
  [class^="ss-"]::after,
  [class*=" ss-"]::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
