:root {
  color-scheme: dark;
  font-family: Geist, Satoshi, "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  transition: background 300ms ease, color 300ms ease, border-color 200ms ease, box-shadow 200ms ease;
  --bg: #080a0e;
  --bg-soft: #0c0f14;
  --panel: #111318;
  --panel-raised: #16181f;
  --panel-soft: #0d0f14;
  --text: #edf1f7;
  --muted: #8b92a3;
  --faint: #5c6273;
  --border: #202329;
  --strong-border: #2b2f3a;
  --accent: #FF7700;
  --accent-text: #ffffff;
  --accent-glow: rgba(255, 119, 0, 0.08);
  --danger: #f87171;
  --danger-bg: #1c1015;
  --bubble: #FF7700;
  --bubble-text: #ffffff;
  --code-bg: #05070a;
  --code-text: #d1d7e3;
  --selection: rgba(255, 119, 0, 0.18);
  background: var(--bg);
  color: var(--text);
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5f7;
  --bg-soft: #ffffff;
  --panel: #ffffff;
  --panel-raised: #ffffff;
  --panel-soft: #eceef2;
  --text: #0e1015;
  --muted: #4a5268;
  --faint: #6a7285;
  --border: #d8dce6;
  --strong-border: #c2c8d5;
  --accent: #FF7700;
  --accent-text: #ffffff;
  --accent-glow: rgba(255, 119, 0, 0.06);
  --danger: #b42318;
  --danger-bg: #fef2f2;
  --bubble: #FF7700;
  --bubble-text: #ffffff;
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --selection: rgba(255, 119, 0, 0.12);
}

:root[data-theme="embossed"] {
  color-scheme: dark;
  --bg: #0a0c12;
  --bg-soft: #0f111a;
  --panel: #151824;
  --panel-raised: #1b1e2c;
  --panel-soft: #11131c;
  --text: #edf1f7;
  --muted: #8b92a3;
  --faint: #5c6273;
  --border: #23283e;
  --strong-border: #30364f;
  --accent: #FF7700;
  --accent-text: #ffffff;
  --accent-glow: rgba(255, 119, 0, 0.08);
  --danger: #f87171;
  --danger-bg: #1c1015;
  --bubble: #FF7700;
  --bubble-text: #ffffff;
  --code-bg: #05070a;
  --code-text: #d1d7e3;
  --selection: rgba(255, 119, 0, 0.18);
  background: linear-gradient(135deg, #2c2f3c 0%, #0a0c12 100%);
}

:root[data-theme="embossed"] .app-shell {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    inset 1px 0 0 rgba(255, 255, 255, 0.04),
    inset 0 -1px 0 rgba(0, 0, 0, 0.45),
    inset -1px 0 0 rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  overflow: hidden;
}

::selection {
  background: var(--selection);
}

button,
textarea,
input,
select {
  font: inherit;
}

svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

button {
  border: 1px solid var(--strong-border);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 9px 13px;
  cursor: pointer;
  transition: transform 180ms var(--ease-spring), background 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

button:hover {
  border-color: color-mix(in srgb, var(--text) 50%, var(--strong-border));
  background: color-mix(in srgb, var(--panel-raised) 84%, transparent);
  box-shadow: 0 1px 6px rgba(0,0,0,0.2);
}

button:active {
  transform: translateY(1px) scale(0.98);
}

button:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

button.primary:disabled {
  animation: pulse-opacity 1s ease-in-out infinite;
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

button.primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, var(--bg));
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.app-shell {
  height: 100vh;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 50% at 50% -8%, rgba(255, 255, 255, 0.03) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 50% 105%, rgba(255, 255, 255, 0.015) 0%, transparent 60%),
    var(--bg);
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  box-sizing: border-box;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 52px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
  padding: 0 14px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 11px;
}

.brand-mark {
  display: flex;
  align-items: center;
  height: 28px;
  flex-shrink: 0;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 10px;
}

.brand-img {
  height: 100%;
  width: auto;
  display: block;
  overflow: visible;
}

.brand-mark:hover {
  background: transparent;
  box-shadow: none;
  opacity: 0.92;
}

.brand-mark:active {
  transform: scale(0.99);
}

.app-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 300ms ease, box-shadow 300ms ease;
}

.status-dot[data-state="checking"] {
  background: var(--faint);
  animation: pulse-dot 1.4s ease-in-out infinite;
}

.status-dot[data-state="connected"] {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

.status-dot[data-state="missing"] {
  background: var(--faint);
}

.provider-status {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  line-height: 1.3;
  white-space: nowrap;
}

.model-select {
  font-size: 11px;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: color-mix(in srgb, var(--panel) 50%, transparent);
  color: var(--muted);
  cursor: pointer;
  max-width: 120px;
  font-family: inherit;
  font-weight: 500;
  transition: border-color 200ms ease, color 200ms ease, background 200ms ease;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='6'%3E%3Cpath d='M1 1l3 3 3-3' stroke='%237b8293' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  padding-right: 20px;
}

.model-select:hover {
  border-color: var(--strong-border);
  color: var(--text);
}

.model-select:focus {
  outline: none;
  border-color: var(--accent);
  color: var(--text);
  background-color: color-mix(in srgb, var(--panel) 70%, transparent);
}

.model-select option {
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  padding: 4px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  padding: 6px 10px;
  color: color-mix(in srgb, var(--text) 80%, var(--muted));
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

.nav-button:hover {
  background: color-mix(in srgb, var(--muted) 10%, transparent);
  color: var(--text);
}

.nav-button:active {
  background: color-mix(in srgb, var(--muted) 16%, transparent);
}

.nav-button svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--muted);
  transition: color 150ms ease;
}

.nav-button:hover svg {
  color: var(--text);
}

.nav-label {
  font-size: 13px;
}

.nav-button.spinning svg {
  animation: spin 600ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.conversation {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  overflow-x: hidden;
  width: min(720px, calc(100% - 34px));
  margin: 0 auto;
  padding: 28px 0 32px;
  scrollbar-color: var(--strong-border) transparent;
  scrollbar-width: thin;
  min-height: 0;
}

.conversation::-webkit-scrollbar {
  width: 6px;
}

.conversation::-webkit-scrollbar-track {
  background: transparent;
}

.conversation::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--strong-border) 70%, transparent);
  border-radius: 999px;
}

.conversation > :last-child {
  margin-bottom: 6px;
}

.empty-state {
  display: grid;
  min-height: 100%;
  align-content: center;
  justify-items: center;
  padding: 40px 24px;
  text-align: center;
  box-sizing: border-box;
  flex-shrink: 0;
}

.empty-state::before {
  content: "";
  display: block;
  width: 72px;
  height: 72px;
  margin-bottom: 24px;
  background-image: url("../../frubot-orange.svg");
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

:root[data-theme="light"] .empty-state::before {
  background-image: url("../../frubot-orange.svg");
}

.empty-state h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(24px, 2.6vw, 32px);
  font-weight: 760;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.empty-state > p {
  max-width: 460px;
  margin: 10px auto 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.empty-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.empty-chip {
  border: 1px solid var(--border);
  background: var(--panel-soft);
  padding: 7px 13px;
  font-size: 12px;
  font-weight: 650;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 200ms ease, background 200ms ease, transform 120ms ease;
}

.empty-chip:hover {
  border-color: color-mix(in srgb, var(--text) 40%, var(--border));
  background: var(--panel);
  transform: translateY(-1px);
}

.empty-chip:active {
  transform: translateY(0) scale(0.97);
}

.empty-state[hidden] {
  display: none;
}

.message-row {
  display: flex;
  animation: rise-in 200ms var(--ease-spring) both;
}

.message-row.loading-row {
  animation: none;
}

.user-row {
  justify-content: flex-end;
}

.user-row .user-bubble {
  animation: pop-in 280ms var(--ease-bounce) both;
}

.user-bubble {
  max-width: min(390px, 76%);
  border-radius: 22px;
  background: var(--bubble);
  color: var(--bubble-text);
  padding: 13px 16px;
  font-size: 14px;
  line-height: 1.45;
}

.user-bubble p {
  margin: 0;
}

.bubble-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.bubble-files span {
  max-width: 240px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-chip.has-preview {
  max-width: 300px;
  width: 100%;
  padding: 0;
  border-radius: 14px;
  display: grid;
  gap: 0;
  white-space: normal;
  text-align: left;
  animation: pop-in 280ms var(--ease-bounce) both;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, currentColor 14%, transparent);
  background: color-mix(in srgb, var(--panel-soft) 60%, transparent);
}

.file-preview {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  display: block;
  background:
    linear-gradient(45deg, color-mix(in srgb, var(--bubble-text) 10%, transparent) 25%, transparent 25%),
    linear-gradient(-45deg, color-mix(in srgb, var(--bubble-text) 10%, transparent) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, color-mix(in srgb, var(--bubble-text) 10%, transparent) 75%),
    linear-gradient(-45deg, transparent 75%, color-mix(in srgb, var(--bubble-text) 10%, transparent) 75%),
    color-mix(in srgb, var(--panel-soft) 72%, transparent);
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
  background-size: 14px 14px;
  transition: opacity 300ms ease;
  opacity: 0;
}

.file-preview[src] {
  opacity: 1;
}

.file-video-preview {
  min-height: 150px;
  background: #05070a;
}

.file-chip.has-preview .file-label {
  padding: 6px 10px 8px;
  font-size: 11px;
  color: color-mix(in srgb, currentColor 80%, transparent);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inline-file-previews {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.inline-file-preview {
  display: grid;
  grid-template-columns: minmax(220px, 42%) minmax(0, 1fr);
  align-items: stretch;
  gap: 16px;
  width: 100%;
  min-height: 168px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel-soft);
  padding: 12px;
  text-align: left;
}

.inline-file-preview:hover {
  border-color: var(--strong-border);
  background: var(--panel-raised);
}

.inline-file-thumb {
  display: grid;
  width: 100%;
  min-height: 156px;
  aspect-ratio: 16 / 10;
  place-items: center;
  overflow: hidden;
  border-radius: 14px;
  background: color-mix(in srgb, var(--text) 7%, transparent);
}

.inline-file-thumb span {
  color: var(--muted);
  font-family: "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  font-size: 11px;
  font-weight: 800;
}

.inline-file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background:
    linear-gradient(45deg, color-mix(in srgb, var(--text) 5%, transparent) 25%, transparent 25%),
    linear-gradient(-45deg, color-mix(in srgb, var(--text) 5%, transparent) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, color-mix(in srgb, var(--text) 5%, transparent) 75%),
    linear-gradient(-45deg, transparent 75%, color-mix(in srgb, var(--text) 5%, transparent) 75%),
    var(--panel);
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
  background-size: 14px 14px;
}

.inline-file-meta {
  display: grid;
  align-content: center;
  min-width: 0;
  gap: 6px;
}

.inline-file-meta strong,
.inline-file-meta small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inline-file-meta strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.inline-file-meta small {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 640px) {
  .inline-file-preview {
    grid-template-columns: 1fr;
  }

  .inline-file-thumb {
    width: 100%;
    min-height: 180px;
    max-height: 260px;
  }
}

.inline-file-preview.is-missing {
  opacity: 0.65;
}

.download-btn-image {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  align-items: center;
  gap: 10px;
}

.download-thumb {
  width: 60px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  background: var(--panel-soft);
  transition: opacity 300ms ease;
  opacity: 0;
}

.download-thumb[src] {
  opacity: 1;
}

.agent-card {
  width: min(560px, 100%);
  border: 1px solid var(--border);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  padding: 16px 17px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 1px 3px rgba(0, 0, 0, 0.12);
  position: relative;
  animation: card-fade 300ms var(--ease-smooth) both;
  transition: box-shadow 240ms ease, border-color 240ms ease;
  box-sizing: border-box;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.agent-card:hover {
  border-color: color-mix(in srgb, var(--strong-border) 80%, var(--accent));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 4px 16px rgba(0, 0, 0, 0.2);
}

.agent-card::before {
  content: "";
  position: absolute;
  top: 12px;
  left: -1px;
  width: 3px;
  height: 24px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  opacity: 0.4;
}

.agent-card header {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
}

.message-source {
  display: none;
}

.agent-card h2 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 780;
}

.agent-card header p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.blocks {
  display: grid;
  gap: 13px;
}

.text-block h3,
.choice-block h3,
.ui-form h3,
.file-picker h3 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 760;
}

.text-block p {
  margin: 0;
  color: color-mix(in srgb, var(--text) 90%, var(--muted));
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.choice-block {
  display: grid;
  gap: 10px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-row button {
  min-height: 34px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 650;
}

.error-card {
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
  background: var(--danger-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.error-card::before {
  background: var(--danger);
  opacity: 0.7;
}

.error-card h2 {
  color: var(--danger);
}

.file-picker {
  display: grid;
  gap: 8px;
}

.file-picker > div {
  display: contents;
}

.file-picker p {
  display: grid;
  min-height: 57px;
  margin: 0;
  place-items: center;
  border: 1px dashed var(--strong-border);
  border-radius: 15px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.file-picker button {
  justify-self: stretch;
  border-style: dashed;
  color: var(--muted);
}

.summary-block {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.summary-block div {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 11px;
}

.summary-block div + div {
  border-top: 1px solid var(--border);
}

.summary-block strong {
  color: var(--text);
  font-size: 12px;
}

.summary-block span {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
}

.result-block {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.result-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-soft);
  color: var(--muted);
  padding: 8px 11px;
  font-size: 11px;
}

.stream-output {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.stream-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.stream-status-error {
  color: var(--danger) !important;
}

.stream-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

.stream-status-error .stream-spinner {
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
  border-top-color: var(--danger);
}

.stream-command-text {
  font-size: 11px;
  color: var(--faint);
  font-family: "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

.stream-log {
  max-height: 320px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  background: var(--code-bg);
  color: var(--code-text);
  font-family: "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  border-radius: 10px;
  border: 1px solid var(--border);
  scrollbar-color: var(--strong-border) transparent;
  scrollbar-width: thin;
}

.stream-log::-webkit-scrollbar {
  width: 5px;
}

.stream-log::-webkit-scrollbar-track {
  background: transparent;
}

.stream-log::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--strong-border) 70%, transparent);
  border-radius: 999px;
}

.code-block-wrapper {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--code-bg);
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 12px;
  background: color-mix(in srgb, var(--panel-soft) 80%, transparent);
  border-bottom: 1px solid var(--border);
}

.code-block-lang {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: lowercase;
  font-family: "Cascadia Code", "JetBrains Mono", Consolas, monospace;
}

.code-block-actions {
  display: flex;
  gap: 4px;
}

.code-block-toggle-btn,
.code-block-copy-btn {
  display: grid;
  place-items: center;
  height: 26px;
  min-width: 26px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}

.code-block-toggle-btn:hover,
.code-block-copy-btn:hover {
  color: var(--text);
  border-color: var(--strong-border);
  background: color-mix(in srgb, var(--muted) 10%, transparent);
}

.code-block-toggle-btn svg,
.code-block-copy-btn svg {
  width: 14px;
  height: 14px;
}

.code-block-content {
  max-height: 260px;
  overflow: auto;
  transition: max-height 200ms ease, opacity 200ms ease;
}

.code-block-content.collapsed {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
}

.code-block {
  margin: 0;
  padding: 13px;
  background: transparent;
  color: var(--code-text);
  font-family: "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.preview-block {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #000;
}

.preview-block iframe {
  display: block;
  width: 100%;
  height: 400px;
  border: 0;
  background: #fff;
}

.ui-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px 12px;
}

.ui-form h3 {
  grid-column: 1 / -1;
}

.ui-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.ui-form label:has(textarea),
.ui-form label:has(input[type="text"]),
.ui-form label:has(input[type="password"]),
.ui-form label:has(input[type="checkbox"]),
.ui-form label:has(.inline-picker) {
  grid-column: 1 / -1;
}

.ui-form input:not([type="checkbox"]),
.ui-form textarea,
.ui-form select,
.composer textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: #050608;
  color: var(--text);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

:root[data-theme="light"] .ui-form input:not([type="checkbox"]),
:root[data-theme="light"] .ui-form textarea,
:root[data-theme="light"] .ui-form select,
:root[data-theme="light"] .composer textarea {
  background: #ffffff;
}

.ui-form input:not([type="checkbox"]),
.ui-form select {
  height: 38px;
  padding: 0 12px;
}

.ui-form textarea {
  min-height: 72px;
  resize: vertical;
  padding: 11px 12px;
}

.ui-form input::placeholder,
.ui-form textarea::placeholder,
.composer textarea::placeholder {
  color: var(--faint);
}

.ui-form input:focus,
.ui-form textarea:focus,
.ui-form select:focus,
.composer textarea:focus {
  border-color: color-mix(in srgb, var(--text) 72%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 10%, transparent);
}

.ui-form input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.ui-form button[type="submit"] {
  justify-self: end;
  grid-column: 1 / -1;
  margin-top: 8px;
  padding: 10px 15px;
}

.inline-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.composer {
  position: relative;
  border-top: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  padding: 15px 18px 16px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: border-color 240ms ease, background 240ms ease;
}

.composer .drop-overlay {
  display: none;
  position: absolute;
  inset: 0;
  place-items: center;
  color: var(--accent);
  font-size: 15px;
  font-weight: 650;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 18px;
  z-index: 5;
}

.composer.is-dragging .composer-row {
  opacity: 0.2;
  pointer-events: none;
}

.composer.is-dragging .drop-overlay {
  display: grid;
}

.composer:focus-within {
  border-top-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

.composer.is-dragging {
  background: color-mix(in srgb, var(--panel-raised) 54%, transparent);
  border-color: var(--accent);
}

.composer-row:focus-within {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--strong-border));
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.attachment-tray {
  display: grid;
  gap: 7px;
  width: min(606px, 100%);
  margin: 0 auto 9px;
}

.attachment-fallbacks {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

#filepond-input {
  display: none;
}

.filepond--root {
  margin: 0;
  font-family: inherit;
}

.filepond--panel-root {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 18px;
}

.filepond--drop-label {
  color: var(--muted);
}

.filepond--label-action {
  color: var(--accent);
  text-decoration-color: color-mix(in srgb, var(--accent) 60%, transparent);
}

.filepond--item-panel {
  background: color-mix(in srgb, var(--panel) 88%, black);
}

.filepond--file {
  color: var(--text);
}

.filepond--file-info-sub {
  color: var(--muted);
}

.filepond--file-action-button {
  color: var(--text);
}

.attachment-preview-fallback {
  display: grid;
  width: 32px;
  height: 22px;
  place-items: center;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
  font-family: "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  font-size: 9px;
  font-weight: 800;
}

.attachment-preview-fallback[hidden] {
  display: none;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  max-width: 220px;
  gap: 8px;
  border-color: var(--border);
  background: var(--panel-soft);
  padding: 6px 9px 6px 7px;
}

.attachment-chip span {
  display: grid;
  min-width: 32px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 9%, transparent);
  color: var(--muted);
  font-family: "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  font-size: 10px;
  font-weight: 800;
}

.attachment-chip strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-chip-preview {
  display: grid;
  width: min(220px, 100%);
  max-width: 220px;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 14px;
  text-align: left;
}

.attachment-preview {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  display: block;
  background:
    linear-gradient(45deg, color-mix(in srgb, var(--text) 6%, transparent) 25%, transparent 25%),
    linear-gradient(-45deg, color-mix(in srgb, var(--text) 6%, transparent) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, color-mix(in srgb, var(--text) 6%, transparent) 75%),
    linear-gradient(-45deg, transparent 75%, color-mix(in srgb, var(--text) 6%, transparent) 75%),
    var(--panel);
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
  background-size: 12px 12px;
  transition: opacity 300ms ease;
  opacity: 0;
}

.attachment-preview[src] {
  opacity: 1;
}

.attachment-video-preview {
  position: relative;
}

.attachment-video {
  min-height: 132px;
  background: #05070a;
}

.attachment-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 1px solid color-mix(in srgb, white 22%, transparent);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.attachment-remove:hover {
  background: rgba(0, 0, 0, 0.78);
  border-color: color-mix(in srgb, white 44%, transparent);
}

.attachment-chip-preview strong {
  display: block;
  padding: 8px 10px 9px;
}

.a2ui-block {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  padding: 14px;
}

frubot-a2ui-surface {
  display: block;
  --a2ui-primary-color: var(--accent);
  --a2ui-surface-background: transparent;
  --a2ui-text-color: var(--text);
  --a2ui-muted-text-color: var(--muted);
  --a2ui-border-color: var(--border);
  --a2ui-card-background: color-mix(in srgb, var(--panel-raised) 92%, transparent);
}

.composer-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 36px;
  align-items: end;
  gap: 10px;
  width: min(606px, 100%);
  min-height: 50px;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-soft);
  padding: 8px 8px 8px 17px;
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  color: var(--muted);
  padding: 0;
  transition: color 150ms ease, transform 150ms var(--ease-spring), background 150ms ease;
  border-radius: 999px;
}

.icon-button:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--muted) 8%, transparent);
}

.icon-button:active {
  transform: scale(0.92);
}

.icon-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.icon-button svg {
  width: 17px;
  height: 17px;
  transition: transform 200ms var(--ease-spring);
}

#upload-button:hover svg {
  transform: rotate(-35deg);
}

.composer textarea {
  min-height: 32px;
  max-height: 150px;
  resize: none;
  overflow: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 6px 0;
  line-height: 1.45;
}

.composer textarea:focus {
  box-shadow: 0 0 0 2px var(--accent-glow);
}

#send-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  background: var(--accent);
  color: var(--accent-text);
  padding: 0;
  transition: transform 180ms var(--ease-spring), background 180ms ease, box-shadow 180ms ease;
  box-shadow: 0 2px 8px rgba(255, 119, 0, 0.25);
}

#send-button:hover {
  background: color-mix(in srgb, var(--accent) 90%, var(--text));
  box-shadow: 0 4px 14px rgba(255, 119, 0, 0.35);
}

#send-button:active {
  transform: scale(0.96);
}

#send-button svg {
  width: 18px;
  height: 18px;
  transition: transform 200ms var(--ease-spring);
}

#send-button:hover svg {
  transform: translateX(1px) translateY(-1px);
}

.loading {
  display: grid;
  width: min(430px, 100%);
  gap: 13px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background:
    radial-gradient(circle at 18% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 34%),
    color-mix(in srgb, var(--panel) 94%, transparent);
  animation: rise-in 220ms var(--ease-spring) both;
}

.loading-header {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
}

.loading-header h2 {
  margin: 2px 0 0;
  font-size: 15px;
  font-weight: 780;
  letter-spacing: -0.01em;
}

.loading-orb {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 42%, transparent);
}

.loading-orb-ring,
.loading-orb-core {
  position: absolute;
  border-radius: inherit;
}

.loading-orb-core {
  inset: 8px;
  background: var(--accent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 70%, transparent);
  will-change: transform, opacity;
}

.loading-orb-ring {
  inset: -4px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-top-color: transparent;
  will-change: transform;
}

.loading-status {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.downloads-block {
  display: grid;
  gap: 8px;
}

.downloads-block h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 760;
  color: var(--text);
}

.download-list {
  display: grid;
  gap: 6px;
}

.download-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-soft);
  padding: 9px 12px;
  cursor: pointer;
  text-align: left;
  transition: background 160ms ease, border-color 160ms ease, transform 180ms var(--ease-spring), box-shadow 180ms ease;
}

.download-btn:hover {
  background: var(--panel-raised);
  border-color: var(--strong-border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.download-btn:active {
  transform: scale(0.98);
}

.download-btn span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 13px;
}

.download-btn strong {
  flex: 1;
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
}

.download-btn small {
  font-size: 11px;
  color: var(--muted);
}

.download-row {
  display: flex;
  gap: 6px;
}

.download-row .download-btn {
  flex: 1;
  min-width: 0;
}

.reveal-btn {
  display: grid;
  width: 40px;
  place-items: center;
  border-color: var(--border);
  border-radius: 12px;
  background: var(--panel-soft);
  color: var(--muted);
  padding: 0;
  flex-shrink: 0;
  transition: color 150ms ease, border-color 150ms ease, transform 180ms var(--ease-spring), box-shadow 180ms ease;
}

.reveal-btn:hover {
  color: var(--text);
  border-color: var(--strong-border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.reveal-btn:active {
  transform: translateY(0) scale(0.96);
}

.reveal-btn svg {
  width: 18px;
  height: 18px;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.85);
  animation: fade-in 200ms ease both;
  cursor: zoom-out;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 1;
  transition: background 150ms ease, transform 150ms ease;
}

.lightbox-close svg {
  width: 20px;
  height: 20px;
}

.lightbox-close:hover {
  background: rgba(255,255,255,0.2);
}

.lightbox-close:active {
  transform: scale(0.96);
}

.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  animation: pop-in 280ms var(--ease-bounce) both;
  cursor: default;
}

.history-panel {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
}

.history-panel[hidden] {
  display: none;
}

.history-scrim {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: 0;
  background: rgba(0,0,0,0.5);
  padding: 0;
  animation: fade-in 200ms ease both;
}

.history-drawer {
  position: relative;
  width: min(380px, 85vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--border);
  box-shadow: 4px 0 24px rgba(0,0,0,0.3);
  animation: slide-in-left 260ms var(--ease-spring) both;
}

.history-drawer header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 16px 14px;
  border-bottom: 1px solid var(--border);
}

.history-search-wrap {
  padding: 10px 12px 0;
}

.history-search {
  width: 100%;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--text);
  padding: 0 11px;
  outline: none;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.history-search::placeholder {
  color: var(--faint);
}

.history-search:hover {
  border-color: var(--strong-border);
}

.history-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.approval-block {
  display: grid;
  gap: 10px;
}

.approval-block h3,
.approval-block p {
  margin: 0;
}

.approval-block p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.history-drawer header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 780;
}

.history-drawer header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.history-list {
  flex: 1;
  overflow: auto;
  padding: 10px 12px;
}

.settings-panel {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  justify-content: flex-end;
}

.settings-panel[hidden] {
  display: none;
}

.settings-scrim {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: 0;
  background: rgba(0,0,0,0.5);
  padding: 0;
  animation: fade-in 200ms ease both;
}

.settings-drawer {
  position: relative;
  width: min(380px, 85vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 24px rgba(0,0,0,0.3);
  animation: slide-in-right 260ms var(--ease-spring) both;
}

.settings-drawer header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 16px 14px;
  border-bottom: 1px solid var(--border);
}

.settings-drawer header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 780;
}

.settings-drawer header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.settings-body {
  flex: 1;
  overflow: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.settings-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.settings-group select,
.settings-group input[type="password"],
.settings-group input[type="text"] {
  width: 100%;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  padding: 0 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 200ms ease;
  box-sizing: border-box;
}

.settings-group select:hover,
.settings-group input:hover {
  border-color: var(--strong-border);
}

.settings-group select:focus,
.settings-group input:focus {
  border-color: var(--accent);
}

.settings-model-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.settings-model-row select {
  flex: 1;
}

.settings-model-row .icon-button {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.settings-actions {
  display: flex;
  gap: 8px;
  padding-top: 8px;
}

.settings-actions button {
  flex: 1;
  height: 38px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.settings-actions button.primary {
  border: 0;
  background: var(--accent);
  color: #fff;
}

.settings-actions button.primary:hover {
  opacity: 0.9;
}

.settings-actions button:not(.primary) {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
}

.settings-actions button:not(.primary):hover {
  border-color: var(--strong-border);
  color: var(--text);
}

.settings-ssh-fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 12px 0 0;
  border-top: 1px solid var(--border);
}

.settings-ssh-fields[hidden] {
  display: none;
}

@keyframes slide-in-right {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.history-empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 40px 16px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms var(--ease-spring);
}

.history-item:hover {
  background: var(--panel-soft);
  transform: translateX(4px);
}

.history-open {
  flex: 1;
  min-width: 0;
  text-align: left;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  display: grid;
  gap: 2px;
}

.history-open strong {
  font-size: 13px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-open span {
  font-size: 11px;
  color: var(--muted);
}

.history-delete {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  padding: 0;
  flex-shrink: 0;
  background: transparent;
  transition: color 150ms ease, background 150ms ease, transform 150ms var(--ease-spring);
}

.history-delete:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

.history-delete:active {
  transform: scale(0.95);
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes card-fade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulse-opacity {
  0%, 100% { opacity: 0.58; }
  50% { opacity: 0.3; }
}

@keyframes slide-in-left {
  from {
    opacity: 0;
    transform: translateX(-24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.scroll-to-bottom-btn {
  position: fixed;
  bottom: 90px;
  right: 20px;
  z-index: 50;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel-raised);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transition: color 150ms ease, background 150ms ease, transform 150ms var(--ease-spring), opacity 200ms ease;
  opacity: 0;
  pointer-events: none;
}

.scroll-to-bottom-btn.visible {
  opacity: 1;
  pointer-events: auto;
}

.scroll-to-bottom-btn:hover {
  color: var(--text);
  background: var(--panel);
}

.scroll-to-bottom-btn:active {
  transform: scale(0.92);
}

.scroll-to-bottom-btn svg {
  width: 20px;
  height: 20px;
}

.toast-notification {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 300;
  background: var(--panel-raised);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  opacity: 0;
  transition: opacity 200ms ease, transform 200ms var(--ease-spring);
  pointer-events: none;
}

.toast-notification.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.history-search-wrap {
  position: relative;
}

.history-search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  display: none;
  place-items: center;
  cursor: pointer;
  padding: 0;
}

.history-search-clear.visible {
  display: grid;
}

.history-search-clear:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--muted) 12%, transparent);
}

.history-search-clear svg {
  width: 14px;
  height: 14px;
}

.history-search {
  padding-right: 36px;
}

.form-input-error {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 20%, transparent) !important;
}

.form-error-message {
  color: var(--danger);
  font-size: 11px;
  margin-top: 4px;
  display: none;
}

.form-error-message.visible {
  display: block;
}

@media (max-width: 900px) {
  .nav-label {
    display: none;
  }

  .nav-button {
    padding: 6px 7px;
  }

  .topbar-actions {
    gap: 2px;
  }
}

@media (max-width: 720px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: 100dvh;
    min-height: 100dvh;
  }

  .workspace {
    height: 100dvh;
    min-height: 100dvh;
  }

  .topbar {
    height: 50px;
    padding: 0 10px;
  }

  .topbar-actions {
    gap: 2px;
  }

  .conversation {
    width: min(calc(100% - 24px), 720px);
    padding-top: 24px;
  }

  .agent-card,
  .user-bubble {
    max-width: 100%;
  }

  .ui-form,
  .summary-block div,
  .inline-picker {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .brand-mark {
    height: 20px;
  }

  .nav-label {
    display: none;
  }

  .nav-button {
    padding: 6px 7px;
  }
}

@media (max-width: 480px) {
  .brand-mark {
    height: 16px;
  }

  .status-dot {
    display: none;
  }

  .provider-status {
    font-size: 11px;
  }

  .model-select {
    max-width: 90px;
    font-size: 10px;
    padding: 2px 4px;
    padding-right: 16px;
  }

  .topbar-actions {
    gap: 4px;
  }

  .nav-button {
    padding: 6px 5px;
  }

  .empty-state h2 {
    font-size: 30px;
  }

  .composer {
    padding-inline: 12px;
  }
}

/* ── VPS Provisioning ─────────────────────────────────────────────────────── */

.vps-health-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.vps-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--faint);
  transition: background 200ms ease;
}

.vps-dot[data-state="connected"] {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

.vps-dot[data-state="degraded"] {
  background: #eab308;
  box-shadow: 0 0 6px rgba(234, 179, 8, 0.4);
}

.vps-dot[data-state="disconnected"],
.vps-dot[data-state="error"] {
  background: var(--danger);
  box-shadow: 0 0 6px rgba(248, 113, 113, 0.4);
}

.vps-label {
  font-size: 13px;
  color: var(--muted);
}

.vps-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.vps-actions button {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
  transition: all 150ms ease;
}

.vps-actions button:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.vps-actions button.primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

/* ── Dialog Overlay ───────────────────────────────────────────────────────── */

.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.dialog-overlay:not([hidden]) {
  display: flex;
}

.dialog-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 90%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.dialog-box header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.dialog-box header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.dialog-body {
  padding: 20px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.dialog-actions button {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  transition: all 150ms ease;
}

.dialog-actions button:hover {
  border-color: var(--accent);
}

.dialog-actions button.primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.dialog-actions button.primary:hover {
  opacity: 0.9;
}

/* ── Radio / Checkbox Groups ──────────────────────────────────────────────── */

.radio-group,
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-label,
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.radio-label input,
.checkbox-label input {
  accent-color: var(--accent);
}

/* ── VPS Progress Log ─────────────────────────────────────────────────────── */

.vps-progress {
  margin-top: 12px;
}

.vps-progress-log {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-family: "Cascadia Code", "Fira Code", "JetBrains Mono", monospace;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  max-height: 250px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Onboarding ───────────────────────────────────────────────────────────── */

.onboarding-dialog {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 90%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
}

.onboarding-dialog header {
  padding: 24px 28px 0;
}

.onboarding-dialog header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

.onboarding-body {
  padding: 20px 28px;
  flex: 1;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}

.onboarding-body p {
  margin: 0 0 16px;
}

.onboarding-diagram {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  font-family: "Cascadia Code", "Fira Code", monospace;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  white-space: pre;
  overflow-x: auto;
}

.onboarding-choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.onboarding-choice-card {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  text-align: left;
  transition: all 150ms ease;
  color: var(--text);
}

.onboarding-choice-card:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.choice-label {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.choice-desc {
  font-size: 12px;
  color: var(--muted);
}

.onboarding-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.onboarding-form .form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--muted);
}

.onboarding-form input,
.onboarding-form textarea,
.onboarding-form select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}

.onboarding-form textarea {
  resize: vertical;
  font-family: "Cascadia Code", "Fira Code", monospace;
  font-size: 11px;
}

.onboarding-result {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-top: 8px;
}

.onboarding-result.loading {
  background: var(--panel-soft);
  color: var(--muted);
}

.onboarding-result.success {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.onboarding-result.error {
  background: rgba(248, 113, 113, 0.1);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.onboarding-complete {
  text-align: center;
  padding: 20px 0;
}

.complete-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  color: #22c55e;
}

.complete-icon svg {
  width: 100%;
  height: 100%;
}

.onboarding-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 12px 0;
}

.onboarding-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
  cursor: pointer;
  transition: all 150ms ease;
}

.onboarding-dot.active {
  background: var(--accent);
  transform: scale(1.3);
}

.onboarding-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.onboarding-nav button {
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 150ms ease;
}

.onboarding-nav button:hover:not(:disabled) {
  border-color: var(--accent);
}

.onboarding-nav button.primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

.onboarding-nav button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.onboarding-dialog footer {
  padding: 16px 28px 24px;
  border-top: 1px solid var(--border);
}

.full-width {
  width: 100%;
}

.full-width.large {
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
}
