:root {
  --bg: #eef2f7;
  --bg-deep: #e2e8f0;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: rgba(255, 255, 255, 0.96);
  --surface-soft: rgba(248, 250, 252, 0.84);
  --ink: #11203a;
  --muted: #5f6d82;
  --line: rgba(17, 32, 58, 0.1);
  --brand: #2463eb;
  --brand-soft: rgba(36, 99, 235, 0.12);
  --brand-deep: #153d96;
  --teal: #0f766e;
  --danger: #b42318;
  --danger-soft: rgba(180, 35, 24, 0.12);
  --warning: #b54708;
  --warning-soft: rgba(181, 71, 8, 0.12);
  --shadow-lg: 0 28px 72px rgba(15, 23, 42, 0.12);
  --shadow-md: 0 18px 42px rgba(15, 23, 42, 0.09);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(36, 99, 235, 0.14), transparent 22%),
    radial-gradient(circle at 85% 12%, rgba(15, 118, 110, 0.12), transparent 18%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 44%, var(--bg-deep) 100%);
  overflow-x: hidden;
}

code {
  font-family: inherit;
  background: rgba(17, 32, 58, 0.06);
  padding: 0.14rem 0.48rem;
  border-radius: 999px;
}

.ambient {
  position: fixed;
  pointer-events: none;
  filter: blur(30px);
  opacity: 0.72;
}

.ambient-a {
  width: 300px;
  height: 300px;
  top: 4%;
  right: -80px;
  background: rgba(36, 99, 235, 0.16);
  animation: floaty 14s ease-in-out infinite;
}

.ambient-b {
  width: 380px;
  height: 380px;
  bottom: -90px;
  left: -80px;
  background: rgba(15, 118, 110, 0.16);
  animation: floaty 18s ease-in-out infinite reverse;
}

.page-shell {
  width: calc(100% - 32px);
  margin: 0 auto;
  padding: 20px 0 64px;
  position: relative;
}

.hero,
.settings-panel,
.tabs-shell,
.workspace-card,
.results-card,
.provider-card,
.summary-card {
  backdrop-filter: blur(18px);
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow-lg);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.95fr);
  gap: 22px;
  border-radius: var(--radius-xl);
  padding: 24px;
}

.hero-brand {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
}

.hero-logo-panel {
  width: 140px;
  height: 140px;
  display: grid;
  place-items: center;
  border-radius: 36px;
  background:
    linear-gradient(145deg, rgba(255, 246, 221, 0.98), rgba(246, 191, 213, 0.92) 52%, rgba(216, 102, 157, 0.88)),
    white;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 20px 44px rgba(91, 33, 182, 0.12);
}

.hero-logo {
  width: 104px;
  height: 104px;
  display: block;
}

.hero-copy {
  display: grid;
  gap: 10px;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.76rem;
  color: var(--brand-deep);
  font-weight: 800;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: "Fraunces", serif;
  line-height: 0.98;
}

h1 {
  font-size: clamp(3.2rem, 7vw, 6rem);
  letter-spacing: -0.05em;
}

h2 {
  font-size: clamp(1.9rem, 3vw, 2.8rem);
  letter-spacing: -0.03em;
}

h3 {
  font-size: 1.35rem;
}

h4 {
  font-size: 1.02rem;
}

.hero-kicker,
.provider-note,
.summary-card,
.workspace-card,
.results-card,
.copy-meta,
.asset-meta,
.section-heading p {
  color: var(--muted);
}

.hero-kicker {
  margin: 0;
  max-width: 72ch;
  font-size: 1rem;
  line-height: 1.6;
}

.hero-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.hero-chip,
.mini-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(17, 32, 58, 0.08);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
}

.hero-metrics {
  display: grid;
  gap: 14px;
}

.hero-metric-card {
  display: grid;
  gap: 8px;
  padding: 18px;
  border-radius: 24px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.74), rgba(239, 246, 255, 0.94)),
    rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(36, 99, 235, 0.1);
}

.hero-metric-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.hero-metric-index {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  font-weight: 800;
}

.settings-panel,
.tabs-shell {
  margin-top: 20px;
  border-radius: var(--radius-xl);
  padding: 24px;
}

.section-heading {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.section-heading.tight {
  margin-bottom: 18px;
}

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

.provider-card,
.workspace-card,
.results-card {
  border-radius: var(--radius-lg);
  padding: 22px;
}

.provider-card-head,
.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.result-head-stack {
  align-items: flex-start;
  flex-wrap: wrap;
}

.result-head-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.1);
  color: var(--teal);
  font-size: 0.82rem;
  font-weight: 800;
}

.field,
.field-grid {
  display: grid;
  gap: 10px;
}

.field-grid {
  margin-top: 16px;
}

.field-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.field-grid-compact {
  grid-template-columns: repeat(2, minmax(120px, 180px));
}

.field span,
.choice-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--ink);
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  color: var(--ink);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(36, 99, 235, 0.4);
  box-shadow: 0 0 0 4px rgba(36, 99, 235, 0.12);
  transform: translateY(-1px);
}

.provider-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(17, 32, 58, 0.08);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.status-pill.is-success {
  background: rgba(15, 118, 110, 0.12);
  color: var(--teal);
}

.status-pill.is-error {
  background: var(--danger-soft);
  color: var(--danger);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.tab,
.pill-choice,
.btn {
  border: 0;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, opacity 180ms ease;
}

.tab {
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
}

.tab:hover,
.pill-choice:hover,
.btn:hover {
  transform: translateY(-2px);
}

.tab.is-active {
  background: linear-gradient(135deg, var(--brand), #5f8cff);
  color: white;
  box-shadow: 0 16px 34px rgba(36, 99, 235, 0.22);
}

.tab-panel {
  display: none;
  animation: reveal 260ms ease;
}

.tab-panel.is-active {
  display: block;
}

.workspace-stack {
  display: grid;
  gap: 18px;
}

.choice-block {
  margin-top: 18px;
}

.toggle-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.pill-choice {
  padding: 12px 18px;
  background: rgba(17, 32, 58, 0.08);
  color: var(--muted);
}

.pill-choice.is-selected {
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.animated-box {
  margin-top: 18px;
  display: grid;
  gap: 14px;
  opacity: 1;
  max-height: 420px;
  overflow: hidden;
  transform: translateY(0);
  transition: opacity 220ms ease, max-height 220ms ease, transform 220ms ease, margin-top 220ms ease;
}

.animated-box.hidden {
  opacity: 0;
  max-height: 0;
  margin-top: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

.hidden {
  display: none !important;
}

.btn {
  min-height: 46px;
  padding: 0 20px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand), #6b8cff);
  color: white;
  box-shadow: 0 16px 34px rgba(36, 99, 235, 0.24);
}

.btn-secondary {
  background: rgba(17, 32, 58, 0.08);
  color: var(--ink);
}

.btn:disabled {
  opacity: 0.62;
  cursor: wait;
  transform: none;
}

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

.summary-card {
  border-radius: var(--radius-md);
  padding: 18px;
  background: var(--surface-strong);
  line-height: 1.65;
}

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

.asset-group {
  margin-top: 22px;
}

.asset-grid,
.copy-grid,
.chip-grid,
.headline-grid,
.publication-grid,
.upload-preview-grid {
  display: grid;
  gap: 16px;
}

.asset-grid {
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  margin-top: 16px;
}

.asset-grid-dense {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.copy-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  margin-top: 16px;
}

.headline-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 16px;
}

.publication-grid {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  margin-top: 16px;
}

.chip-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.upload-preview-grid {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  margin-top: 14px;
}

.name-chip,
.asset-card,
.copy-card,
.headline-card,
.publication-card,
.upload-preview-card {
  border-radius: 18px;
  border: 1px solid rgba(17, 32, 58, 0.08);
  background: rgba(255, 255, 255, 0.78);
}

.name-chip {
  padding: 16px;
  display: grid;
  gap: 8px;
  text-align: left;
}

.name-chip.is-selected {
  border-color: rgba(36, 99, 235, 0.26);
  box-shadow: 0 16px 34px rgba(36, 99, 235, 0.12);
}

.name-chip-title {
  font-weight: 800;
  color: var(--ink);
}

.asset-card,
.publication-card {
  overflow: hidden;
  position: relative;
}

.asset-card.is-rejected {
  opacity: 0.62;
}

.asset-card.is-rejected .asset-media::after {
  content: "Excluida de memoria";
  position: absolute;
  inset: 12px 12px auto auto;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--danger);
  font-size: 0.78rem;
  font-weight: 800;
  box-shadow: var(--shadow-md);
}

.asset-media {
  position: relative;
  aspect-ratio: var(--asset-ratio, 1 / 1);
  background:
    linear-gradient(135deg, rgba(36, 99, 235, 0.1), rgba(15, 118, 110, 0.08)),
    rgba(241, 245, 249, 0.94);
}

.asset-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.memory-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--brand-deep);
  font-size: 0.78rem;
  font-weight: 800;
  box-shadow: var(--shadow-md);
}

.asset-body,
.copy-card,
.headline-card {
  padding: 16px;
}

.asset-body {
  display: grid;
  gap: 10px;
}

.asset-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.overlay-plan {
  display: grid;
  gap: 8px;
}

.overlay-chip {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--brand-soft);
  border: 1px solid rgba(36, 99, 235, 0.1);
}

.overlay-chip-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-deep);
  font-weight: 800;
}

.asset-meta,
.copy-meta {
  font-size: 0.9rem;
  line-height: 1.55;
}

.asset-actions,
.copy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.inline-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  color: var(--brand-deep);
  text-decoration: none;
  background: rgba(17, 32, 58, 0.06);
  font-weight: 800;
}

.copy-value,
.headline-value,
.publication-caption {
  white-space: pre-wrap;
  line-height: 1.75;
  color: var(--ink);
}

.publication-caption {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.9);
  border: 1px solid rgba(17, 32, 58, 0.06);
}

.upload-preview-card {
  overflow: hidden;
}

.upload-preview-card img {
  width: 100%;
  max-height: 180px;
  display: block;
  object-fit: contain;
  background: rgba(241, 245, 249, 0.9);
}

.upload-preview-card span {
  display: block;
  padding: 10px 12px 12px;
  font-size: 0.82rem;
  color: var(--muted);
  word-break: break-word;
}

.loader {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(36, 99, 235, 0.2);
  border-top-color: var(--brand);
  animation: spin 0.7s linear infinite;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(480px, calc(100vw - 32px));
  padding: 14px 18px;
  border-radius: 18px;
  background: rgba(17, 32, 58, 0.94);
  color: white;
  box-shadow: var(--shadow-lg);
  z-index: 20;
  cursor: pointer;
}

.toast.is-error {
  background: rgba(180, 35, 24, 0.96);
}

.toast.is-warning {
  background: rgba(181, 71, 8, 0.96);
}

.toast.hidden {
  display: none;
}

details summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--brand-deep);
}

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

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

@keyframes floaty {
  0%, 100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(0, -14px, 0);
  }
}

@media (max-width: 1100px) {
  .hero,
  .provider-grid,
  .summary-grid,
  .field-grid-3,
  .field-grid-4 {
    grid-template-columns: 1fr;
  }

  .hero-brand {
    grid-template-columns: 110px 1fr;
  }

  .hero-logo-panel {
    width: 110px;
    height: 110px;
    border-radius: 28px;
  }

  .hero-logo {
    width: 82px;
    height: 82px;
  }
}

@media (max-width: 780px) {
  .page-shell {
    width: calc(100% - 20px);
    padding-top: 14px;
  }

  .hero,
  .settings-panel,
  .tabs-shell,
  .provider-card,
  .workspace-card,
  .results-card {
    padding: 18px;
  }

  .hero-brand,
  .field-grid-2,
  .field-grid-3,
  .field-grid-compact {
    grid-template-columns: 1fr;
  }

  .hero-logo-panel {
    width: 96px;
    height: 96px;
  }

  .hero-logo {
    width: 72px;
    height: 72px;
  }

  h1 {
    font-size: 2.8rem;
  }

  .result-head,
  .provider-card-head,
  .asset-title-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .result-head-actions,
  .memory-actions,
  .asset-actions,
  .copy-actions {
    width: 100%;
  }

  .btn,
  .inline-link {
    width: 100%;
    justify-content: center;
  }

  .tab {
    width: 100%;
    justify-content: center;
  }
}
