html {
  color-scheme: dark;
}

[data-theme="light"] html {
  color-scheme: light;
}
  --bg1: #0a0c12;
  --stroke: rgba(255, 255, 255, 0.1);
  --glow: rgba(124, 107, 255, 0.45);
  --aqua: #2be4d4;
  --accent: #7c6bff;
  --grid: rgba(255, 255, 255, 0.06);
}

[data-theme="light"] {
  --bg0: #f4f6ff;
  --bg1: #ffffff;
  --stroke: rgba(15, 23, 42, 0.12);
  --glow: rgba(124, 107, 255, 0.25);
  --grid: rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] body {
  color: #0f172a;
}

.brand-logo {
  display: block;
  background: radial-gradient(circle at 30% 20%, rgba(124, 107, 255, 0.12), transparent 55%);
}

/* ---------- Scrollbars (WebKit + Firefox) — all in-app surfaces ---------- */
body * {
  scrollbar-width: thin;
  scrollbar-color: rgba(124, 107, 255, 0.42) rgba(255, 255, 255, 0.06);
}

body *::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

body *::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 100px;
}

body *::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(124, 107, 255, 0.55), rgba(43, 228, 212, 0.35));
  border-radius: 100px;
  border: 2px solid rgba(5, 6, 10, 0.55);
  background-clip: padding-box;
}

body *::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(124, 107, 255, 0.75), rgba(43, 228, 212, 0.5));
  border-color: rgba(5, 6, 10, 0.45);
}

body *::-webkit-scrollbar-corner {
  background: transparent;
}

[data-theme="light"] body * {
  scrollbar-color: rgba(124, 107, 255, 0.5) rgba(15, 23, 42, 0.08);
}

[data-theme="light"] body *::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.06);
}

[data-theme="light"] body *::-webkit-scrollbar-thumb {
  border-color: rgba(255, 255, 255, 0.65);
}

.glass {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.noise {
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}

.chat-scroll {
  scroll-behavior: smooth;
}

#ws-grid {
  background-size: 32px 32px;
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  mask-image: radial-gradient(circle at center, black 55%, transparent 100%);
}

.widget {
  position: absolute;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(160deg, rgba(18, 20, 32, 0.92), rgba(10, 12, 18, 0.78));
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
  min-width: 220px;
  min-height: 140px;
  touch-action: none;
}

[data-theme="light"] .widget {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.92), rgba(244, 246, 255, 0.9));
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.widget.minimized {
  min-height: 0 !important;
  height: 44px !important;
}

.widget.minimized .widget-body {
  display: none;
}

.widget.fullscreen {
  left: 16px !important;
  top: 16px !important;
  width: calc(100% - 32px) !important;
  height: calc(100% - 32px) !important;
  z-index: 5000 !important;
  transform: none !important;
}

.widget-chrome {
  cursor: grab;
  user-select: none;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(90deg, rgba(124, 107, 255, 0.12), transparent);
}

.widget-chrome:active {
  cursor: grabbing;
}

.widget-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.9);
}

[data-theme="light"] .widget-title {
  color: #0f172a;
}

.widget-actions button {
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
  color: #e2e8f0;
}

[data-theme="light"] .widget-actions button {
  background: rgba(255, 255, 255, 0.7);
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.12);
}

.widget-actions button:hover {
  border-color: rgba(124, 107, 255, 0.55);
}

.widget-body {
  height: calc(100% - 44px);
  overflow: auto;
  padding: 10px;
  font-size: 12px;
}

.widget table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.widget th,
.widget td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 6px 8px;
  text-align: left;
}

[data-theme="light"] .widget th,
[data-theme="light"] .widget td {
  border-color: rgba(15, 23, 42, 0.08);
}

.widget th {
  color: rgba(226, 232, 240, 0.65);
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.msg-user .bubble {
  border-radius: 18px;
  border-top-right-radius: 6px;
  background: linear-gradient(120deg, rgba(124, 107, 255, 0.35), rgba(43, 228, 212, 0.18));
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.msg-assistant .bubble {
  border-radius: 18px;
  border-top-left-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
}

[data-theme="light"] .msg-assistant .bubble strong {
  color: #0f172a;
}

.msg-assistant .bubble strong {
  color: #f8fafc;
}

.code-block {
  margin-top: 10px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.code-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.code-head span {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.55);
}

.code-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.code-actions button {
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(124, 107, 255, 0.15);
  color: #e8ecff;
}

.code-actions button.secondary {
  background: rgba(43, 228, 212, 0.12);
}

pre code.hljs {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  line-height: 1.45;
}

.timestamp {
  font-size: 10px;
  color: rgba(148, 163, 184, 0.85);
  margin-top: 6px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(124, 107, 255, 0.9);
  display: inline-block;
  animation: bounce 1s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.toast {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 12, 18, 0.85);
  backdrop-filter: blur(14px);
  padding: 10px 12px;
  font-size: 12px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.45);
}

.suggest-chip {
  animation: chip-in 0.6s ease both;
}

@keyframes chip-in {
  from {
    transform: translateY(6px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.nav-item.active {
  background: rgba(124, 107, 255, 0.12);
  border: 1px solid rgba(124, 107, 255, 0.35);
}

.modal-panel {
  animation: modal-in 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes modal-in {
  from {
    transform: translateY(10px) scale(0.98);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

#workspace-viewport {
  cursor: default;
}

.ws-panning #workspace-viewport {
  cursor: grabbing;
}
