:root {
  --color-surface: #ffffff;
  --color-surface-alt: #dbeafe;
  --color-surface-muted: #f8fafc;
  --color-surface-strong: #1f2937;
  --color-text-primary: #1f2937;
  --color-text-accent: #1c398e;
  --color-text-muted: #4b5563;
  --color-text-on-strong: #ffffff;
  --color-border: #d1d5db;
  --color-button-bg: #ffffff;
}

body.theme-dark {
  --color-surface: #0f172a;
  --color-surface-alt: #1e293b;
  --color-surface-muted: #111827;
  --color-surface-strong: #0b1120;
  --color-text-primary: #e2e8f0;
  --color-text-accent: #93c5fd;
  --color-text-muted: #cbd5f5;
  --color-text-on-strong: #f8fafc;
  --color-border: #1f2937;
  --color-button-bg: #1e293b;
}

body {
  background-color: var(--color-surface);
  color: var(--color-text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

body .bg-white,
body .bg-blue-50 {
  background-color: var(--color-surface) !important;
}

body .bg-blue-100 {
  background-color: var(--color-surface-alt) !important;
}

body .bg-gray-50,
body .bg-gray-100 {
  background-color: var(--color-surface-muted) !important;
}

body .bg-gray-900 {
  background-color: var(--color-surface-strong) !important;
}

body .border-gray-100,
body .border-gray-200,
body .border-gray-300 {
  border-color: var(--color-border) !important;
}

body select,
body select:focus,
body select:hover,
body option {
  background-color: var(--color-button-bg) !important;
  color: var(--color-text-primary) !important;
  border-color: var(--color-border) !important;
}

body.theme-dark select,
body.theme-dark select:focus,
body.theme-dark select:hover {
  background-color: #ffffff !important;
  color: #111827 !important;
  border-color: var(--color-border) !important;
}

body.theme-dark select option {
  background-color: #ffffff !important;
  color: #111827 !important;
}

body .text-black,
body .text-gray-900,
body .text-gray-700,
body .text-gray-600,
body .text-gray-500 {
  color: var(--color-text-primary) !important;
}

body .text-dark-blue-500,
body .text-blue-900,
body .text-blue-700,
body .text-blue-600 {
  color: var(--color-text-accent) !important;
}

body .text-white {
  color: var(--color-text-on-strong) !important;
}

body .text-gray-300,
body .text-gray-400 {
  color: var(--color-text-muted) !important;
}

body .bg-blue-900 {
  background-color: var(--color-text-accent) !important;
}

body .avatar-bg {
  background-color: rgba(28, 57, 142, 0.2);
}

body.theme-dark .avatar-bg {
  background-color: rgba(147, 197, 253, 0.3);
}

body .gabriel-bubble {
  background-color: var(--color-surface-alt) !important;
}

body.theme-dark .gabriel-bubble {
  background-color: var(--color-surface-alt) !important;
}

.theme-toggle {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  z-index: 20;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  border: 1px solid var(--color-border);
  background-color: var(--color-button-bg);
  color: var(--color-text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease,
    box-shadow 0.3s ease;
}

.theme-toggle:hover {
  background-color: var(--color-surface-alt);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.12);
}

.theme-toggle:focus {
  outline: 2px solid rgba(59, 130, 246, 0.4);
  outline-offset: 2px;
}

.theme-toggle svg {
  width: 1.1rem;
  height: 1.1rem;
}

body.theme-dark .theme-toggle svg[data-icon="moon"] {
  display: none;
}

body.theme-dark .theme-toggle svg[data-icon="sun"] {
  display: block;
}

.theme-toggle svg[data-icon="sun"] {
  display: none;
}

body:not(.theme-dark) .theme-toggle svg[data-icon="moon"] {
  display: block;
}

body:not(.theme-dark) .theme-toggle svg[data-icon="sun"] {
  display: none;
}

.fade-transition {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease,
    box-shadow 0.3s ease;
}

body [data-footer] {
  font-weight: 700;
}
