/* Elian — Studio IA, selector de modelo y planes (2026-11-13).
   Se carga al final. Sin bordes visibles, iconos abiertos, Manrope, tokens de v10-skin.css.
   --r7-accent: acento AA de la paleta (claro) o el primario (oscuro). --r7-on: texto sobre el acento. */

body { --r7-accent: var(--v10-accent, var(--primary)); --r7-on: #FFFFFF; --r7-tint: color-mix(in srgb, var(--text) 5.5%, transparent); }
body:not(.light-mode) { --r7-accent: var(--primary); --r7-on: #07111F; }

/* ───────── Móvil: el chat termina donde empieza la barra inferior ───────── */
@media (max-width: 640px) {
  .section.active.chat-layout { height: calc(100dvh - 60px - env(safe-area-inset-bottom, 0px)); }
}

/* ───────── Encabezado: Energía IA discreta ───────── */
.studio-credits-chip { min-height: 40px; font-weight: 700; }
.studio-credits-label { margin-right: 6px; font-weight: 600; opacity: .8; }
@media (max-width: 520px) { .studio-credits-label { display: none; } }
.studio-header-btn { min-height: 40px; }

/* ───────── Estado vacío ───────── */
.studio-welcome { padding: 4vh 20px 20px; gap: 8px; justify-content: center; }
.studio-welcome .v10-studio-art { width: 120px; height: 120px; margin-bottom: 6px; }
.studio-welcome-title { font-size: clamp(27px, 5vw, 36px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.studio-welcome-sub { font-size: 16px; line-height: 1.6; max-width: 420px; color: var(--text-muted); margin: 0; }
.studio-suggestions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 580px; margin-top: 20px; }
.studio-suggestion {
  display: flex; align-items: center; gap: 13px; text-align: left; min-height: 64px; padding: 14px 18px;
  border: 0; border-radius: 22px; background: var(--r7-tint); color: var(--text); box-shadow: none;
  font: inherit; font-size: 15px; font-weight: 600; line-height: 1.35; cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}
.studio-suggestion svg { color: var(--r7-accent); flex: none; opacity: 1; }
.studio-suggestion:hover { background: color-mix(in srgb, var(--r7-accent) 11%, transparent); transform: none; }
.studio-suggestion:active { transform: scale(.985); }
.studio-energy-line {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 18px; min-height: 44px; padding: 0 14px;
  border: 0; background: none; color: var(--text-muted); font: inherit; font-size: 14px; cursor: pointer; border-radius: 999px;
}
.studio-energy-line svg { color: #C79A2E; }
.studio-energy-line strong { color: var(--text); font-weight: 700; }
.studio-energy-line:hover { background: var(--r7-tint); }
@media (max-height: 760px) { .studio-welcome .v10-studio-art { display: none; } }
@media (max-width: 560px) {
  .studio-suggestions { grid-template-columns: 1fr; gap: 8px; margin-top: 14px; }
  .studio-suggestion { min-height: 58px; padding: 12px 16px; }
  .studio-welcome .v10-studio-art { width: 96px; height: 96px; }
  .studio-welcome-sub { font-size: 15px; }
}

/* ───────── Mensajes legibles ───────── */
.chat-messages { padding: 24px 24px 12px; gap: 24px; scroll-behavior: smooth; }
.chat-msg { max-width: min(100%, 780px); }
.chat-bubble { font-size: 15.5px; line-height: 1.75; max-width: min(100%, 72ch); overflow-wrap: anywhere; }
.chat-msg.assistant .chat-bubble { padding: 14px 20px; }
.chat-msg.user .chat-bubble { background: var(--r7-accent); color: var(--r7-on); box-shadow: none; }
.chat-msg.user .markdown-body code { background: rgba(255,255,255,.22); }
.chat-bubble-wrap { max-width: 100%; }
.markdown-body p { margin: 0 0 12px; }
.markdown-body p:last-child, .markdown-body ul:last-child, .markdown-body ol:last-child { margin-bottom: 0; }
.markdown-body ul, .markdown-body ol { margin: 0 0 12px; padding-left: 22px; }
.markdown-body ul { list-style: disc; }
.markdown-body ol { list-style: decimal; }
.markdown-body li { margin-bottom: 6px; }
.markdown-body li::marker { color: var(--r7-accent); }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 { font-size: 1.04em; font-weight: 700; margin: 18px 0 8px; line-height: 1.4; }
.markdown-body h1:first-child, .markdown-body h2:first-child, .markdown-body h3:first-child { margin-top: 0; }
.markdown-body blockquote { border: 0; border-radius: 14px; background: color-mix(in srgb, var(--r7-accent) 8%, transparent); padding: 10px 16px; margin: 0 0 12px; font-style: normal; opacity: 1; }
.markdown-body blockquote p:last-child { margin-bottom: 0; }
.markdown-body a { color: var(--r7-accent); text-underline-offset: 3px; }
.markdown-body hr { border: 0; height: 1px; background: color-mix(in srgb, var(--text) 10%, transparent); margin: 16px 0; }
.markdown-body pre { overflow-x: auto; background: var(--r7-tint); border-radius: 14px; padding: 12px 14px; margin: 0 0 12px; }
.markdown-body pre code { background: none; padding: 0; }
.markdown-body code { background: var(--r7-tint); font-size: .92em; }
.markdown-body table { display: block; overflow-x: auto; border-collapse: collapse; margin: 0 0 12px; max-width: 100%; }
.markdown-body th, .markdown-body td { padding: 8px 12px; text-align: left; border: 0; }
.markdown-body th { font-weight: 700; background: var(--r7-tint); }
.markdown-body tr:nth-child(even) td { background: color-mix(in srgb, var(--text) 3%, transparent); }
.chat-msg-actions { opacity: .9; gap: 2px; flex-wrap: wrap; }
.chat-msg:hover .chat-msg-actions, .chat-msg-actions:focus-within { opacity: 1; }
.chat-action-btn { min-height: 34px; font-size: 12.5px; color: color-mix(in srgb, var(--text) 72%, transparent); }
@media (hover: none) { .chat-msg-actions { opacity: 1; } .chat-action-btn { min-height: 40px; padding: 5px 12px; } }
@media (max-width: 640px) {
  .chat-messages { padding: 18px 16px 10px; gap: 20px; }
  .chat-bubble { font-size: 16px; }
  .chat-msg .chat-bubble { max-width: 100%; }
  .chat-msg.user .chat-bubble { max-width: 92%; }
}

/* ───────── Pensando ───────── */
.studio-thinking { display: inline-flex; align-items: center; gap: 12px; padding: 13px 20px !important; }
.studio-thinking-label { font-size: 14.5px; color: color-mix(in srgb, var(--text) 75%, transparent); }
.studio-thinking-dots { display: inline-flex; gap: 4px; }
.studio-thinking-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--r7-accent); animation: r7pulse 1.2s infinite ease-in-out; }
.studio-thinking-dots i:nth-child(2) { animation-delay: .15s; }
.studio-thinking-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes r7pulse { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }
@keyframes r7spin { to { transform: rotate(360deg); } }
@keyframes r7sheet { from { transform: translateY(28px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes r7fade { from { opacity: 0; } to { opacity: 1; } }

/* ───────── Caja de escribir ───────── */
.chat-input-area { gap: 8px; padding: 4px 24px 16px; }
.studio-input-wrap { min-height: 56px; border-radius: 28px; padding: 6px 6px 6px 8px; gap: 2px; align-items: flex-end; }
.studio-input-wrap:focus-within { box-shadow: 0 0 0 2px color-mix(in srgb, var(--r7-accent) 38%, transparent); }
.chat-input { font-size: 16px; line-height: 1.5; padding: 11px 8px; min-height: 44px; max-height: 180px; overflow-y: auto; }
.chat-pdf-btn { width: 44px; height: 44px; border-radius: 50%; }
.chat-send-btn { width: 44px; height: 44px; min-width: 44px; border-radius: 50%; background: var(--r7-accent); color: var(--r7-on); box-shadow: none; }
.chat-send-btn:hover { transform: none; box-shadow: none; opacity: .92; }
.chat-send-btn:active { transform: scale(.94); }
.chat-send-btn:disabled { opacity: .4; }
.studio-input-hint { display: none; }
@media (hover: hover) and (pointer: fine) { .studio-input-hint { display: block; opacity: .6; margin: 2px 0 0; } }
@media (max-width: 640px) { .chat-input-area { padding: 2px 12px 10px; } }

/* ───────── Chip del modelo ───────── */
.v10-model-trigger.m7-chip {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; margin: 0; padding: 6px 14px 6px 12px; min-height: 40px;
  border: 0; border-radius: 999px; background: var(--r7-tint); color: var(--text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; max-width: 100%;
  transition: background .18s ease;
}
.v10-model-trigger.m7-chip:hover { background: color-mix(in srgb, var(--r7-accent) 11%, transparent); }
.v10-model-trigger.m7-chip svg { color: var(--r7-accent); width: 18px; height: 18px; flex: none; }
.v10-model-trigger.m7-chip svg:last-child { width: 14px; height: 14px; color: var(--text-muted); }
.m7-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.light-mode .v10-model-trigger.m7-chip svg { color: var(--r7-accent); }

/* ───────── Hoja (móvil) / globo (escritorio) de modelos ───────── */
.m7-overlay { position: fixed; inset: 0; z-index: 10050; display: flex; align-items: flex-end; justify-content: center; background: rgba(8, 14, 24, .42); animation: r7fade .2s ease; }
.m7-panel {
  position: relative; width: 100%; max-width: 560px; max-height: 88dvh; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); color: var(--text); border-radius: 28px 28px 0 0; box-shadow: 0 -10px 50px rgba(0,0,0,.2);
  animation: r7sheet .3s cubic-bezier(.2, .8, .2, 1);
}
.m7-panel::before { content: ""; position: absolute; top: 8px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 4px; background: color-mix(in srgb, var(--text) 18%, transparent); }
.m7-panel header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 24px 12px 6px 24px; }
.m7-panel h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.m7-x { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; background: none; color: var(--text-muted); cursor: pointer; border-radius: 50%; }
.m7-x:hover { background: var(--r7-tint); color: var(--text); }
.m7-body { overflow-y: auto; overscroll-behavior: contain; padding: 0 12px calc(14px + env(safe-area-inset-bottom, 0px)); }
.m7-sub, .m7-muted { margin: 0; padding: 4px 12px 8px; font-size: 14.5px; line-height: 1.55; color: var(--text-muted); }
.m7-group h3 { display: flex; align-items: center; gap: 8px; margin: 16px 12px 4px; font-size: 13px; font-weight: 700; color: var(--text-muted); }
.m7-group h3 svg { color: var(--r7-accent); width: 18px; height: 18px; }
.m7-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; min-height: 72px; padding: 13px 14px; margin: 2px 0;
  border: 0; border-radius: 20px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: background .15s ease;
}
.m7-row:hover:not(:disabled) { background: var(--r7-tint); }
.m7-row.is-selected { background: color-mix(in srgb, var(--r7-accent) 11%, transparent); }
.m7-row:disabled { opacity: .5; cursor: default; }
.m7-row-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.m7-name { font-size: 16px; font-weight: 700; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.m7-rec { font-style: normal; font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--r7-accent) 15%, transparent); color: var(--r7-accent); }
.m7-desc { font-size: 14px; line-height: 1.45; color: var(--text-muted); }
.m7-meta { display: inline-flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.m7-row.is-locked .m7-meta { color: var(--r7-accent); }
.m7-mark { flex: none; width: 24px; display: inline-flex; justify-content: center; color: var(--r7-accent); }
.m7-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 12px 0; padding-top: 6px; font-size: 14px; color: var(--text-muted); }
.m7-foot strong { color: var(--text); }
.m7-plans { min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; background: color-mix(in srgb, var(--r7-accent) 12%, transparent); color: var(--r7-accent); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.m7-plans:hover { background: color-mix(in srgb, var(--r7-accent) 20%, transparent); }
.m7-retry { margin: 6px 12px; }
@media (min-width: 768px) {
  .m7-overlay { background: transparent; align-items: flex-start; justify-content: flex-start; animation: none; }
  .m7-panel { position: fixed; border-radius: 26px; max-width: 430px; box-shadow: 0 18px 60px rgba(0,0,0,.24); animation: r7fade .18s ease; }
  .m7-panel::before { display: none; }
  .m7-panel header { padding-top: 18px; }
}

/* ───────── Planes ───────── */
.pl-overlay { position: fixed; inset: 0; z-index: 10050; display: flex; align-items: flex-end; justify-content: center; background: rgba(8, 14, 24, .46); animation: r7fade .2s ease; }
.pl-panel {
  position: relative; width: 100%; max-width: 1080px; max-height: 94dvh; display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg); color: var(--text); border-radius: 28px 28px 0 0; animation: r7sheet .3s cubic-bezier(.2, .8, .2, 1);
}
.pl-close { position: absolute; top: 8px; right: 8px; z-index: 2; display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border: 0; background: none; color: var(--text-muted); cursor: pointer; border-radius: 50%; }
.pl-close:hover { background: var(--r7-tint); color: var(--text); }
.pl-head { padding: 28px 64px 14px 24px; }
.pl-head h2 { margin: 0; font-size: clamp(25px, 5vw, 34px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.pl-head p { margin: 8px 0 0; max-width: 540px; font-size: 15.5px; line-height: 1.55; color: var(--text-muted); }
.pl-scroll { overflow-y: auto; overscroll-behavior: contain; padding: 8px 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
.pl-loading { padding: 40px 8px; text-align: center; color: var(--text-muted); }
.pl-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.pl-card { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 22px 20px 20px; border-radius: 26px; background: var(--surface); }
.pl-card.is-popular { background: color-mix(in srgb, var(--r7-accent) 9%, var(--surface)); }
.pl-card.is-current { background: color-mix(in srgb, var(--r7-accent) 14%, var(--surface)); }
.pl-card.is-highlight { background: color-mix(in srgb, var(--r7-accent) 16%, var(--surface)); }
.pl-tag { position: absolute; top: 18px; right: 18px; padding: 4px 12px; border-radius: 999px; background: var(--r7-accent); color: var(--r7-on); font-size: 12px; font-weight: 700; }
.pl-name { margin: 0; font-size: 19px; font-weight: 700; }
.pl-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.pl-price strong { font-size: 36px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pl-price span { font-size: 14px; color: var(--text-muted); }
.pl-seg { display: inline-flex; align-self: flex-start; gap: 2px; padding: 3px; border-radius: 999px; background: var(--r7-tint); }
.pl-seg-btn { min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; color: var(--text-muted); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.pl-seg-btn.on { background: var(--surface); color: var(--text); }
.pl-card.is-popular .pl-seg-btn.on, .pl-card.is-current .pl-seg-btn.on { background: color-mix(in srgb, var(--r7-accent) 14%, var(--surface)); }
.pl-save { margin: -2px 0 0; font-size: 14px; font-weight: 700; color: var(--r7-accent); }
.pl-feats { list-style: none; margin: 4px 0 6px; padding: 0; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.pl-feats li { display: flex; align-items: flex-start; gap: 10px; font-size: 15px; line-height: 1.45; }
.pl-feats li svg { flex: none; margin-top: 2px; color: var(--r7-accent); }
.pl-action { min-height: 48px; display: flex; align-items: center; }
.pl-here { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; color: var(--r7-accent); }
.pl-btn { display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; padding: 0 22px; border: 0; border-radius: 999px; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; text-decoration: none; transition: opacity .15s ease, background .15s ease; }
.pl-btn-primary { background: var(--r7-accent); color: var(--r7-on); }
.pl-btn-primary:hover { opacity: .92; }
.pl-btn-soft { background: color-mix(in srgb, var(--r7-accent) 13%, transparent); color: var(--r7-accent); }
.pl-btn-soft:hover { background: color-mix(in srgb, var(--r7-accent) 21%, transparent); }
.pl-btn-quiet { background: var(--r7-tint); color: var(--text); }
.pl-btn-quiet:hover { background: color-mix(in srgb, var(--text) 10%, transparent); }
.pl-btn:disabled { opacity: .6; cursor: default; }
.pl-note { margin: 0 0 14px; padding: 16px 20px; border-radius: 22px; background: color-mix(in srgb, var(--r7-accent) 9%, transparent); font-size: 15px; line-height: 1.55; }
.pl-note p { margin: 0 0 6px; }
.pl-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; border: 0; background: none; color: var(--r7-accent); font: inherit; font-size: 14.5px; font-weight: 600; text-decoration: none; cursor: pointer; text-align: center; }
.pl-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.pl-foot { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 22px; text-align: center; }
.pl-foot .pl-btn { width: auto; min-width: 260px; }
.pl-secure { margin: 8px 0 0; font-size: 13.5px; color: var(--text-muted); max-width: 440px; line-height: 1.5; }
.pl-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 18px; }
.pl-overlay-small { z-index: 10060; align-items: center; padding: 20px; }
.pl-notice { width: 100%; max-width: 400px; padding: 30px 24px 20px; border-radius: 28px; background: var(--surface); color: var(--text); text-align: center; box-shadow: 0 20px 70px rgba(0,0,0,.28); animation: r7sheet .25s cubic-bezier(.2, .8, .2, 1); }
.pl-notice h2 { margin: 0 0 8px; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.pl-notice p { margin: 0 0 18px; font-size: 15.5px; line-height: 1.6; color: var(--text-muted); }
.pl-notice-mark { display: flex; justify-content: center; margin-bottom: 8px; color: var(--r7-accent); }
.pl-notice-mark svg { width: 40px; height: 40px; }
.pl-notice-actions { display: flex; flex-direction: column; gap: 8px; }
.pl-notice > .pl-btn { margin-bottom: 4px; }
.pl-spin { width: 30px; height: 30px; margin: 2px auto 16px; border-radius: 50%; background: conic-gradient(from 0deg, transparent 0 20%, var(--r7-accent)); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px)); mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px)); animation: r7spin 1s linear infinite; }
.pl-btn:focus-visible, .pl-link:focus-visible, .pl-seg-btn:focus-visible, .pl-close:focus-visible, .m7-row:focus-visible, .m7-x:focus-visible, .m7-plans:focus-visible, .m7-chip:focus-visible, .studio-suggestion:focus-visible, .studio-energy-line:focus-visible { outline: 2px solid var(--r7-accent); outline-offset: 2px; }
@media (min-width: 640px) { .pl-grid { grid-template-columns: 1fr 1fr; } .pl-scroll { padding-inline: 24px; } .pl-head { padding-inline: 32px 72px; } }
@media (min-width: 900px) {
  .pl-overlay { align-items: center; padding: 28px; }
  .pl-panel { border-radius: 32px; max-height: 92dvh; animation: r7fade .22s ease; }
  .pl-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; }
  .pl-tag { top: 20px; right: 16px; }
}

/* ───────── Aviso de Energía agotada (en el chat) ───────── */
.studio-credit-notice h4 { margin: 0 0 6px; font-size: 16.5px; font-weight: 700; }
.studio-credit-notice p { margin: 0 0 14px; font-size: 15px; line-height: 1.6; color: var(--text-muted); }
.studio-credit-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.studio-credit-actions .pl-btn { width: auto; }

@media (prefers-reduced-motion: reduce) {
  .m7-overlay, .m7-panel, .pl-overlay, .pl-panel, .pl-notice { animation: none; }
  .studio-thinking-dots i { animation: none; opacity: .7; }
  .pl-spin { animation-duration: 3s; }
  .chat-messages { scroll-behavior: auto; }
}

/* Ajustes: tarjeta de planes sin borde */
.settings-premium-card, .settings-rows-card[style*="border-color"] { border: 0 !important; box-shadow: none !important; }
