/* Pito — parodia de una aplicación de chat con IA. Sin backend. */

:root {
    --bg: #0f1013;
    --side: #0b0c0e;
    --panel: #17191e;
    --panel-2: #1e2127;
    --bubble: #262a31;
    --line: #2a2e36;
    --text: #e9eaed;
    --text-2: #c3c7cf;
    --muted: #8f95a1;
    --accent: #ff6b35;
    --accent-ink: #ff966e;
    --accent-soft: rgba(255, 107, 53, .1);
    --ok: #4cc38a;
    --warn: #f5a524;
    --code-bg: #0b0c0f;
    --shadow: 0 18px 50px rgba(0, 0, 0, .45);
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, Menlo, monospace;
    color-scheme: dark;
}
:root[data-theme="light"] {
    --bg: #fdfcf9;
    --side: #f4f2ec;
    --panel: #f8f6f1;
    --panel-2: #eeebe4;
    --bubble: #eef0f4;
    --line: #e3dfd6;
    --text: #16181d;
    --text-2: #3b4048;
    --muted: #6b7280;
    --accent: #c44216;
    --accent-ink: #ac3610;
    --accent-soft: rgba(196, 66, 22, .07);
    --code-bg: #f6f7f9;
    --shadow: 0 18px 50px rgba(20, 24, 32, .16);
    color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Estructura ---------- */
.app { display: grid; grid-template-columns: 264px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.side { display: flex; flex-direction: column; min-height: 0; background: var(--side); border-right: 1px solid var(--line); }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

/* ---------- Lateral ---------- */
.side_top { display: flex; align-items: center; gap: 8px; padding: 12px; }
.brand { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; padding: 2px 8px; border-radius: 8px; color: var(--text); font-size: 20px; letter-spacing: -.04em; font-weight: 750; text-decoration: none; }
.brand_mark { display: grid; place-items: center; flex: 0 0 auto; width: 40px; height: 40px; }
.brand_mark img, .welcome_mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); }
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.new-chat { display: flex; align-items: center; gap: 10px; margin: 0 12px 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--text); font-weight: 600; text-align: left; }
.new-chat:hover { background: var(--accent-soft); border-color: var(--accent); }
.new-chat kbd { margin-left: auto; }
kbd { padding: 1px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); color: var(--muted); font: 11px/1.6 var(--mono); }
.history { flex: 1 1 auto; overflow-y: auto; padding: 4px 8px 12px; }
.history_group { margin: 14px 8px 4px; color: var(--muted); font-size: 12px; font-weight: 600; }
.history_empty { margin: 14px 8px; color: var(--muted); font-size: 13px; }
.conv { position: relative; display: flex; align-items: center; border-radius: 8px; }
.conv:hover, .conv.is-active { background: var(--panel); }
.conv.is-active { box-shadow: inset 2px 0 var(--accent); }
.conv_open { flex: 1 1 auto; min-width: 0; padding: 8px 10px; border: 0; background: transparent; color: var(--text-2); font-size: 14px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv.is-active .conv_open { color: var(--text); }
.conv_tools { display: none; gap: 2px; padding-right: 4px; }
.conv:hover .conv_tools, .conv:focus-within .conv_tools, .conv.is-active .conv_tools { display: flex; }
.conv_tools .icon-btn { width: 28px; height: 28px; }
.conv_tools .icon-btn svg { width: 15px; height: 15px; }
.conv_rename { flex: 1 1 auto; margin: 3px 6px; padding: 5px 8px; border: 1px solid var(--accent); border-radius: 6px; background: var(--bg); font-size: 14px; }

.account { position: relative; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.account_btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 10px; background: transparent; text-align: left; }
.account_btn:hover { background: var(--panel); }
.avatar { display: grid; place-items: center; flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; background: var(--panel-2); color: var(--text); font-size: 13px; font-weight: 700; }
.account_btn strong { display: block; font-size: 14px; }
.account_btn small { display: block; color: var(--muted); font-size: 12px; }
.usage { margin: 6px 8px 0; }
.usage_row { display: flex; justify-content: space-between; color: var(--muted); font-size: 11.5px; }
.usage_bar { height: 4px; margin-top: 4px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.usage_bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width .4s ease; }

/* ---------- Menús emergentes ---------- */
.menu { position: absolute; z-index: 40; min-width: 240px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); }
.menu_item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font-size: 14px; text-align: left; }
.menu_item:hover:not(:disabled), .menu_item:focus-visible { background: var(--panel-2); outline: none; }
.menu_item:disabled { cursor: not-allowed; opacity: .55; }
.menu_item.is-current { background: var(--panel-2); }
.menu_sep { height: 1px; margin: 6px 4px; background: var(--line); }
.account .menu { bottom: 70px; left: 12px; right: 12px; }
.model-menu { top: 50px; left: 12px; width: min(340px, calc(100vw - 24px)); }
.model_item { align-items: flex-start; }
.model_item b { display: block; font-size: 14px; }
.model_item small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.model_item .check { margin-left: auto; color: var(--accent-ink); }
.badge { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 99px; background: var(--panel-2); color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .02em; vertical-align: 1px; }
.badge.is-new { background: rgba(76, 195, 138, .15); color: var(--ok); }
.badge.is-busy { background: rgba(245, 165, 36, .15); color: var(--warn); }
.badge.is-pro { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- Barra superior ---------- */
.top { position: relative; display: flex; align-items: center; gap: 6px; height: 56px; padding: 0 12px; border-bottom: 1px solid transparent; }
.top.is-scrolled { border-bottom-color: var(--line); }
.top_menu { display: none; }
.model-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--text); font-size: 16px; font-weight: 700; }
.model-btn:hover { background: var(--panel); }
.model-btn span { color: var(--muted); font-weight: 600; }
.top_spacer { flex: 1 1 auto; }
.top_btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 99px; background: transparent; color: var(--text); font-size: 13.5px; font-weight: 600; }
.top_btn:hover:not(:disabled) { background: var(--panel); }
.top_btn:disabled { opacity: .45; cursor: not-allowed; }
.top_btn svg { width: 16px; height: 16px; }

/* ---------- Conversación ---------- */
.thread { position: relative; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; }
.thread_inner { max-width: 780px; margin: 0 auto; padding: 18px 20px 28px; }
.banner { position: sticky; top: 8px; z-index: 5; display: flex; align-items: center; justify-content: center; gap: 8px; width: max-content; max-width: 100%; margin: 0 auto 10px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 99px; background: var(--panel); box-shadow: var(--shadow); color: var(--text-2); font-size: 13px; }
.spinner { width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.welcome { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: calc(100% - 20px); padding: 20px 20px 10px; text-align: center; }
.welcome_mark { display: block; flex: 0 0 auto; width: 128px; height: 128px; margin-bottom: 18px; }
.welcome h1 { margin: 0 0 10px; font-size: clamp(26px, 3vw, 36px); line-height: 1.2; font-weight: 700; letter-spacing: -.035em; text-wrap: balance; }
.welcome p { max-width: 430px; margin: 0 0 28px; color: var(--muted); }
.suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: min(640px, 100%); }
.suggestion { padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); text-align: left; transition: background .15s ease, border-color .15s ease; }
.suggestion:hover { background: var(--accent-soft); border-color: var(--accent); }
.suggestion b { display: block; font-size: 14px; }
.suggestion span { display: block; color: var(--muted); font-size: 13px; }

.msg { margin: 0 0 26px; animation: rise .22s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg-user { display: flex; flex-direction: column; align-items: flex-end; }
.msg-user .bubble { max-width: 78%; padding: 10px 16px; border-radius: 20px; background: var(--bubble); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-user img { display: block; max-width: min(280px, 78%); margin-bottom: 8px; border-radius: 14px; }
.msg-bot { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 14px; }
.msg-bot .brand_mark { width: 34px; height: 34px; }
.bot_body { min-width: 0; }
.bot_meta { margin-top: 8px; color: var(--muted); font-size: 12px; }
.stopped { display: inline-block; margin-top: 6px; color: var(--muted); font-size: 12.5px; font-style: italic; }

/* Pensando / herramientas */
.fold { margin: 0 0 12px; }
.fold > summary { display: inline-flex; align-items: center; gap: 8px; padding: 4px 0; color: var(--muted); font-size: 13.5px; list-style: none; cursor: pointer; user-select: none; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: "›"; display: inline-block; transition: transform .15s ease; font-size: 16px; line-height: 1; }
.fold[open] > summary::after { transform: rotate(90deg); }
.fold > summary:hover { color: var(--text-2); }
.fold.is-live > summary { color: var(--text-2); }
.shimmer { background: linear-gradient(90deg, var(--muted) 0%, var(--text) 50%, var(--muted) 100%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.fold_body { margin: 6px 0 4px; padding: 2px 0 2px 14px; border-left: 2px solid var(--line); color: var(--muted); font-size: 14px; line-height: 1.6; }
.fold_body p { margin: 0 0 8px; }
.tool { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.tool_kind { flex: 0 0 auto; min-width: 46px; padding: 1px 6px; border-radius: 5px; background: var(--panel-2); color: var(--text-2); font: 10.5px/1.7 var(--mono); text-align: center; }
.tool code { color: var(--text-2); font: 12.5px var(--mono); }
.tool span { color: var(--muted); font-size: 13px; }
.tool_state { margin-left: auto; color: var(--ok); font-size: 12px; }
.tool_state.is-run { color: var(--warn); }

/* Markdown */
.md { color: var(--text); overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md p { margin: 0 0 12px; }
.md h2 { margin: 18px 0 8px; font-size: 20px; letter-spacing: -.01em; }
.md h3 { margin: 16px 0 6px; font-size: 17px; }
.md ul, .md ol { margin: 0 0 12px; padding-left: 24px; }
.md li { margin: 3px 0; }
.md blockquote { margin: 0 0 12px; padding: 8px 14px; border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; background: var(--panel); color: var(--text-2); }
.md hr { margin: 16px 0; border: 0; border-top: 1px solid var(--line); }
.md code { padding: 1px 6px; border-radius: 5px; background: var(--panel-2); font: 13px var(--mono); }
.md sup { color: var(--accent-ink); font-size: 11px; font-weight: 700; }
.md table { width: 100%; margin: 0 0 12px; border-collapse: collapse; font-size: 14px; }
.md th, .md td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.md th { color: var(--text-2); font-weight: 700; }
.table-wrap { overflow-x: auto; }
.codeblock { margin: 0 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--code-bg); overflow: hidden; }
.codeblock_head { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px 6px 14px; border-bottom: 1px solid var(--line); background: var(--panel); color: var(--muted); font: 12px var(--mono); }
.codeblock_copy { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font: 12px var(--sans); }
.codeblock_copy:hover { background: var(--panel-2); color: var(--text); }
.codeblock pre { margin: 0; padding: 14px 16px; overflow-x: auto; font: 13px/1.6 var(--mono); tab-size: 4; }
.codeblock_label { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.codeblock_file { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.codeblock_lang { padding: 0 6px; border: 1px solid var(--line); border-radius: 4px; font-size: 11px; }
.codeblock.is-terminal pre { background: #07080a; color: #c8ccd4; }
.tk-add { color: #98c379; } .tk-del { color: #e06c75; }
:root[data-theme="light"] .tk-add { color: #2f8a3e; } :root[data-theme="light"] .tk-del { color: #c0392b; }
:root[data-theme="light"] .codeblock.is-terminal pre .tk-add { color: #98c379; } :root[data-theme="light"] .codeblock.is-terminal pre .tk-del { color: #e06c75; }
.codeblock pre code { padding: 0; background: none; font: inherit; }
.tk-k { color: #c678dd; } .tk-s { color: #98c379; } .tk-c { color: #7f848e; font-style: italic; } .tk-n { color: #d19a66; } .tk-f { color: #61afef; }
:root[data-theme="light"] .tk-k { color: #a626a4; } :root[data-theme="light"] .tk-s { color: #50a14f; } :root[data-theme="light"] .tk-n { color: #986801; } :root[data-theme="light"] .tk-f { color: #4078f2; }
.caret { display: inline-block; width: 8px; height: 1.05em; margin-left: 2px; border-radius: 1px; background: var(--text); vertical-align: -2px; animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }

/* Visión sobre imagen */
.vision { position: relative; width: min(460px, 100%); margin: 4px 0 14px; border-radius: 12px; overflow: hidden; }
.vision img { display: block; width: 100%; }
.vision_box { position: absolute; border: 2px solid var(--accent); border-radius: 4px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); opacity: 0; animation: pop .35s ease forwards; }
.vision_box span { position: absolute; top: -1px; left: -2px; transform: translateY(-100%); padding: 1px 6px; border-radius: 4px 4px 4px 0; background: var(--accent); color: #fff; font: 700 11px/1.5 var(--mono); white-space: nowrap; }
@keyframes pop { from { opacity: 0; transform: scale(1.08); } to { opacity: 1; transform: none; } }

/* Memoria y errores */
.chip { display: inline-flex; align-items: center; gap: 7px; margin-top: 4px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-size: 12.5px; }
.chip button { padding: 0; border: 0; background: none; color: var(--accent-ink); font-size: 12.5px; font-weight: 600; }
.error-box { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 14px; border: 1px solid rgba(239, 50, 97, .45); border-radius: 12px; background: rgba(239, 50, 97, .08); color: var(--text-2); font-size: 14px; }
.error-box button { padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font-weight: 600; }

.to-bottom { position: absolute; left: 50%; bottom: 150px; z-index: 6; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 99px; background: var(--panel); box-shadow: var(--shadow); color: var(--text); font-size: 13px; font-weight: 600; }

/* ---------- Compositor ---------- */
.composer-wrap { padding: 0 20px 10px; }
.composer { max-width: 780px; margin: 0 auto; padding: 10px 10px 8px 12px; border: 1px solid var(--line); border-radius: 26px; background: var(--panel); box-shadow: 0 6px 24px rgba(0, 0, 0, .12); }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer.is-shaking { animation: shake .24s ease; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.attach-preview { display: flex; align-items: center; gap: 10px; margin: 2px 4px 8px; }
.attach-preview img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; }
.attach-preview span { color: var(--muted); font-size: 13px; }
.composer textarea { display: block; width: 100%; min-height: 44px; max-height: 220px; padding: 6px 6px 2px; border: 0; background: transparent; resize: none; outline: none; line-height: 1.5; }
.composer_tools { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.composer_spacer { flex: 1 1 auto; }

/* Esfuerzo: deslizador de 4 niveles siempre visible */
.effort { --effort: var(--muted); --fill: 33.33%; display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 10px; border: 1px solid var(--line); border-radius: 99px; color: var(--text-2); font-size: 13px; transition: border-color .2s ease, box-shadow .2s ease; }
.effort.is-low { --effort: var(--muted); }
.effort.is-medium { --effort: var(--text); }
.effort.is-high { --effort: var(--accent-ink); }
.effort.is-max { --effort: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft), 0 0 18px var(--accent-soft); }
.effort.is-disabled { opacity: .45; }
.effort.is-hint { animation: effort-hint 1.8s ease-in-out 4; }
@keyframes effort-hint { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 50% { box-shadow: 0 0 0 5px var(--accent-soft); } }
.effort_icon { width: 15px; height: 15px; color: var(--effort); }
.effort label { color: var(--muted); cursor: pointer; }
.effort output { min-width: 52px; color: var(--effort); font-weight: 700; }
.effort input[type="range"] { -webkit-appearance: none; appearance: none; width: 96px; height: 6px; margin: 0; border-radius: 99px; outline: none; cursor: pointer;
    background: linear-gradient(to right, var(--effort) 0, var(--effort) var(--fill), var(--panel-2) var(--fill), var(--panel-2) 100%); }
.effort input[type="range"]:disabled { cursor: not-allowed; }
.effort input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border: 2px solid var(--effort); border-radius: 50%; background: var(--bg); transition: transform .15s ease; }
.effort input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border: 2px solid var(--effort); border-radius: 50%; background: var(--bg); }
.effort input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.15); }
.effort input[type="range"]:focus-visible { box-shadow: 0 0 0 3px var(--accent-soft); }
.composer textarea::placeholder { color: var(--muted); }
.attach { position: relative; flex: 0 0 auto; }
.attach input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.send { display: grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: var(--text); color: var(--bg); transition: opacity .15s ease; }
.send:disabled { opacity: .3; cursor: not-allowed; }
.send:not(:disabled):not(.is-stop) { background: var(--accent); color: var(--bg); }
.send svg { width: 18px; height: 18px; }
.send.is-stop svg { width: 14px; height: 14px; }
.disclaimer { max-width: 780px; margin: 8px auto 0; color: var(--muted); font-size: 12px; text-align: center; }
.plan-note { display: flex; align-items: center; justify-content: center; gap: 8px; max-width: 780px; margin: 0 auto 8px; color: var(--muted); font-size: 13px; }
.plan-note button { padding: 0; border: 0; background: none; color: var(--accent-ink); font-weight: 600; }

/* ---------- Modales ---------- */
dialog.modal { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 40px); padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
dialog.modal.is-wide { width: min(760px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(5, 6, 9, .6); backdrop-filter: blur(2px); }
.modal_head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.modal_head h2 { flex: 1 1 auto; margin: 0; font-size: 18px; }
.modal_body { padding: 16px 18px 20px; overflow-y: auto; max-height: calc(100dvh - 140px); }
.modal_body p { margin: 0 0 12px; color: var(--text-2); }
.modal_body h3 { margin: 18px 0 8px; font-size: 15px; }
.modal_body ul { margin: 0 0 12px; padding-left: 20px; color: var(--text-2); }
.modal_foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--line); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 16px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--text); font-weight: 600; text-decoration: none; }
.btn:hover { background: var(--panel-2); }
.btn.is-primary { border-color: var(--text); background: var(--text); color: var(--bg); }
.btn.is-primary:hover { opacity: .9; }
.btn.is-danger { border-color: rgba(239, 50, 97, .5); color: var(--accent-ink); }

.settings { display: grid; grid-template-columns: 170px minmax(0, 1fr); min-height: 360px; }
.settings_tabs { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-right: 1px solid var(--line); }
.settings_tab { padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); text-align: left; font-size: 14px; }
.settings_tab[aria-selected="true"] { background: var(--panel-2); color: var(--text); font-weight: 600; }
.settings_panel { padding: 16px 18px; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.field:last-child { border-bottom: 0; }
.field label, .field > span { font-size: 14px; }
.field small { display: block; color: var(--muted); font-size: 12.5px; }
.field select { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.field-col { display: block; }
.field-col textarea { width: 100%; min-height: 110px; margin-top: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); resize: vertical; }
.switch { position: relative; flex: 0 0 auto; width: 40px; height: 22px; border: 0; border-radius: 99px; background: var(--panel-2); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .15s ease, background .15s ease; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(18px); background: #fff; }
.memory-list { margin: 10px 0 0; padding: 0; list-style: none; }
.memory-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; color: var(--text-2); font-size: 14px; }
.saved-note { color: var(--ok); font-size: 12.5px; }

.release_tag { display: inline-block; margin-bottom: 10px; padding: 3px 9px; border-radius: 99px; background: rgba(76, 195, 138, .15); color: var(--ok); font-size: 12px; font-weight: 700; }
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 6px 0 16px; }
.plan { display: flex; flex-direction: column; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.plan.is-current { border-color: var(--text-2); }
.plan h3 { margin: 0 0 2px; font-size: 16px; }
.plan strong { font-size: 22px; }
.plan strong small { color: var(--muted); font-size: 13px; font-weight: 500; }
.plan ul { flex: 1 1 auto; margin: 10px 0 12px; padding-left: 18px; font-size: 13.5px; }
.plan .btn { width: 100%; }
.plan .btn:disabled { opacity: .5; cursor: not-allowed; }
.cta-real { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 14px 16px; border-radius: 14px; background: var(--bg); border: 1px dashed var(--accent); }
.cta-real p { margin: 0; color: var(--text); font-weight: 600; }
.shortcuts { display: grid; grid-template-columns: 1fr auto; gap: 10px 20px; margin: 0; }
.shortcuts dt { color: var(--text-2); }
.shortcuts dd { margin: 0; text-align: right; }
.share-preview { display: block; width: 100%; max-height: 52vh; object-fit: contain; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }

/* ---------- Avisos ---------- */
/* Arriba, para no tapar el cuadro de texto ni el deslizador de esfuerzo. */
.toasts { position: fixed; left: 50%; top: 66px; z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; transform: translateX(-50%); pointer-events: none; }
.toast { padding: 10px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); color: var(--text); font-size: 14px; animation: rise .2s ease both; }

/* ---------- Móvil ---------- */
.scrim { display: none; }
@media (max-width: 860px) {
    .app { grid-template-columns: minmax(0, 1fr); }
    .side { position: fixed; inset: 0 auto 0 0; z-index: 50; width: min(300px, 86vw); transform: translateX(-100%); transition: transform .22s ease; }
    .app.is-drawer .side { transform: none; box-shadow: var(--shadow); }
    .app.is-drawer .scrim { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(0, 0, 0, .5); }
    .top_menu { display: inline-grid; }
    .new-chat kbd { display: none; }
    .effort label { display: none; }
    .effort input[type="range"] { width: 76px; }
    .effort output { min-width: 46px; }
    .top_btn .label { display: none; }
    .top_btn { padding: 0 10px; }
    .suggestions { grid-template-columns: minmax(0, 1fr); }
    .suggestion:nth-child(n+3) { display: none; }
    .welcome h1 { font-size: 24px; }
    .welcome { padding: 12px 2px; }
    .welcome_mark { width: 88px; height: 88px; margin-bottom: 12px; }
    .welcome p { margin-bottom: 18px; font-size: 14px; }
    .thread_inner { padding: 12px 14px 20px; }
    .composer-wrap { padding: 0 10px calc(8px + env(safe-area-inset-bottom)); }
    .msg-bot { grid-template-columns: minmax(0, 1fr); gap: 6px; }
    .msg-bot > .brand_mark { display: none; }
    .msg-user .bubble { max-width: 88%; }
    .settings { grid-template-columns: minmax(0, 1fr); }
    .settings_tabs { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
    .plans { grid-template-columns: minmax(0, 1fr); }
    .to-bottom { bottom: 130px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
    .caret { animation: none; }
}

/* ---------------------------------------------------------------- agentes (Pito Ultra code, 2026-09-24) */
.agents { margin: 0 0 14px; }
.agents_head { margin-bottom: 8px; color: var(--muted); font-size: 13.5px; }
.agents_grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-top: 6px; }
.agent { min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); font-size: 12.5px; animation: rise .25s ease both; }
.agent_head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.agent_head strong { color: var(--text); font-size: 13px; }
.agent_head small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.agent_state { margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
.agent.is-work .agent_state { color: var(--warn); }
.agent.is-done .agent_state { color: var(--ok); }
.agent_bar { height: 3px; margin: 7px 0 6px; overflow: hidden; border-radius: 3px; background: var(--line); }
.agent_bar span { display: block; width: 0; height: 100%; background: var(--accent); transition: width .4s ease; }
.agent.is-done .agent_bar span { background: var(--ok); }
.agent_log { min-height: 1.5em; color: var(--muted); font: 11.5px/1.55 var(--mono); }
.agent_log div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; animation: rise .2s ease both; }
.agent_log .is-code { color: var(--accent-ink); }
.agent_subs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.agent_subs:empty { display: none; }
.agent_sub { padding: 2px 7px; border: 1px dashed var(--line); border-radius: 7px; color: var(--text-2); font: 11px var(--mono); }
.agent_sub em { color: var(--warn); font-style: normal; }
.agent_sub.is-done::after { content: " ✓"; color: var(--ok); }
.agent_meta { margin-top: 5px; color: var(--muted); font-size: 11px; }
.agent_meta:empty { display: none; }
@media (prefers-reduced-motion: reduce) { .agent, .agent_log div { animation: none; } .agent_bar span { transition: none; } }
