:root {
  color-scheme: light;
  --bg: #f5f0e8;
  --surface: #fffaf3;
  --surface-strong: #f0e4d6;
  --ink: #241a15;
  --muted: #74665c;
  --line: #dfd1c2;
  --accent: #246b62;
  --accent-2: #8f2f45;
  --shadow: 0 18px 50px rgba(54, 38, 24, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

button.ghost {
  background: #eadccd;
  color: #4b382c;
}

.shell {
  width: min(100%, 1060px);
  margin: 0 auto;
  padding: 24px;
}

.login-panel,
.platform,
.panel,
.api-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-panel {
  width: min(100%, 430px);
  margin: 6vh auto 0;
  padding: 24px;
  display: grid;
  gap: 22px;
}

.back-home {
  display: block;
  width: min(100%, 430px);
  margin: 4vh auto 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.back-home:hover {
  color: var(--accent);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.1;
}

h2 {
  font-size: 18px;
}

.intro {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.45;
}

.login-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #4b382c;
  font-size: 13px;
  font-weight: 800;
}

input,
select {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

.error {
  color: #8b2f2f;
  font-size: 13px;
  font-weight: 700;
}

.legal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.legal-footer a,
.legal-panel a {
  color: var(--accent);
}

.legal-shell {
  max-width: 880px;
}

.legal-panel {
  display: grid;
  gap: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.legal-panel section {
  display: grid;
  gap: 10px;
}

.legal-panel h2 {
  font-size: 18px;
}

.legal-panel p,
.legal-panel li {
  color: var(--muted);
  line-height: 1.55;
}

.legal-panel ul {
  margin: 0;
  padding-left: 22px;
}

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

.legal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.platform {
  padding: 18px;
  display: grid;
  gap: 16px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.menu {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 8px;
}

.menu button {
  min-height: 58px;
  padding: 8px 10px;
  background: #eadccd;
  color: #4b382c;
  text-align: left;
}

.menu button.active {
  background: var(--ink);
  color: #fff;
}

.menu span {
  display: block;
  color: currentColor;
  font-size: 11px;
  font-weight: 500;
  opacity: 0.78;
}

.content-grid {
  display: grid;
}

.panel {
  display: none;
  min-height: 290px;
  padding: 16px;
  box-shadow: none;
}

.panel.active {
  display: grid;
  align-content: start;
  gap: 14px;
}

.list {
  display: grid;
  gap: 10px;
}

.item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fffdf8;
}

.marketplace-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.avatar-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 176px;
  gap: 16px;
  align-items: center;
}

.avatar-preview-frame {
  width: 176px;
  height: 150px;
  margin: 0;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f0e4d6;
  overflow: hidden;
}

.avatar-preview {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: top center;
  animation: cloud-avatar-breathe 4.8s ease-in-out infinite;
  transform-origin: 50% 86%;
}

.avatar-copy {
  min-width: 0;
}

.avatar-copy .install-link {
  margin-top: 12px;
}

.item strong {
  display: block;
  margin-bottom: 5px;
}

.item p {
  color: var(--muted);
  line-height: 1.4;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.pill {
  border-radius: 999px;
  padding: 4px 8px;
  background: #dcebe8;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.pill.installed {
  background: #e6efe9;
  color: #246b62;
}

.install-link {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.install-link:disabled {
  background: #eadccd;
  color: #74665c;
  cursor: not-allowed;
}

.install-link.installed-button {
  background: #dcebe8;
  color: #246b62;
}

.secondary-link {
  background: #eadccd;
  color: #4b382c;
}

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

.ai-provider-panel {
  grid-column: 1 / -1;
}

.provider-card {
  display: grid;
  gap: 12px;
}

.seed-card {
  display: grid;
  gap: 12px;
}

.seed-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.seed-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}

.seed-fields span {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fffaf3;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.seed-fields b {
  color: var(--ink);
  font-size: 11px;
  text-transform: uppercase;
}

.provider-title,
.provider-actions,
.provider-toggles,
.config-row {
  display: flex;
  gap: 10px;
}

.provider-title {
  align-items: flex-start;
  justify-content: space-between;
}

.provider-toggles {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.provider-toggles label {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  background: #fffaf3;
  color: #4b382c;
  font-size: 12px;
  font-weight: 900;
}

.provider-toggles input {
  width: 16px;
  height: 16px;
}

.config-row {
  align-items: end;
}

.config-field {
  min-width: 0;
  display: grid;
  flex: 1;
  gap: 5px;
}

.config-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.config-field input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fffdf8;
  color: var(--ink);
}

.provider-actions {
  align-items: center;
  flex-wrap: wrap;
}

.provider-actions button {
  min-height: 38px;
}

.provider-actions button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.subscription-ai {
  display: grid;
  gap: 12px;
}

.vault-connector {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.vault-editor {
  display: grid;
  gap: 12px;
}

.vault-editor-head,
.vault-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.vault-editor-head {
  justify-content: space-between;
}

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

.vault-key-values {
  display: grid;
  gap: 8px;
}

.vault-field-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.4fr) minmax(160px, 1fr) auto;
  gap: 8px;
}

.vault-field-row input {
  min-width: 0;
}

.vault-configuration {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.vault-actions button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ai-choice-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.ai-choice {
  min-height: 96px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: #fffaf3;
  cursor: pointer;
}

.ai-choice.active {
  border-color: var(--accent);
  background: #eef8f5;
}

.ai-choice input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.ai-choice span {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.ai-choice strong,
.ai-choice small {
  overflow-wrap: anywhere;
}

.ai-choice small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.save-state {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.api-panel {
  padding: 16px;
  box-shadow: none;
  display: grid;
  gap: 12px;
}

.startup-error {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.startup-error p {
  color: var(--muted);
}

.endpoint-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

code {
  min-height: 38px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fffdf8;
  color: #4b382c;
  overflow-wrap: anywhere;
}

.semilla-cloud-shell {
  min-height: 100vh;
  display: grid;
  justify-items: center;
  align-items: stretch;
  padding: 24px;
}

.semilla-cloud-app {
  width: 100%;
  max-width: 1440px;
  height: calc(100vh - 48px);
  min-height: calc(100vh - 48px);
  max-height: calc(100vh - 48px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(480px, 1.05fr);
  gap: 14px;
  overflow: hidden;
}

.semilla-cloud-stage,
.semilla-cloud-workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  gap: 12px;
}

.semilla-cloud-stage {
  grid-template-rows: minmax(420px, 1fr) auto;
  overflow-y: auto;
  overflow-x: hidden;
}

.semilla-cloud-workspace {
  position: relative;
  /* La fila de "Memoria cloud cercana" es "auto" a proposito, no
     minmax(130px, .25fr): con un minimo fijo, el chat (1fr) siempre
     lograba encogerse lo suficiente para que todo "entrara" sin overflow
     real -- pero eso dejaba la memoria aplastada a ~70px utiles (el header
     se comia el resto de esos 130px), sin aviso de que habia mas para ver.
     Con "auto" la fila pide el alto que su contenido necesita de verdad
     (hasta el max-height de .cloud-memory-list) y el chat cede espacio
     primero; si igual no alcanza, ahi si hay overflow real y el
     overflow-y:auto de aca abajo lo hace scrolleable. */
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow-y: auto;
  overflow-x: hidden;
}

.semilla-cloud-avatar {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdf8;
  padding: 18px;
  display: grid;
  grid-template-rows: auto minmax(320px, 1fr) auto;
  gap: 14px;
  overflow: hidden;
}

.cloud-avatar-copy {
  display: grid;
  gap: 4px;
}

.semilla-cloud-avatar h1 {
  font-size: clamp(30px, 4vw, 54px);
}

.semilla-cloud-avatar p {
  color: var(--muted);
  line-height: 1.35;
  max-width: 56ch;
}

.cloud-avatar-frame {
  --cloud-avatar-turn: 0deg;
  width: 100%;
  height: 100%;
  min-height: clamp(360px, 58vh, 660px);
  margin: 0;
  align-self: stretch;
  border-radius: 14px;
  background: #f0e4d6;
  overflow: hidden;
  position: relative;
  isolation: isolate;
  touch-action: pan-y;
  cursor: grab;
  user-select: none;
}

.cloud-avatar-frame.dragging,
.cloud-avatar-frame:active {
  cursor: grabbing;
}

.cloud-avatar-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: top center;
  animation: cloud-avatar-breathe 4.8s ease-in-out infinite;
  transform-origin: 50% 88%;
  transition: filter 180ms ease, transform 180ms ease;
}

.cloud-avatar-frame.live2d-fallback img {
  transform: perspective(900px) rotateY(var(--cloud-avatar-turn));
}

.cloud-live2d-host {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.cloud-live2d-host canvas {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 12px 18px rgba(60, 39, 16, 0.18));
}

.cloud-avatar-frame-button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  border: 1px solid rgba(91, 67, 51, 0.16);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.92);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(60, 39, 16, 0.14);
}

.cloud-avatar-frame-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cloud-avatar-frame-button:active {
  transform: translateY(1px);
}

.cloud-avatar-frame.live2d-ready img,
.cloud-avatar-frame.loading-live2d img {
  opacity: 0;
}

.cloud-avatar-frame.live2d-fallback .cloud-live2d-host {
  display: none;
}

.cloud-avatar-frame.live2d-fallback img {
  opacity: 1;
}

.cloud-avatar-frame::before {
  content: "";
  position: absolute;
  inset: 12% 10% auto;
  height: 44%;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(36, 107, 98, 0.16), transparent 68%);
  opacity: 0.82;
  z-index: -1;
  animation: cloud-avatar-glow 4s ease-in-out infinite;
}

.cloud-avatar-frame::after {
  content: "";
  position: absolute;
  left: 21%;
  right: 21%;
  top: 33%;
  height: 4px;
  border-radius: 999px;
  background: rgba(36, 24, 18, 0.54);
  opacity: 0;
  transform: scaleY(0.2);
  animation: cloud-avatar-blink 5.6s ease-in-out infinite;
}

.cloud-avatar-frame.happy img {
  filter: saturate(1.08) brightness(1.03);
}

.cloud-avatar-frame.thinking img {
  filter: saturate(0.96) sepia(0.06);
  animation-duration: 5.8s;
}

.cloud-avatar-frame.curious img {
  animation-name: cloud-avatar-curious;
}

.cloud-avatar-frame.concerned img {
  filter: saturate(0.92) brightness(0.98);
}

.cloud-avatar-frame.speaking img {
  animation: cloud-avatar-speaking 680ms ease-in-out infinite;
}

.cloud-avatar-frame.speaking::before {
  animation-duration: 1.2s;
  opacity: 1;
}

.cloud-avatar-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.semilla-cloud-tabs {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.semilla-cloud-tabs button,
.ghost-link {
  min-height: 42px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  background: #eadccd;
  color: #4b382c;
  font-weight: 900;
  text-decoration: none;
}

.semilla-cloud-tabs .active {
  background: var(--ink);
  color: #fff;
}

.semilla-cloud-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf8;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.cloud-popover-panel {
  position: absolute;
  top: 54px;
  left: 0;
  right: 0;
  z-index: 35;
  box-shadow: 0 18px 42px rgba(36, 25, 21, 0.16);
  max-height: min(330px, calc(100vh - 190px));
  overflow: auto;
}

.cloud-popover-panel.hidden {
  display: none;
}

.cloud-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cloud-panel-header h2 {
  margin: 0;
}

.cloud-panel-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.cloud-learning-panel input[type="file"] {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.cloud-learning-panel button {
  justify-self: start;
}

.cloud-toolbelt-panel,
.cloud-plan-panel {
  align-content: start;
}

.cloud-tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.cloud-tool-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
  display: grid;
  gap: 4px;
}

.cloud-tool-card strong,
.cloud-action-card strong {
  overflow-wrap: anywhere;
}

.cloud-tool-card span,
.cloud-action-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.cloud-tool-card p,
.cloud-action-card p {
  color: var(--muted);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.cloud-plan-list {
  display: grid;
  gap: 8px;
  max-height: 240px;
  overflow: auto;
}

.cloud-action-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  display: grid;
  gap: 8px;
}

.cloud-action-card.needs-approval {
  border-color: #d9a85c;
  background: #fff9ee;
}

.cloud-action-card.agent-required {
  border-color: #b86b6b;
  background: #fff5f3;
}

.cloud-action-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cloud-action-meta span {
  border-radius: 999px;
  padding: 4px 8px;
  background: #efe6dc;
}

.cloud-action-card button {
  justify-self: start;
}

.cloud-status-grid.compact {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.cloud-status-grid.compact > span {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}

.cloud-status-grid.compact strong {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.cloud-status-grid.compact span span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.cloud-chat-log {
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf8;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overscroll-behavior: contain;
  contain: layout paint;
}

.cloud-message {
  max-width: 86%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
}

.cloud-message.user {
  align-self: flex-end;
  background: #e8f1ee;
  border-color: #bdd4ce;
}

.cloud-message.assistant {
  align-self: flex-start;
}

.cloud-message span,
.cloud-message small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.cloud-message p {
  margin-top: 4px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.cloud-loading-message {
  border-style: dashed;
}

.cloud-loading-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-top: 6px;
}

.cloud-loading-image {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #dcebe8, #f0e4d6);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: inset 0 0 0 1px rgba(36, 24, 18, .08);
}

.cloud-loading-image i {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #246b62;
  animation: cloud-loading-dot 1s ease-in-out infinite;
}

.cloud-loading-image i:nth-child(2) {
  animation-delay: .14s;
}

.cloud-loading-image i:nth-child(3) {
  animation-delay: .28s;
}

.cloud-rich-response {
  margin-top: 10px;
  border: 1px solid #d8c8b6;
  border-radius: 10px;
  background: #fffaf2;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.cloud-rich-response.expanded {
  position: fixed;
  inset: 18px;
  z-index: 40;
  max-width: none;
  max-height: none;
  overflow: hidden;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  box-shadow: 0 22px 80px rgba(36, 24, 18, .28);
}

.cloud-rich-response header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.cloud-rich-header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  align-items: center;
}

.cloud-rich-response header span,
.cloud-rich-response small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.cloud-rich-response header .cloud-generative-badge {
  border: 1px solid #b9d9d1;
  border-radius: 999px;
  padding: 4px 7px;
  background: #e9f6f2;
  color: #246b62;
}

.cloud-rich-header-actions button {
  min-height: 30px;
  border: 0;
  border-radius: 8px;
  padding: 5px 9px;
  background: #241812;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.cloud-rich-list {
  display: grid;
  gap: 8px;
}

.cloud-youtube-stage {
  display: grid;
  gap: 8px;
}

.cloud-youtube-player {
  display: grid;
  gap: 6px;
  align-content: center;
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f1e7da;
  padding: 12px;
}

.cloud-youtube-player span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.cloud-youtube-player iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 8px;
  background: #000;
}

.cloud-youtube-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0 0;
}

.cloud-youtube-controls strong {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cloud-youtube-controls button {
  min-height: 32px;
  border: 0;
  border-radius: 8px;
  padding: 7px 10px;
  background: #241812;
  color: #fff;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.cloud-media-process {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  width: min(360px, calc(100vw - 36px));
  min-width: 320px;
  max-width: calc(100vw - 12px);
  max-height: calc(100vh - 12px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffaf2;
  box-shadow: 0 16px 42px rgba(36, 24, 18, .18);
  overflow: auto;
  resize: both;
}

.cloud-media-process.expanded {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.cloud-media-process.hidden {
  display: none;
}

.cloud-media-process-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  cursor: move;
  user-select: none;
  touch-action: none;
}

.cloud-media-process-head strong,
.cloud-media-process-head span {
  display: block;
}

.cloud-media-process-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.cloud-media-process-actions {
  display: flex;
  gap: 6px;
}

.cloud-media-process-actions button {
  min-height: 32px;
  border: 0;
  border-radius: 8px;
  padding: 7px 10px;
  background: #241812;
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.cloud-media-process-body {
  width: 1px;
  height: 1px;
  opacity: .01;
  overflow: hidden;
}

.cloud-media-process.expanded .cloud-media-process-body {
  width: 100%;
  height: 100%;
  opacity: 1;
  padding: 0 10px 10px;
}

.cloud-media-process iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 8px;
  background: #000;
}

.cloud-media-process.expanded iframe {
  height: 100%;
  aspect-ratio: auto;
}

.cloud-rich-list article {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.cloud-rich-list.playlist article {
  grid-template-columns: minmax(0, 1fr);
}

.cloud-rich-list img {
  width: 84px;
  height: 58px;
  object-fit: cover;
  border-radius: 7px;
  background: #f1ebe2;
}

.cloud-image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  gap: 8px;
}

.cloud-image-gallery button {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  background: #fff;
  color: var(--ink);
  text-align: left;
  overflow: hidden;
  cursor: pointer;
}

.cloud-image-gallery img,
.cloud-image-fallback {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  object-fit: cover;
  background: #f1ebe2;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.cloud-image-gallery strong,
.cloud-image-gallery small {
  display: block;
  padding: 7px 8px 0;
  overflow-wrap: anywhere;
}

.cloud-image-gallery strong {
  font-size: 12px;
  line-height: 1.2;
}

.cloud-image-gallery small {
  padding-bottom: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.cloud-rich-list strong,
.cloud-rich-list p {
  display: block;
  margin: 0;
}

.cloud-rich-list p {
  color: var(--muted);
  font-size: 12px;
}

.cloud-rich-list button,
.cloud-rich-actions button {
  min-height: 34px;
  margin-top: 6px;
  padding: 7px 11px;
  border: 0;
  border-radius: 8px;
  background: #241812;
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.cloud-web-viewer {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 8px;
  display: grid;
  gap: 8px;
}

.cloud-web-viewer.floating {
  position: fixed;
  z-index: 80;
  min-width: 360px;
  min-height: 270px;
  max-width: calc(100vw - 12px);
  max-height: calc(100vh - 12px);
  margin: 0;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  overflow: hidden;
  resize: both;
  box-shadow: 0 24px 90px rgba(36, 24, 18, .34);
  pointer-events: auto;
}

.cloud-web-viewer.minimized {
  height: auto !important;
  min-height: 0;
  resize: none;
}

.cloud-web-viewer.minimized iframe,
.cloud-web-viewer.minimized p,
.cloud-web-viewer.minimized a {
  display: none;
}

.cloud-web-viewer.hidden {
  display: none;
}

.cloud-web-viewer.blocked {
  border-color: #d8a3a3;
  background: #fff7f7;
}

.cloud-web-viewer header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cloud-web-viewer.floating header {
  cursor: move;
  user-select: none;
  touch-action: none;
}

.cloud-web-viewer header div {
  min-width: 0;
}

.cloud-web-viewer strong,
.cloud-web-viewer span {
  display: block;
}

.cloud-web-viewer span {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cloud-web-viewer iframe {
  width: 100%;
  height: min(58vh, 520px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.cloud-web-viewer.floating iframe {
  height: 100%;
  min-height: 0;
}

.cloud-web-viewer p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.cloud-web-viewer.blocked p {
  color: #8c2f3f;
}

.cloud-web-viewer a,
.cloud-web-viewer button {
  min-height: 32px;
  border: 0;
  border-radius: 8px;
  padding: 7px 10px;
  background: #241812;
  color: #fff;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.cloud-web-viewer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.cloud-web-viewer a {
  justify-self: start;
}

.cloud-web-viewer a.hidden {
  display: none;
}

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

.cloud-rich-sandbox {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.cloud-rich-response.expanded .cloud-rich-sandbox {
  height: 100% !important;
  min-height: 0;
}

.cloud-tool-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
}

.cloud-tool-overlay.hidden {
  display: none;
}

.cloud-tool-window {
  position: fixed;
  min-width: 360px;
  min-height: 260px;
  max-width: calc(100vw - 12px);
  max-height: calc(100vh - 12px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffaf2;
  box-shadow: 0 24px 90px rgba(36, 24, 18, .34);
  overflow: auto;
  resize: both;
  pointer-events: auto;
}

.cloud-window-resize-handle {
  position: absolute;
  right: 4px;
  bottom: 4px;
  z-index: 3;
  width: 22px;
  min-height: 22px;
  height: 22px;
  border: 0;
  border-radius: 6px;
  padding: 0;
  background: linear-gradient(135deg, transparent 0 45%, rgba(36, 24, 18, .55) 46% 55%, transparent 56%),
    linear-gradient(135deg, transparent 0 63%, rgba(36, 24, 18, .55) 64% 73%, transparent 74%);
  cursor: nwse-resize;
}

.cloud-window-resize-handle:hover {
  background-color: rgba(36, 24, 18, .08);
}

.cloud-tool-overlay-head {
  min-height: 58px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fffdf8;
  cursor: move;
  user-select: none;
  touch-action: none;
}

.cloud-tool-overlay-head div:first-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.cloud-tool-overlay-head strong {
  overflow-wrap: anywhere;
}

.cloud-tool-overlay-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.cloud-tool-overlay-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.cloud-tool-overlay-actions button {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  padding: 6px 10px;
  background: #241812;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.cloud-tool-window.minimized {
  height: auto !important;
  min-height: 0;
  resize: none;
}

.cloud-tool-window.minimized .cloud-tool-overlay-body {
  display: none;
}

.cloud-tool-window.minimized .cloud-tool-overlay-head {
  border-bottom: 0;
}

.cloud-tool-overlay-body {
  min-height: 0;
  padding: 10px;
  background: #f7efe4;
  overflow: hidden;
}

.cloud-tool-overlay-body .cloud-rich-sandbox {
  width: 100%;
  height: 100% !important;
  min-height: 0;
}

.cloud-rich-response.tool-detached .cloud-tool-placeholder {
  min-height: 180px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #fffdf8;
  display: grid;
  place-items: center;
}

.cloud-rich-response.tool-detached .cloud-tool-placeholder::before {
  content: "Herramienta abierta en pantalla";
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

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

.cloud-chat-image-preview {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.cloud-chat-image-preview img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
}

.cloud-message-image {
  display: block;
  max-width: 220px;
  max-height: 220px;
  border-radius: 8px;
  margin: 4px 0;
  object-fit: cover;
}

.cloud-chat-image-preview button {
  margin-left: auto;
  border: none;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 4px 8px;
}

.cloud-memory-list {
  display: grid;
  gap: 8px;
  max-height: 210px;
  overflow: auto;
}

.cloud-memory-list article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}

.cloud-memory-list p {
  color: var(--muted);
  line-height: 1.35;
}

.cloud-saved-apps-panel {
  max-height: 240px;
}

.cloud-saved-apps-panel.hidden {
  display: none;
}

.cloud-saved-apps-panel {
  bottom: 14px;
  max-height: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cloud-saved-apps-list {
  display: grid;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 120px;
  overflow: auto;
}

.cloud-saved-apps-list article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  display: grid;
  gap: 6px;
}

.cloud-forum-panel {
  bottom: 14px;
  max-height: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cloud-forum-tabs {
  display: flex;
  gap: 8px;
}

.cloud-forum-tabs button {
  min-height: 34px;
  border-radius: 999px;
  padding: 0 14px;
  background: #eadccd;
  color: #4b382c;
  font-weight: 900;
}

.cloud-forum-tabs button.active {
  background: var(--ink);
  color: #fff;
}

.cloud-forum-hint {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
  font-size: 13px;
}

.cloud-forum-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 120px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 8px;
}

.cloud-forum-composer {
  flex: 0 0 auto;
}

.cloud-forum-message {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px;
  display: grid;
  gap: 4px;
  background: #fffdf8;
}

.cloud-forum-message.seed_answer {
  border-color: rgba(21, 128, 112, 0.26);
  background: #f3fbf8;
}

.cloud-forum-message header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 900;
}

.cloud-forum-message strong {
  color: var(--ink);
}

.cloud-forum-message p {
  margin: 0;
  color: var(--text);
  line-height: 1.35;
}

.cloud-forum-message footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cloud-forum-message footer button {
  min-height: 28px;
  border-radius: 8px;
  padding: 0 10px;
}

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

.cloud-forum-composer.hidden {
  display: none;
}

.cloud-module-dock {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cloud-module-dock.hidden {
  display: none;
}

.cloud-module-dock button {
  min-height: 30px;
  border-radius: 999px;
  padding: 0 12px;
  background: #eadccd;
  color: #4b382c;
  font-weight: 900;
  font-size: 12px;
}

.cloud-module-dock button:disabled {
  opacity: 0.5;
  cursor: default;
}

.cloud-module-dock button.active {
  background: var(--ink);
  color: #fff;
}

.cloud-saved-apps-list strong {
  color: var(--ink);
}

.cloud-saved-apps-list p {
  margin: 0;
  color: var(--muted);
  line-height: 1.3;
}

.cloud-saved-app-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cloud-saved-app-actions button {
  min-height: 30px;
  border-radius: 8px;
  padding: 0 10px;
}

@media (max-width: 920px) {
  .semilla-cloud-shell {
    align-items: start;
    padding: 14px;
  }

  .semilla-cloud-app {
    width: min(100%, 430px);
    height: calc(100vh - 28px);
    min-height: min(720px, calc(100vh - 28px));
    max-height: calc(100vh - 28px);
    border-radius: 14px;
    padding: 10px;
    grid-template-columns: 1fr;
    gap: 10px;
    overflow: hidden;
  }

  .semilla-cloud-stage {
    grid-template-rows: auto auto;
  }

  .semilla-cloud-workspace {
    grid-template-rows: auto auto minmax(0, 1fr) auto;
  }

  .semilla-cloud-tabs {
    display: flex;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    padding-bottom: 2px;
  }

  .semilla-cloud-tabs button,
  .ghost-link {
    flex: 0 0 auto;
    min-width: 116px;
  }

  .semilla-cloud-avatar {
    min-height: 220px;
    border-radius: 12px;
    padding: 12px;
    grid-template-columns: minmax(0, 1fr) 120px;
    grid-template-rows: 1fr auto;
    gap: 10px;
  }

  .cloud-avatar-copy {
    display: block;
  }

  .semilla-cloud-avatar h1 {
    font-size: 22px;
  }

  .cloud-avatar-frame {
    width: 120px;
    height: 168px;
    min-height: 168px;
    align-self: end;
    border-radius: 10px;
  }

  .cloud-avatar-meta {
    grid-column: 1 / -1;
    font-size: 12px;
  }

  .cloud-chat-log {
    min-height: 320px;
    max-height: 100%;
  }

  .cloud-memory-list {
    max-height: none;
  }
}

@keyframes cloud-avatar-breathe {
  0%,
  100% {
    transform: translateY(2px) scale(1);
  }

  50% {
    transform: translateY(-4px) scale(1.018);
  }
}

@keyframes cloud-avatar-curious {
  0%,
  100% {
    transform: translateY(1px) rotateZ(0deg) scale(1);
  }

  45% {
    transform: translateY(-4px) rotateZ(-1.4deg) scale(1.018);
  }

  75% {
    transform: translateY(-2px) rotateZ(1deg) scale(1.01);
  }
}

@keyframes cloud-avatar-speaking {
  0%,
  100% {
    transform: translateY(1px) scale(1.01);
  }

  30% {
    transform: translateY(-5px) scale(1.028);
  }

  62% {
    transform: translateY(-2px) scale(1.016);
  }
}

@keyframes cloud-avatar-glow {
  0%,
  100% {
    transform: scale(0.95);
  }

  50% {
    transform: scale(1.08);
  }
}

@keyframes cloud-avatar-blink {
  0%,
  92%,
  100% {
    opacity: 0;
    transform: scaleY(0.2);
  }

  94%,
  96% {
    opacity: 0.42;
    transform: scaleY(1);
  }
}

@keyframes cloud-loading-dot {
  0%,
  80%,
  100% {
    opacity: .35;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-5px);
  }
}

@media (max-width: 720px) {
  .cloud-tool-window,
  .cloud-web-viewer.floating {
    left: 0 !important;
    top: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    min-width: 0;
    min-height: 0;
    border-radius: 0;
  }

  .cloud-tool-overlay-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .cloud-tool-overlay-actions {
    width: 100%;
    justify-content: stretch;
  }

  .cloud-tool-overlay-actions button {
    flex: 1;
  }

  .shell {
    padding: 14px;
  }

  .menu,
  .endpoint-list,
  .admin-grid,
  .ai-choice-list,
  .marketplace-item,
  .avatar-item,
  .vault-connector,
  .vault-configuration,
  .vault-form-grid,
  .vault-field-row,
  .provider-title,
  .config-row {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .avatar-preview-frame {
    width: 100%;
    height: 210px;
    order: -1;
  }

  .topbar {
    align-items: flex-start;
  }

  .semilla-cloud-shell {
    padding: 10px;
  }

  .semilla-cloud-app {
    height: calc(100vh - 20px);
    min-height: calc(100vh - 20px);
    max-height: calc(100vh - 20px);
  }

  .cloud-status-grid.compact {
    grid-template-columns: 1fr;
  }

  .cloud-tool-grid {
    grid-template-columns: 1fr;
  }
}
