/* Claudbar · estilo ChatGPT (igual que claudbar.com/app). Va al final: manda sobre styles/layout/theme-web/theme-light. */
:root {
  --bg: #212121; --surface: #181818; --surface-2: #2a2a2a; --border: rgba(255,255,255,.10); --text: #ececec; --muted: #afafaf;
  --accent-primary: #ececec; --accent-secondary: #afafaf;
  --cg-input: #303030; --cg-menu: #353535; --cg-user: #303030; --cg-hover: rgba(255,255,255,.06); --cg-ph: #8f8f8f; --cg-code: #171717;
  --display: ui-sans-serif, -apple-system, system-ui, "Segoe UI", Inter, Roboto, sans-serif;
}
:root[data-theme="light"] {
  --bg: #ffffff; --surface: #f9f9f9; --surface-2: #ececec; --border: rgba(0,0,0,.10); --text: #0d0d0d; --muted: #5d5d5d;
  --accent-primary: #0d0d0d; --accent-secondary: #5d5d5d;
  --cg-input: #ffffff; --cg-menu: #ffffff; --cg-user: #f4f4f4; --cg-hover: rgba(0,0,0,.05); --cg-ph: #8f8f8f; --cg-code: #f6f6f6;
}
body { font: 14.5px/1.55 ui-sans-serif, -apple-system, system-ui, "Segoe UI", Inter, Roboto, sans-serif; background: var(--bg); color: var(--text); }
.app, :root[data-theme="light"] .app { background: var(--bg); }

/* Iconos de línea (cb-icons.js) */
.cb-ic { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* Barra de iconos */
.rail { background: var(--surface); border-left: 0; border-right: 0; }
.rail-btn { color: var(--muted); font-size: 11.5px; }
.rail-btn:hover { color: var(--text); }
.rail-btn .ri { border-radius: 10px; color: inherit; }
.rail-btn:hover .ri { background: var(--cg-hover); }
.rail-btn[aria-current="true"] .ri, .rail-btn[aria-pressed="true"] .ri, .rail-btn[aria-expanded="true"] .ri { background: var(--cg-hover); color: var(--text); box-shadow: none; }
.rail-btn[aria-current="true"], .rail-btn[aria-pressed="true"] { color: var(--text); }
.rail-sep { background: var(--border); }

/* Portada */
#app .hero-hello, #app .hero-hello * { font: 400 28px/1.2 var(--display); letter-spacing: -.01em; color: var(--text); background: none; -webkit-text-fill-color: currentColor; }
#app .hero-ask { font: 400 16px var(--display); color: var(--muted); }
.feature-card, .feature-agent, :root[data-theme="light"] .feature-agent { background: transparent; border: 1px solid var(--border); border-radius: 16px; box-shadow: none; }
.feature-agent:hover, button.feature-card:hover { background: var(--cg-hover); border-color: var(--border); }
.feature-agent .badge, .feature-agent [class*="badge"] { background: var(--cg-hover); color: var(--text); }
.feature-agent .btn, .feature-agent button { background: var(--text); color: var(--bg); border-radius: 999px; }
.example-btn, .quick-row button, .quick-row a { border-radius: 999px; background: transparent; border: 1px solid var(--border); color: var(--muted); box-shadow: none; }
.example-btn:hover, .quick-row button:hover { background: var(--cg-hover); color: var(--text); }

/* Mensajes */
.bubble { border: 0; background: transparent; padding: 0; line-height: 1.7; }
.message.user .bubble, :root[data-theme="light"] .message.user .bubble { background: var(--cg-user); color: var(--text); border-radius: 18px; padding: 9px 14px; box-shadow: none; }
.bubble pre { background: var(--cg-code); border: 0; border-radius: 12px; }
.bubble code { background: var(--cg-hover); border: 0; border-radius: 6px; }
.msg-actions button { color: var(--muted); border-radius: 8px; }
.msg-actions button:hover { background: var(--cg-hover); color: var(--text); }

/* Caja de escribir */
#app .composer, #app #chat-form { margin: 0 10px 10px; padding: 8px 10px; border-radius: 26px; background: var(--cg-input); border: 1px solid var(--border); box-shadow: inset 0 0 1px rgba(255,255,255,.2); }
:root[data-theme="light"] #app .composer { box-shadow: 0 4px 16px rgba(0,0,0,.06); }
#app .composer:focus-within { border-color: color-mix(in srgb, var(--text) 22%, transparent); box-shadow: inset 0 0 1px rgba(255,255,255,.2); }
.composer textarea { color: var(--text); font: 15px/1.5 var(--display); }
.composer textarea::placeholder { color: var(--cg-ph); }
#send-btn { background: var(--text); color: var(--bg); border-radius: 50%; box-shadow: none; }
#send-btn:disabled { background: color-mix(in srgb, var(--text) 25%, transparent); opacity: 1; }
#mic-btn, .composer-tools button { color: var(--text); background: transparent; border: 0; border-radius: 10px; box-shadow: none; }
#mic-btn:hover, .composer-tools button:hover { background: var(--cg-hover); }
#model-btn { border: 0; background: transparent; color: var(--text); font-weight: 500; border-radius: 10px; }
#model-btn:hover { background: var(--cg-hover); }

/* Menús */
.menu, #model-menu, .popover { background: var(--cg-menu); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 8px 30px rgba(0,0,0,.4); padding: 6px; }
.menu-item { border-radius: 10px; min-height: 38px; }
.menu-item:hover, .menu-item.sel { background: var(--cg-hover); }

/* Biblioteca, ajustes y pie */
.library, .drawer, .settings-view { background: var(--surface); }
.panel-foot { color: var(--muted); }

/* Pantalla completa (sidepanel.html?full=1): misma app a gran escala, como ChatGPT */
html.cb-full .chat, html.cb-full .hero, html.cb-full .composer, html.cb-full .composer-tools, html.cb-full #quote-box, html.cb-full #attachments, html.cb-full .panel-foot { width: 100%; max-width: 780px; margin-left: auto; margin-right: auto; box-sizing: border-box; }
html.cb-full .composer { margin-bottom: 16px; }
html.cb-full .hero { padding-top: 14vh; }
html.cb-full #app .hero-hello, html.cb-full #app .hero-hello * { font-size: 32px; }
html.cb-full body { font-size: 16px; }
@media (min-width: 1000px) {
  html.cb-full .library.drawer:not([hidden]) { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 40; box-shadow: none; border-right: 1px solid var(--border); }
}
html.cb-full #app .composer, html.cb-full #app #chat-form { width: calc(100% - 40px); max-width: 780px; margin: 0 auto 16px; }
.cb-full-btn .ri .cb-ic { width: 18px; height: 18px; }

/* ===== Configuración (options.html) estilo ChatGPT ===== */
.opt-nav { background: var(--surface); border-right: 0; }
.opt-brand { font: 600 18px var(--display); }
.opt-link { color: var(--text); font-size: 14px; border-radius: 10px; padding: 9px 12px; }
.opt-link .ico, .opt-link .cb-ic { color: var(--muted); opacity: 1; }
.opt-link:hover { background: var(--cg-hover); color: var(--text); }
.opt-link.active { background: var(--surface-2); color: var(--text); box-shadow: none; }
.opt-link.active .ico, .opt-link.active .cb-ic { color: var(--text); }
.opt-nav-sep { background: var(--border); }
.opt-page > h2 { font: 600 22px var(--display); letter-spacing: -.01em; }
.opt-group { background: transparent; border: 1px solid var(--border); border-radius: 16px; }
.opt-row + .opt-row { border-top-color: var(--border); }
.opt-row .txt b { font-weight: 500; }
.opt-select, .opt-input { background: var(--cg-input); border: 1px solid var(--border); border-radius: 10px; }
.opt-select:focus, .opt-input:focus { border-color: color-mix(in srgb, var(--text) 30%, transparent); box-shadow: none; }
.switch { background: var(--surface-2); }
.switch[aria-checked="true"], .switch.on { background: var(--text); }
.switch[aria-checked="true"]::after, .switch.on::after { background: var(--bg); }
.btn-primary { background: var(--text); color: var(--bg); border: 0; border-radius: 999px; box-shadow: none; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 999px; }
.btn-ghost:hover { background: var(--cg-hover); }
.cb-opt-hero { display: flex; align-items: center; gap: 16px; max-width: 860px; margin: 0 0 26px; padding: 18px 20px; border: 1px solid var(--border); border-radius: 18px; }
.cb-opt-hero .cb-m { width: 84px; height: 70px; flex: none; }
.cb-opt-hero .cb-m .mascot { width: 100%; height: 100%; }
.cb-opt-hero b { display: block; font: 600 20px var(--display); }
.cb-opt-hero small { color: var(--muted); font-size: 14px; }

/* ===== Extras del panel (ui/panel-extras.js) ===== */
.feature-agent { position: relative; transition: opacity .2s, transform .2s; }
.feature-agent.cb-leave { opacity: 0; transform: translateY(-6px) scale(.98); }
.cb-x { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.cb-x:hover { background: var(--cg-hover); color: var(--text); }
.cb-agent-dock { display: flex; gap: 6px; margin: 0 10px 6px; overflow-x: auto; scrollbar-width: none; animation: cbPopIn .16s ease both; }
.cb-agent-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--cg-input); color: var(--muted); font-size: 12.5px; cursor: pointer; }
.cb-agent-chip b { color: var(--text); font-weight: 600; }
.cb-agent-chip .cb-live-dot { width: 7px; height: 7px; color: #34d399; }
.cb-agent-chip.paused .cb-live-dot { color: #fbbf24; animation: none; }
.cb-pins { display: flex; flex-direction: column; gap: 2px; }
.cb-pin img { border-radius: 4px; }
.cb-pin-letter { font-size: 13px; }
.cb-add-pin { display: flex; align-items: center; gap: 8px; width: calc(100% - 16px); margin: 4px 8px 8px; padding: 8px 10px; border: 1px dashed var(--border); border-radius: 10px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.cb-add-pin:hover { background: var(--cg-hover); color: var(--text); }

/* Color de acento elegido (como en la web) */
:root[data-accent] #send-btn { background: var(--cb-accent); color: #0d0d0d; }
:root[data-accent] .rail-btn[aria-current="true"] .ri, :root[data-accent] .rail-btn[aria-pressed="true"] .ri { color: var(--cb-accent); }
:root[data-accent] .opt-link.active .cb-ic, :root[data-accent] .switch[aria-checked="true"], :root[data-accent] .switch.on { color: var(--cb-accent); }
:root[data-accent] .switch[aria-checked="true"], :root[data-accent] .switch.on { background: var(--cb-accent); }
:root[data-accent] .btn-primary { background: var(--cb-accent); color: #0d0d0d; }
:root[data-accent] .composer:focus-within { border-color: color-mix(in srgb, var(--cb-accent) 55%, transparent); }

/* Pantalla grande: más compacta */
html.cb-full body { font-size: 15px; }
html.cb-full .hero { padding-top: 10vh; }
html.cb-full #app .hero-hello, html.cb-full #app .hero-hello * { font-size: 28px; }
html.cb-full .chat { max-width: 720px; }
.cb-accents { margin-left: auto; display: flex; gap: 8px; }
.cb-accents button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; background: var(--c); outline: 2px solid var(--bg); outline-offset: -4px; cursor: pointer; transition: transform .15s; }
.cb-accents button:hover { transform: scale(1.1); }
.cb-accents button[aria-pressed="true"] { border-color: var(--text); }
.g-logo-svg { width: 18px; height: 18px; flex: none; }

/* ===== Panel de agentes estilo ChatGPT (diseñador NVIDIA, revisado) ===== */
html body .agents-view { position: absolute; inset: 0; z-index: 60; overflow: auto; background: var(--bg); padding: 14px 14px 24px; display: flex; flex-direction: column; gap: 12px; animation: ag-in2 .25s cubic-bezier(.22,1,.36,1); }
@keyframes ag-in2 { from { transform: translateY(8px); } }
html body .ag-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
html body .ag-head b { font: 600 18px var(--display, inherit); display: block; }
html body .ag-head small { color: var(--muted); font-size: 12.5px; }
html body .ag-new { display: grid; gap: 8px; padding: 12px; border: 1px solid rgba(255,255,255,.08); border-radius: 16px; background: var(--surface); }
html body .ag-rows { display: grid; gap: 8px; }
html body .ag-row { display: flex; gap: 8px; align-items: flex-start; }
html body .ag-row textarea { flex: 1; resize: vertical; min-height: 40px; padding: 8px 10px; border-radius: 22px; border: 1px solid rgba(255,255,255,.08); background: #303030; color: var(--text); font: inherit; }
html body .ag-ask input { flex: 1; resize: vertical; min-height: 40px; padding: 8px 10px; border-radius: 12px; border: 1px solid rgba(255,255,255,.08); background: var(--bg); color: var(--text); font: inherit; }
html body .ag-dot { flex: none; width: 12px; height: 12px; margin-top: 12px; border-radius: 50%; }
html body .ag-top .ag-dot { margin-top: 0; }
html body .ag-tools { display: flex; gap: 8px; flex-wrap: wrap; }
html body .ag-tools select { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 12px; border: 1px solid rgba(255,255,255,.08); background: var(--bg); color: var(--text); font: inherit; font-size: 13px; }
html body .ag-go { width: 100%; padding: 10px; border-radius: 9999px; border: none; background: var(--c); color: #fff; font: inherit; cursor: pointer; }
html body .ag-sub { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 4px 2px 0; }
html body .ag-empty { color: var(--muted); font-size: 13px; }
html body .ag-list { display: grid; gap: 10px; }
html body .ag-card { border: none; border-radius: 14px; padding: 10px 12px; background: #2a2a2a; display: grid; gap: 6px; border-left: 4px solid var(--c); }
html body .ag-top { display: flex; align-items: center; gap: 8px; } html body .ag-top b { flex: 1; font-size: 13.5px; }
html body .ag-task { font-size: 13px; }
html body .ag-line { font-size: 12.5px; color: var(--muted); }
html body .ag-card.run .ag-line::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--c); animation: ag-pulse2 1s infinite alternate; }
@keyframes ag-pulse2 { to { opacity: .25; } }
html body .ag-result { white-space: pre-wrap; font-size: 13px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
html body .ag-ask { display: grid; gap: 6px; padding: 8px; border-radius: 10px; background: color-mix(in srgb, var(--c) 12%, transparent); }
html body .ag-ask p { font-size: 13px; } html body .ag-ask button { justify-self: start; }
html body .ag-note { font-size: 12px; color: var(--muted); }
html body .ag-card.paused { opacity: .75; } html body .ag-card.paused .ag-line::before { animation: none; }

.cb-agent-toggle { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border) !important; background: transparent; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; transition: background .2s, color .2s, border-color .2s; }
.cb-agent-toggle:hover { background: var(--cg-hover); color: var(--text); }
.cb-agent-toggle[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text) !important; }
:root[data-accent] .cb-agent-toggle[aria-pressed="true"] { background: var(--cb-accent); border-color: var(--cb-accent) !important; color: #0d0d0d; }
.rail.cb-drop { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--text) 40%, transparent); }
.cb-add-pin span::after { content: " (o arrastra un enlace a la barra)"; opacity: .7; }
html body .ag-go { background: var(--text); color: var(--bg); font-weight: 600; } :root[data-accent] html body .ag-go, :root[data-accent] body .ag-go { background: var(--cb-accent); color: #0d0d0d; }

/* Cada agente es una nubecita animada del color de su grupo (flota; late mientras trabaja) */
html body .ag-dot { width: 24px; height: 17px; margin-top: 10px; border-radius: 0; background: var(--c, #a78bfa);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 140 80'%3E%3Cpath d='M30 70a22 22 0 0 1 2-44 30 30 0 0 1 56-8 24 24 0 0 1 34 22 20 20 0 0 1-4 40z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 140 80'%3E%3Cpath d='M30 70a22 22 0 0 1 2-44 30 30 0 0 1 56-8 24 24 0 0 1 34 22 20 20 0 0 1-4 40z'/%3E%3C/svg%3E") center / contain no-repeat;
  animation: cb-cloud-float 3.2s ease-in-out infinite; }
html body .ag-top .ag-dot { margin-top: 0; }
html body .ag-card.run .ag-dot { animation: cb-cloud-float 3.2s ease-in-out infinite, cb-cloud-work 1.1s ease-in-out infinite; }
html body .ag-card.done .ag-dot { animation: cb-cloud-hop .6s cubic-bezier(.2,.8,.2,1) 2; }
html body .cb-agent-chip .cb-live-dot { width: 16px; height: 11px; border-radius: 0; background: currentColor; -webkit-mask: inherit; }
@keyframes cb-cloud-float { 50% { translate: 0 -2px; } }
@keyframes cb-cloud-work { 50% { scale: 1.15; filter: brightness(1.3); } }
@keyframes cb-cloud-hop { 40% { translate: 0 -6px; } }
:root[data-reduce-motion] html body .ag-dot { animation: none !important; } 

/* Cada agente es una nubecita animada del color de su grupo (flota; late mientras trabaja) */
html body .ag-dot { width: 24px; height: 17px; margin-top: 10px; border-radius: 0; background: var(--c, #a78bfa);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 140 80'%3E%3Cpath d='M30 70a22 22 0 0 1 2-44 30 30 0 0 1 56-8 24 24 0 0 1 34 22 20 20 0 0 1-4 40z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 140 80'%3E%3Cpath d='M30 70a22 22 0 0 1 2-44 30 30 0 0 1 56-8 24 24 0 0 1 34 22 20 20 0 0 1-4 40z'/%3E%3C/svg%3E") center / contain no-repeat;
  animation: cb-cloud-float 3.2s ease-in-out infinite; }
html body .ag-top .ag-dot { margin-top: 0; }
html body .ag-card.run .ag-dot { animation: cb-cloud-float 3.2s ease-in-out infinite, cb-cloud-work 1.1s ease-in-out infinite; }
html body .ag-card.done .ag-dot { animation: cb-cloud-hop .6s cubic-bezier(.2,.8,.2,1) 2; }
html body .cb-agent-chip .cb-live-dot { width: 16px; height: 11px; border-radius: 0; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 140 80'%3E%3Cpath d='M30 70a22 22 0 0 1 2-44 30 30 0 0 1 56-8 24 24 0 0 1 34 22 20 20 0 0 1-4 40z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 140 80'%3E%3Cpath d='M30 70a22 22 0 0 1 2-44 30 30 0 0 1 56-8 24 24 0 0 1 34 22 20 20 0 0 1-4 40z'/%3E%3C/svg%3E") center / contain no-repeat; }
@keyframes cb-cloud-float { 50% { translate: 0 -2px; } }
@keyframes cb-cloud-work { 50% { scale: 1.15; filter: brightness(1.3); } }
@keyframes cb-cloud-hop { 40% { translate: 0 -6px; } }
:root[data-reduce-motion] html body .ag-dot { animation: none !important; } 

/* ===== Apariencia avanzada (ui/panel-extras.js › applyLook) ===== */
/* Densidad: compacta por defecto (≈10 % más pequeño); ultra ≈20 %. zoom escala letra, márgenes y rellenos a la vez. */
:root[data-density="compact"] body { zoom: .9; }
:root[data-density="ultra"] body { zoom: .8; }
/* Modo ultra minimalista: solo iconos (el texto queda en el tooltip) */
:root[data-minimal] .rail .rl, :root[data-minimal] .panel-foot small, :root[data-minimal] .cb-agent-toggle span, :root[data-minimal] .example-btn span, :root[data-minimal] .opt-link span:not(.ico), :root[data-minimal] .cb-add-pin span, :root[data-minimal] .lead, :root[data-minimal] .hint { display: none !important; }
:root[data-minimal] .rail-btn { padding-top: 6px; padding-bottom: 6px; }
:root[data-minimal] .feature-agent p { display: none; }
/* Cristal esmerilado ajustable */
:root[data-glass] .composer, :root[data-glass] .menu, :root[data-glass] #model-menu, :root[data-glass] .library, :root[data-glass] .drawer, :root[data-glass] .rail, :root[data-glass] .opt-nav, :root[data-glass] .opt-group, :root[data-glass] .ag-new, :root[data-glass] .ag-card {
  background-color: color-mix(in srgb, var(--surface) var(--cb-glass-op, 92%), transparent) !important;
  backdrop-filter: blur(var(--cb-glass-blur, 0px)) brightness(var(--cb-glass-bright, 1));
  -webkit-backdrop-filter: blur(var(--cb-glass-blur, 0px)) brightness(var(--cb-glass-bright, 1)); }
/* Degradados neón: botón de enviar, nubes de agentes, modo agente y bordes al enfocar */
:root[data-grad] #send-btn, :root[data-grad] .btn-primary, :root[data-grad] html body .ag-go, :root[data-grad] .cb-agent-toggle[aria-pressed="true"] { background: linear-gradient(135deg, var(--cb-grad-a), var(--cb-grad-b)) !important; color: #fff !important; border-color: transparent !important; }
:root[data-grad] .ag-dot, :root[data-grad] .cb-agent-chip .cb-live-dot { background: linear-gradient(135deg, var(--cb-grad-a), var(--cb-grad-b)) !important; }
:root[data-grad] .composer:focus-within { border-color: transparent !important; box-shadow: 0 0 0 1px var(--cb-grad-a), 0 0 18px -6px var(--cb-grad-b) !important; }
:root[data-grad] .example-btn:hover, :root[data-grad] .cb-agent-toggle:hover { border-color: var(--cb-grad-a) !important; }
/* Panel «Apariencia avanzada» en Configuración */
.cb-look { max-width: 860px; margin: 0 0 22px; padding: 14px 18px; border: 1px solid var(--border); border-radius: 16px; display: grid; gap: 12px; }
.cb-look h3 { margin: 0; font: 600 15px var(--display); }
.cb-look .row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
.cb-look .row > span:first-child { width: 150px; color: var(--text); }
.cb-look .seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--cg-hover); }
.cb-look .seg button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; padding: 5px 12px; border-radius: 8px; cursor: pointer; }
.cb-look .seg button[aria-pressed="true"] { background: var(--bg); color: var(--text); }
.cb-look input[type=range] { width: 140px; accent-color: var(--cb-accent, #ececec); }
.cb-look .grads button { width: 34px; height: 22px; border-radius: 999px; border: 2px solid transparent; cursor: pointer; }
.cb-look .grads button[aria-pressed="true"] { border-color: var(--text); }
.cb-look input[type=color] { width: 30px; height: 24px; border: 0; padding: 0; background: none; cursor: pointer; }
/* Con zoom, 100vh también se encoge: se compensa para que no quede una franja vacía abajo */
:root[data-density="compact"] .shell, :root[data-density="compact"] .shell > .app, :root[data-density="compact"] .opt-shell { height: calc(100vh / .9); }
:root[data-density="ultra"] .shell, :root[data-density="ultra"] .shell > .app, :root[data-density="ultra"] .opt-shell { height: calc(100vh / .8); }
:root[data-density="compact"] .center { min-height: calc(100vh / .9); }
:root[data-density="ultra"] .center { min-height: calc(100vh / .8); }

/* ===== Arreglos de la auditoría de diseño (pulidor + director de arte + auditor) ===== */
/* P0 · contraste */
html body .btn-primary, html body #lib-new { background: var(--text) !important; color: var(--bg) !important; border: 0; }
html body .btn-primary:hover, html body #lib-new:hover { opacity: .88; }
html body .drawer-tab { color: var(--muted); }
html body .drawer-tab[aria-selected="true"], html body .drawer-tab.active, html body .drawer-tab[aria-pressed="true"] { background: #3a3a3a !important; color: #ffffff !important; }
:root[data-theme="light"] html body .drawer-tab[aria-selected="true"] { background: #e6e6e6 !important; color: #0d0d0d !important; }
html body .fc-badge { background: color-mix(in srgb, var(--text) 14%, transparent) !important; color: var(--text) !important; }
.cb-look .seg button { color: #cfcfcf; }
:root[data-theme="light"] .cb-look .seg button { color: #3d3d3d; }
#ask-ai.ask { background: var(--text, #ececec) !important; color: var(--bg, #0d0d0d) !important; }
/* P1 · legibilidad: etiquetas de la barra de iconos */
html body .rail .rl { font-size: 11.5px; }
/* P1 · el cajón «Más» siempre opaco (sin texto de fondo detrás) */
html body .library, html body .drawer { background: var(--surface) !important; }
:root[data-glass] html body .library, :root[data-glass] html body .drawer { background: color-mix(in srgb, var(--surface) var(--cb-glass-op, 92%), transparent) !important; }
/* Acceso directo: una sola línea + pista pequeña debajo */
.cb-add-pin span::after { content: none !important; }
.cb-add-pin { flex-wrap: wrap; row-gap: 0; }
.cb-add-pin .cb-hint { flex-basis: 100%; padding-left: 24px; font-size: 11.5px; opacity: .7; }
/* Faltantes señalados: foco visible para teclado y estados al pulsar */
:focus-visible { outline: 2px solid color-mix(in srgb, var(--cb-accent, var(--text)) 70%, transparent) !important; outline-offset: 2px; border-radius: 8px; }
.rail-btn:active .ri, .example-btn:active, .cb-agent-toggle:active, .menu-item:active { scale: .96; }
/* Objetivos táctiles mínimos en la barra de herramientas del cuadro de texto */
.composer-tools button { min-width: 32px; min-height: 32px; }
html body .drawer-tab:not([aria-selected="true"]) { color: #c9c9c9; }

/* ===== Pantalla grande estilo ChatGPT/Claude: barra a la izquierda, contenido centrado ===== */
html.cb-full .rail { order: -1; width: 252px; background: var(--surface); border-right: 1px solid var(--border); padding: 14px 10px; gap: 2px; }
html.cb-full .rail-btn { height: 38px; border-radius: 10px; color: var(--muted); }
html.cb-full .rail-btn:hover { background: var(--cg-hover); color: var(--text); }
html.cb-full .rail-btn .ri { width: 28px; height: 28px; background: none !important; box-shadow: none !important; }
html.cb-full .rail-btn[aria-current="true"] { background: var(--cg-hover); color: var(--text); }
html.cb-full .rail-btn .rl { font-size: 14px; font-weight: 500; }
html.cb-full .hero { text-align: center; display: flex; flex-direction: column; align-items: center; }
html.cb-full .hero > * { margin-left: auto; margin-right: auto; }
html.cb-full #app .composer { border-radius: 26px; background: var(--cg-input); border: 1px solid var(--border); box-shadow: 0 1px 6px rgba(0,0,0,.12); }
/* En pantalla grande hay sitio: el modo minimalista no oculta los nombres del menú */
html.cb-full[data-minimal] .rail .rl { display: inline !important; }

/* Canvas: edita la última respuesta */
.cv { position: fixed; inset: 12px; z-index: 60; display: flex; flex-direction: column; background: var(--bg); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.cv-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.cv-head b { flex: 1; }
.cv-text { flex: 1; resize: none; border: 0; padding: 16px 20px; background: transparent; color: var(--text); font: 15px/1.6 var(--display); outline: none; }
html.cb-full .cv { inset: 24px 10%; }
/* Chat temporal: aviso discreto sobre la caja de texto */
html[data-temp-chat] #chat-form { box-shadow: 0 0 0 1px var(--muted) inset; }
html[data-temp-chat] #chat-form::before { content: "Chat temporal · no se guarda"; position: absolute; top: -20px; left: 14px; font-size: 11px; color: var(--muted); }
html[data-temp-chat] #chat-form { position: relative; }
/* Botón Agente activado: que se lea siempre (otras reglas de la barra lo dejaban gris sobre gris) */
#app .cb-agent-toggle[aria-pressed="true"] { background: var(--text) !important; color: var(--bg) !important; opacity: 1 !important; }
#app .cb-agent-toggle[aria-pressed="true"] * { color: var(--bg) !important; stroke: currentColor; opacity: 1 !important; }

/* ===== Pantalla grande = la app web: marca, nuevo chat, agentes, buscador, chats y herramientas ===== */
html.cb-full .rail { width: 272px; padding: 14px 10px 10px; overflow-y: auto; scrollbar-width: thin; }
.fs-brand, .fs-search, .fs-chats, .fs-tools, .fs-item { display: none; }
html.cb-full .fs-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; font: 600 17px var(--display); color: var(--text); }
html.cb-full .fs-logo { font-size: 22px; line-height: 1; }
html.cb-full .fs-item { display: flex; }
html.cb-full .fs-search { display: block; -webkit-appearance: none; appearance: none; box-sizing: border-box; width: calc(100% - 8px); background-color: transparent !important; color-scheme: dark light; margin: 4px 4px 6px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); background: transparent; color: var(--text); font: 14px var(--display); outline: none; }
html.cb-full .fs-search:focus { border-color: var(--muted); }
html.cb-full .fs-chats { display: flex; flex-direction: column; gap: 1px; margin-bottom: 8px; }
.fs-chat { text-align: left; padding: 8px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--text); font: 14px var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.fs-chat:hover { background: var(--cg-hover); }
.fs-chat.active { background: var(--surface-2); }
.fs-empty { margin: 4px 10px; font-size: 13px; color: var(--muted); }
html.cb-full .fs-tools { display: block; margin-top: 6px; border-top: 1px solid var(--border); padding-top: 6px; }
html.cb-full .fs-tools > summary { cursor: pointer; list-style: none; padding: 8px 10px; font: 600 12px var(--display); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-radius: 8px; }
html.cb-full .fs-tools > summary::after { content: " ▸"; }
html.cb-full .fs-tools[open] > summary::after { content: " ▾"; }
html.cb-full .fs-tools > summary:hover { background: var(--cg-hover); }
html.cb-full .fs-tools .rail-btn { display: flex; }

/* Herramienta elegida: chip dentro de la fila de herramientas (al lado de Agente y del modelo) */
.composer-tools .tool-chip { margin: 0; align-self: center; height: 30px; padding: 0 6px 0 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font: 600 12.5px var(--display); }
.composer-tools .tool-chip button { background: transparent; }

/* ===== Pantalla grande tipo ChatGPT: chat vacío = saludo y caja de texto en el centro ===== */
html.cb-full #app { justify-content: flex-start; }
html.cb-full #app:not(.has-chat) { justify-content: center; }
html.cb-full #app:not(.has-chat) .hero { flex: 0 0 auto; padding-top: 0; margin-bottom: 18px; }
html.cb-full #app:not(.has-chat) .chat { display: none; }
html.cb-full .feature-agent, html.cb-full #cloud-bubble, html.cb-full .hero .cards > .feature-card { display: none !important; }
html.cb-full .hero-mascot { width: 72px; height: 60px; margin: 0 auto 6px; }
html.cb-full #app .hero-hello, html.cb-full #app .hero-hello * { font-size: 30px; font-weight: 500; }
html.cb-full .hero .quick-row { justify-content: center; margin-top: 14px; order: 9; }
html.cb-full #app .composer { min-height: 104px; }
html.cb-full .panel-foot { opacity: .75; }
/* Pantalla grande: estado del agente centrado como el chat, sin cabecera repetida ni scroll horizontal */
html.cb-full #agent-status, html.cb-full .status, html.cb-full .cb-agent-dock { width: calc(100% - 40px); max-width: 780px; margin-left: auto; margin-right: auto; box-sizing: border-box; border-radius: 12px; }
html.cb-full .rail { overflow-x: hidden; }
html.cb-full #app > .head { display: none; }
/* Barra estrecha: el modelo solo con su icono para que no se corte ni apriete los botones */
@media (max-width: 480px) { html:not(.cb-full) .composer-tools .model-btn { padding: 0 8px; } }
/* Pantalla grande: el menú de modelos se abre encima del botón, con ancho fijo (no a lo ancho de la pantalla) */
html.cb-full #model-menu { position: fixed; right: auto; width: 340px; bottom: auto; }
/* Canvas en pantalla grande: sobre el área del chat, no encima de la barra lateral */
html.cb-full .cv { inset: 24px 24px 24px 296px; }


/* Cuadro de texto: un solo recuadro (el del compositor), sin borde interior */
#app .composer textarea, #app #user-input { border: 0 !important; outline: none !important; box-shadow: none !important; background: transparent !important; }
:root[data-theme="light"] .feature-card p, :root[data-theme="light"] .feature-card small { color: #5d5d5d !important; opacity: 1 !important; }

/* ===== Respuestas con formato (ui/markdown.js), estilo ChatGPT ===== */
.bubble .md-p { margin: 0 0 .75em; }
.bubble .md-p:last-child { margin-bottom: 0; }
.bubble .md-h { margin: 1.1em 0 .45em; font: 600 1.08em/1.3 var(--display); color: var(--text); }
.bubble h3.md-h { font-size: 1.18em; }
.bubble .md-h:first-child { margin-top: 0; }
.bubble .md-list { margin: 0 0 .75em; padding-left: 1.4em; }
.bubble .md-list li { margin: .25em 0; }
.bubble .md-quote { margin: 0 0 .75em; padding: .4em .9em; border-left: 3px solid var(--border); color: var(--muted); }
.bubble .md-hr { border: 0; border-top: 1px solid var(--border); margin: 1em 0; }
.bubble .md-code { padding: .1em .35em; border-radius: 6px; background: var(--surface-2); font: .9em ui-monospace, Consolas, monospace; }
.bubble a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
.bubble .md-table-wrap { overflow-x: auto; margin: 0 0 .9em; border: 1px solid var(--border); border-radius: 10px; }
.bubble .md-table { border-collapse: collapse; width: 100%; font-size: .95em; }
.bubble .md-table th, .bubble .md-table td { padding: .5em .8em; text-align: left; border-bottom: 1px solid var(--border); }
.bubble .md-table th { font-weight: 600; background: var(--surface-2); }
.bubble .md-table tr:last-child td { border-bottom: 0; }
.bubble pre { margin: 0 0 .9em; padding: 12px 14px; border-radius: 10px; background: var(--cg-code); border: 1px solid var(--border); overflow-x: auto; font: 13px/1.5 ui-monospace, Consolas, monospace; }
/* Pantalla grande: panel de Agentes centrado como el chat */
html.cb-full #agents-view > * { max-width: 780px; margin-left: auto; margin-right: auto; }
html.cb-full #agents-view { padding-top: 32px; }

/* ===== Pantalla grande: pie de cuenta tipo ChatGPT (sidepanel.js › buildFullSidebar) ===== */
.cb-acct-wrap { display: none; }
html.cb-full .cb-acct-wrap { display: block; position: sticky; bottom: 0; margin-top: auto; padding-top: 8px; background: var(--surface); border-top: 1px solid var(--border); }
html.cb-full .rail .cb-full-btn, html.cb-full .rail #toggle-settings, html.cb-full .rail #rail-avatar, html.cb-full .rail > .spacer { display: none !important; }
.cb-acct { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--text); cursor: pointer; text-align: left; font: inherit; }
.cb-acct:hover, .cb-acct[aria-expanded="true"] { background: var(--cg-hover); }
.cb-acct-av { flex: none; width: 32px; height: 32px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; font: 600 14px var(--display); color: #fff; background: linear-gradient(135deg, #8b5cf6, #3b82f6); }
.cb-acct-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.cb-acct-info b { font: 600 14px var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-acct-info small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-acct > svg { flex: none; color: var(--muted); }
.cb-acct-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); padding: 6px; background: var(--cg-menu); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, .35); z-index: 50; }
.cb-acct-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 9px; background: none; color: var(--text); font: 14px var(--display); cursor: pointer; text-align: left; }
.cb-acct-menu button:hover { background: var(--cg-hover); }
.cb-acct-menu button svg { color: var(--muted); }
html.cb-full .rail { display: flex; flex-direction: column; }

/* Tiempo bajo la nube */
.wx-chip { display: inline-flex; align-items: center; gap: 4px; margin: 2px auto 6px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: 12px var(--display); white-space: nowrap; }
.hero-top { flex-wrap: wrap; }
html:not(.cb-full) .wx-chip { margin-left: 0; }
.wx-chip[hidden] { display: none !important; }
/* Tema claro: estos fondos/colores estaban fijos en oscuro */
:root[data-theme="light"] .ag-row textarea { background: var(--surface-2); border-color: var(--border); }
:root[data-theme="light"] .ag-card { background: var(--surface); }
:root[data-theme="light"] .drawer-tab:not([aria-selected="true"]) { color: var(--muted); }
.cb-x { width: 32px; height: 32px; }
