html, body {
  font-size: 16px;
  min-height: 100%;
}

body {
  background: #f7f7fa;
}

/* Wordmark helpers (approximation; avoids bundling licensed fonts). */
.WordMarkLeft {
  letter-spacing: 0.02em;
  font-weight: 500;
}

.WordMarkRight {
  letter-spacing: 0.02em;
  font-weight: 800;
}

.theme-light {
  --bs-body-bg: #f7f7fa;
  --bs-body-color: #202533;
  --bs-primary: #0d6efd;
  --bs-primary-rgb: 13,110,253;
  --bs-secondary: #6c757d;
  --bs-link-color: #0d6efd;
  --bs-navbar-bg: #0f172a;
  --cw-card-bg: #ffffff;
  --cw-surface: #ffffff;
  --cw-border: #e5e7eb;
}

.theme-dark {
  --bs-body-bg: #0c111b;
  --bs-body-color: #e5e7ef;
  --bs-primary: #6cb8ff;
  --bs-primary-rgb: 108,184,255;
  --bs-secondary: #94a3b8;
  --bs-link-color: #6cb8ff;
  --bs-navbar-bg: #111827;
  --cw-card-bg: #111827;
  --cw-surface: #0f172a;
  --cw-border: #1f2937;
}

.theme-light body,
.theme-dark body {
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
}

header.nav-shell {
  background-color: var(--bs-navbar-bg);
}

.cw-navbar {
  background-color: var(--bs-navbar-bg);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05);
}

.cw-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  background: rgba(var(--bs-primary-rgb), 0.14);
  color: var(--bs-primary);
  border: 1px solid rgba(var(--bs-primary-rgb), 0.22);
}

.cw-avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 1.2rem;
}

.card {
  border-radius: 14px;
  background: var(--cw-card-bg);
  border: 1px solid var(--cw-border);
}

.avatar-64 {
  width: 64px;
  height: 64px;
  border-radius: 24%;
  overflow: hidden;
  position: relative;
  border: 2px solid #f1f1f5;
}

.avatar-64 img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.navbar-brand {
  letter-spacing: -0.01em;
}

.logo-dark,
.logo-light {
  height: 28px;
}

.theme-light .logo-light {
  display: none;
}

.theme-dark .logo-dark {
  display: none;
}

.onboarding-stepper__track {
  position: relative;
  height: 4px;
  background: var(--cw-border);
  border-radius: 999px;
  overflow: hidden;
}

.onboarding-stepper__progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--bs-primary);
  transition: width 200ms ease;
}

.onboarding-stepper__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}

.onboarding-stepper__dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--cw-border);
  background: var(--cw-surface);
  color: var(--bs-body-color);
  font-weight: 700;
}

.onboarding-stepper__item.is-current .onboarding-stepper__dot {
  border-color: var(--bs-primary);
  background: var(--bs-primary);
  color: #fff;
}

.onboarding-stepper__item.is-done .onboarding-stepper__dot {
  border-color: var(--bs-primary);
  color: var(--bs-primary);
}

.onboarding-stepper__text {
  font-size: 0.9rem;
  color: var(--bs-body-color);
}

/* Fixed-top navbar offset helpers (kept as classes for CSP-friendly toggling) */
body.nav-offset-wide {
  padding-top: 90px;
}

body.nav-offset-collapsed {
  padding-top: 66px;
}

body.nav-offset-expanded {
  padding-top: 180px;
}

/* Message rendering + WYSIWYG span-class contract */
.cw-message-body {
  white-space: pre-wrap;
  word-break: break-word;
}

.cw-carousel-compact {
  width: min(100%, 330px);
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--cw-border);
  background: var(--cw-surface);
}

.cw-carousel-compact .carousel,
.cw-carousel-compact .carousel-inner,
.cw-carousel-compact .carousel-item,
.cw-carousel-compact .carousel-item > a {
  height: 100%;
}

.cw-carousel-compact img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cw-carousel-hero {
  width: min(100%, 1200px);
  margin: 0 auto;
}

.cw-carousel-hero img {
  width: 100%;
  height: auto;
  display: block;
}

.cw-wysiwyg {
  min-height: 140px;
  white-space: pre-wrap;
  word-break: break-word;
  cursor: text;
}

.w-run {
  font-weight: normal;
  font-style: normal;
  text-decoration-line: none;
}

.w-bold { font-weight: 700; }
.w-italics { font-style: italic; }

.w-underline { text-decoration-line: underline; }
.w-strike { text-decoration-line: line-through; }
.w-underline.w-strike { text-decoration-line: underline line-through; }

/* DM: Thread */
.cw-thread-body {
  height: 56vh;
  overflow: auto;
  background: linear-gradient(180deg, rgba(var(--bs-tertiary-bg-rgb), 0.75), rgba(var(--bs-tertiary-bg-rgb), 0.25));
}

.cw-message-stack {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
}

.cw-message-stack.me {
  align-items: flex-end;
}

.cw-message-stack.them {
  align-items: flex-start;
}

.cw-bubble {
  max-width: 78%;
  min-width: 235px;
  border-radius: 0.85rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--cw-border);
  background: var(--cw-surface);
}

.cw-bubble.me {
  background: rgba(var(--bs-primary-rgb), 0.08);
  border-color: rgba(var(--bs-primary-rgb), 0.18);
}

.cw-load-older {
  text-align: center;
  font-size: 0.8rem;
  color: var(--bs-secondary-color);
  padding: 0.35rem 0;
}

.cw-attachments {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  max-width: 78%;
}

.cw-file {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.65rem;
  border-radius: 0.85rem;
  border: 1px solid var(--cw-border);
  background: var(--cw-surface);
  max-width: 100%;
  color: inherit;
}

.cw-file:hover {
  background: rgba(var(--bs-primary-rgb), 0.04);
}

.cw-file-preview {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  border-radius: 0.65rem;
  border: 1px solid rgba(var(--bs-secondary-rgb), 0.15);
  background: rgba(var(--bs-tertiary-bg-rgb), 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.cw-file-preview img {
  display: block;
  max-height: 64px;
  max-width: 64px;
  object-fit: cover;
}

.cw-file-icon {
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--bs-secondary-color);
}

.cw-file-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.cw-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.cw-file-size {
  font-size: 0.75rem;
  color: var(--bs-secondary-color);
}

/* DM: Composer attachment chips */
.cw-attach-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.cw-attach-item {
  width: 250px;
  max-width: 100%;
}

.cw-attach-chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border-radius: 0.85rem;
  border: 1px solid var(--cw-border);
  background: var(--cw-surface);
  padding: 0.55rem 0.65rem;
}

.cw-attach-meta {
  min-width: 0;
  flex: 1 1 auto;
}

.cw-attach-name {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  font-size: 0.875rem;
}

.cw-attach-size {
  font-size: 0.75rem;
  color: var(--bs-secondary-color);
}

.cw-attach-remove {
  border: 0;
  background: transparent;
  padding: 0.15rem 0.25rem;
  color: var(--bs-secondary-color);
  line-height: 1;
}

.cw-attach-remove:hover {
  color: var(--bs-danger);
}
