:root {
  --bg: #ffffff;
  --bg-2: #f4f6f9;
  --bg-3: #e9edf3;
  --side: #f7f8fb;
  --text: #142033;
  --muted: #657084;
  --border: #e1e6ee;
  --accent: #4438cf;
  --accent-2: #3529b7;
  --danger: #dc2626;
  --ok: #16a34a;
  --user-bubble: #eef2ff;
  --code-bg: #0d1117;
  --shadow: 0 10px 30px rgba(0,0,0,.12);
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1e1f22; --bg-2: #26272b; --bg-3: #313338; --side: #18191c; --text: #e6e6e6; --muted: #9aa0a6;
    --border: #34363c; --accent: #8b82ff; --accent-2: #a49dff; --user-bubble: #2b2f3a; --shadow: 0 10px 30px rgba(0,0,0,.5);
  }
}
:root[data-theme="dark"] {
  --bg: #1e1f22; --bg-2: #26272b; --bg-3: #313338; --side: #18191c; --text: #e6e6e6; --muted: #9aa0a6;
  --border: #34363c; --accent: #8b82ff; --accent-2: #a49dff; --user-bubble: #2b2f3a; --shadow: 0 10px 30px rgba(0,0,0,.5);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* ---------- botones / formularios ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--bg); padding: 7px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--bg-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--bg-3); }
.btn.sm { padding: 4px 8px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { border: 0; background: transparent; cursor: pointer; padding: 4px 6px; border-radius: 6px; color: var(--muted); line-height: 1; }
.icon-btn:hover { background: var(--bg-3); color: var(--text); }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
label.f small { color: var(--muted); font-size: 12px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=url], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
label.check { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; cursor: pointer; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--bg-2); }
.auth-card { width: 100%; max-width: 380px; background: var(--bg); border: 1px solid var(--border); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); }
.auth-card h1 { margin: 0 0 4px; font-size: 22px; }
.auth-card p { margin: 0 0 20px; color: var(--muted); }
.auth-card .btn { width: 100%; justify-content: center; padding: 10px; }

/* ---------- layout ---------- */
.layout { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 272px; flex-shrink: 0; background: var(--side); border-right: 1px solid var(--border); display: flex; flex-direction: column; transition: margin-left .2s ease; }
.layout.side-collapsed .sidebar { margin-left: -273px; }
.tool-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border: 0; background: transparent; color: var(--muted); border-radius: 8px; cursor: pointer; flex-shrink: 0; }
.tool-btn:hover { background: var(--bg-3); color: var(--text); }
.side-brand { display: flex; align-items: center; justify-content: space-between; padding: 10px 8px 6px 16px; font-weight: 600; font-size: 15px; }
.side-actions { padding: 2px 8px 10px; display: flex; flex-direction: column; gap: 1px; }
.side-action { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; color: var(--text); text-align: left; font-size: 14px; }
.side-action svg { color: var(--muted); flex-shrink: 0; }
.side-action:hover { background: var(--bg-3); }
.side-search { cursor: text; }
.side-search input { border: 0 !important; box-shadow: none !important; background: transparent; padding: 0; width: 100%; }
.side-section { margin: 0 16px; padding: 12px 0 4px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--muted); }
.side-list { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
.side-bottom { border-top: 1px solid var(--border); padding: 8px; display: flex; align-items: center; gap: 4px; }
.side-user-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; text-align: left; color: var(--text); }
.side-user-btn:hover { background: var(--bg-3); }
.side-user-btn > svg { color: var(--muted); flex-shrink: 0; transform: rotate(180deg); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: #d9467a; color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; flex-shrink: 0; }
.side-user { flex: 1; min-width: 0; line-height: 1.25; }
.side-user b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user small { color: var(--muted); font-size: 12px; }

.group { margin-top: 10px; border-radius: 8px; }
.group-head { display: flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 6px; cursor: pointer; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; user-select: none; min-height: 28px; }
.group-head:hover { color: var(--text); }
.group-head .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-head .caret { display: inline-grid; transition: transform .15s; }
.group.collapsed .caret { transform: rotate(-90deg); }
.group-head .grow { flex: 1; }
.group.collapsed .group-items { display: none; }
.group-head .icon-btn { visibility: hidden; display: grid; place-items: center; }
.group-head:hover .icon-btn { visibility: visible; }
.group.drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; background: color-mix(in srgb, var(--accent) 8%, transparent); }
.group-items { min-height: 4px; }
.empty-group { font-size: 12.5px; color: var(--muted); padding: 4px 10px; }

.conv { display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 10px; border-radius: 8px; cursor: pointer; color: var(--text); font-size: 14px; }
.conv:hover { background: var(--bg-3); }
.conv.active { background: var(--bg-3); }
.conv .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .icon-btn { visibility: hidden; display: grid; place-items: center; }
.conv:hover .icon-btn, .conv.active .icon-btn { visibility: visible; }
.conv.dragging { opacity: .4; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.topbar { height: 52px; display: flex; align-items: center; gap: 6px; padding: 0 12px; }
.topbar .title { flex: 1; min-width: 0; font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-toggle { display: none; }
.layout.side-collapsed .menu-toggle { display: inline-grid; }

.messages { flex: 1; overflow-y: auto; }
.messages-inner { max-width: 820px; margin: 0 auto; padding: 24px 20px 40px; }
.welcome { text-align: center; color: var(--muted); padding-top: 22vh; }
.welcome h2 { color: var(--text); font-size: 28px; font-weight: 500; margin: 0 0 6px; }
.msg { margin-bottom: 22px; display: flex; flex-direction: column; }
.msg.user { align-items: flex-end; }
.msg.user .bubble { background: var(--bg-3); padding: 10px 14px; border-radius: 16px; max-width: 85%; white-space: pre-wrap; word-wrap: break-word; }
.msg.assistant .bubble { width: 100%; word-wrap: break-word; }
.msg .meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
.msg .actions { display: flex; gap: 2px; margin-top: 4px; opacity: 0; transition: opacity .15s; }
.msg:hover .actions { opacity: 1; }
.msg.error .bubble { color: var(--danger); border: 1px solid var(--danger); padding: 10px 14px; border-radius: 10px; }
.reasoning { font-size: 13px; color: var(--muted); border-left: 3px solid var(--border); padding: 4px 10px; margin-bottom: 8px; white-space: pre-wrap; max-height: 220px; overflow: auto; }
details.think summary { cursor: pointer; color: var(--muted); font-size: 12.5px; margin-bottom: 4px; }
.md p { margin: 0 0 .8em; }
.md p:last-child { margin-bottom: 0; }
.md pre { background: var(--code-bg); color: #e6edf3; padding: 0; border-radius: 8px; overflow: hidden; margin: .8em 0; }
.md pre .code-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 10px; font-size: 12px; background: #161b22; color: #9aa0a6; }
.md pre .code-head button { background: transparent; border: 0; color: #9aa0a6; cursor: pointer; font-size: 12px; }
.md pre code { display: block; padding: 12px 14px; overflow-x: auto; font-size: 13px; background: transparent !important; }
.md code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.md :not(pre) > code { background: var(--bg-3); padding: 1px 5px; border-radius: 4px; font-size: 90%; }
.md table { border-collapse: collapse; margin: .8em 0; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 10px; }
.md th { background: var(--bg-2); }
.md blockquote { border-left: 3px solid var(--border); margin: .8em 0; padding: 0 12px; color: var(--muted); }
.md ul, .md ol { padding-left: 1.5em; }
.cursor::after { content: "▍"; animation: blink 1s steps(2) infinite; color: var(--muted); }
@keyframes blink { 50% { opacity: 0; } }

.composer-wrap { padding: 8px 20px 14px; }
.composer { max-width: 780px; margin: 0 auto; border: 1px solid var(--border); border-radius: 18px; background: var(--bg); display: flex; flex-direction: column; gap: 8px; padding: 8px 10px 8px 8px; box-shadow: 0 1px 6px rgba(0,0,0,.05); }
.composer-row { display: flex; align-items: flex-end; gap: 6px; }
.attach-btn { width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.attach-btn:hover { background: var(--bg-3); color: var(--text); }
.composer:focus-within { border-color: color-mix(in srgb, var(--text) 25%, var(--border)); }
.composer textarea { border: 0; box-shadow: none !important; resize: none; padding: 6px 0; max-height: 240px; min-height: 24px; background: transparent; }
.send-btn { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--text); color: var(--bg); display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.send-btn:hover { opacity: .85; }
.send-btn.stop { background: var(--danger); color: #fff; }
.composer-meta { max-width: 780px; margin: 6px auto 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 0 6px; }
.hint { color: var(--muted); font-size: 11.5px; }
.meta-right { display: inline-flex; align-items: center; gap: 6px; }
.ctx-meter { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; padding: 3px 7px; border-radius: 6px; cursor: default; white-space: nowrap; }
.ctx-meter:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.ctx-meter circle { fill: none; stroke-width: 2.4; }
.ctx-meter .trk { stroke: color-mix(in srgb, var(--text) 14%, transparent); }
.ctx-meter .val { stroke: var(--accent); stroke-linecap: round; transition: stroke-dasharray .4s ease; }
.ctx-meter.warn { color: #b45309; } .ctx-meter.warn .val { stroke: #f59e0b; }
.ctx-meter.full { color: var(--danger); } .ctx-meter.full .val { stroke: var(--danger); }
.ctx-tag { font-style: normal; font-size: 10.5px; padding: 1px 6px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.model-btn { display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; color: var(--text); font-size: 13px; padding: 4px 8px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
button.model-btn:hover { background: var(--bg-3); }
.model-btn svg { color: var(--muted); }
.model-btn.warn { color: var(--muted); }
button.model-btn.warn { color: var(--accent); }

/* ---------- menús / modales / toasts ---------- */
.ctx-menu { position: fixed; z-index: 60; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 5px; min-width: 190px; max-height: 70vh; overflow-y: auto; }
.ctx-menu button { display: flex; width: 100%; text-align: left; border: 0; background: transparent; padding: 7px 10px; border-radius: 6px; cursor: pointer; gap: 8px; }
.ctx-menu button:hover { background: var(--bg-3); }
.ctx-menu button.danger { color: var(--danger); }
.ctx-menu button.current { font-weight: 600; }
.ctx-menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.ctx-menu .lbl { font-size: 11.5px; color: var(--muted); padding: 4px 10px; text-transform: uppercase; }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--bg); border-radius: 14px; box-shadow: var(--shadow); width: 100%; max-width: 480px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal.wide { max-width: 1080px; height: calc(100vh - 32px); }
.modal.medium { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 18px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

#toast-root { position: fixed; bottom: 18px; right: 18px; z-index: 70; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 380px; font-size: 13.5px; }
.toast.error { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }

/* ---------- admin ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 18px; }
.tabs button { border: 0; background: transparent; padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--muted); }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.toolbar input { max-width: 260px; }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th, table.grid td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.grid th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; }
table.grid td.r { text-align: right; white-space: nowrap; }
.tbl-wrap { overflow-x: auto; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; background: var(--bg-3); color: var(--muted); }
.badge.sysadmin { background: #fee2e2; color: #991b1b; }
.badge.admin { background: #fef3c7; color: #92400e; }
.badge.on { background: #dcfce7; color: #166534; }
.badge.off { background: #f3f4f6; color: #6b7280; }
.help { background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.help code { background: var(--bg-3); padding: 1px 4px; border-radius: 4px; }
.model-pick { max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 6px; margin-bottom: 12px; }
.model-pick label { display: flex; gap: 8px; padding: 4px 6px; cursor: pointer; border-radius: 6px; font-family: ui-monospace, monospace; font-size: 12.5px; }
.model-pick label:hover { background: var(--bg-3); }

/* ---------- móvil ---------- */
@media (max-width: 800px) {
  .sidebar, .layout.side-collapsed .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; margin-left: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .layout.side-open .sidebar { transform: none; }
  .layout.side-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 39; }
  .menu-toggle { display: inline-grid; }
  .messages-inner { padding: 16px 16px 30px; }
  .composer-wrap { padding: 6px 10px 10px; }
  .hint { display: none; }
  .composer-meta { justify-content: flex-end; }
  .row { flex-direction: column; gap: 0; }
}

/* ---------- indicador "Pensando" ---------- */
.thinking { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.thinking.live .thinking-label { 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; }
.thinking.live .thinking-label::after { content: "…"; }
.thinking-time { font-variant-numeric: tabular-nums; opacity: .7; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---------- adjuntos ---------- */
.att-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 2px 0; }
.att-chip { position: relative; display: flex; align-items: center; gap: 8px; max-width: 240px; padding: 6px 28px 6px 6px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-2); }
.att-chip img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.att-chip.loading { opacity: .6; }
.att-ico { width: 40px; height: 40px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; text-transform: uppercase; flex-shrink: 0; }
.att-name { min-width: 0; font-size: 13px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-name small { display: block; color: var(--muted); font-size: 11.5px; }
.att-x { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--bg-3); color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.att-x:hover { color: var(--text); }
.msg-atts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-bottom: 6px; max-width: 85%; }
.msg-img img { display: block; max-width: 240px; max-height: 240px; border-radius: 12px; border: 1px solid var(--border); object-fit: cover; }
.msg-doc { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); color: var(--text); text-decoration: none; max-width: 260px; }
.msg-doc:hover { background: var(--bg-2); }
.main { position: relative; }
.main.file-drop::after { content: "Suelta los archivos para adjuntarlos"; position: absolute; inset: 10px; border: 2px dashed var(--accent); border-radius: 16px; background: color-mix(in srgb, var(--bg) 85%, transparent); display: grid; place-items: center; font-size: 16px; color: var(--accent); z-index: 30; pointer-events: none; }

/* ---------- archivos generados ---------- */
.file-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: .8em 0; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-2); max-width: 520px; }
.file-ico { width: 42px; height: 42px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.file-ico.docx { background: #2b579a; } .file-ico.xlsx { background: #217346; } .file-ico.pdf { background: #c43e1c; }
.file-meta { flex: 1; min-width: 0; line-height: 1.3; }
.file-meta b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta small { color: var(--muted); }
.file-preview { border-left: 3px solid var(--border); padding: 4px 0 4px 14px; margin: -4px 0 12px; }

/* ======================= estilo corporativo (panel de administración) ======================= */
.btn { border-radius: 10px; font-weight: 500; min-height: 36px; padding: 7px 14px; border-color: var(--border); transition: background .15s, box-shadow .15s, transform .15s; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 22%, transparent); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); transform: translateY(-1px); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn.primary:disabled { transform: none; box-shadow: none; }
.btn.sm { min-height: 30px; padding: 4px 10px; border-radius: 8px; }

.modal { border-radius: 16px; }
.modal-head { padding: 16px 22px; }
.modal-head h3 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 14px 22px; }

.tabs { padding: 0 22px; gap: 6px; }
.tabs button { display: inline-flex; align-items: center; gap: 8px; padding: 12px 12px; font-weight: 500; border-bottom-width: 2px; }
.tabs button svg { opacity: .8; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tabs button.on svg { opacity: 1; }

.toolbar input { border-radius: 10px; min-height: 36px; }
table.grid { border: 1px solid var(--border); border-radius: 12px; border-collapse: separate; border-spacing: 0; overflow: hidden; }
table.grid th { background: var(--bg-2); font-size: 11.5px; letter-spacing: .05em; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); }
table.grid td { padding: 11px 14px; border-bottom: 1px solid var(--border); }
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid tbody tr:hover td { background: color-mix(in srgb, var(--bg-2) 70%, transparent); }
table.grid td.muted { color: var(--muted); font-size: 13px; }
table.grid td.r { white-space: nowrap; }

.row-act { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 1px solid transparent; background: transparent; color: var(--muted); border-radius: 8px; cursor: pointer; margin-left: 2px; vertical-align: middle; }
.row-act:hover { background: var(--bg); border-color: var(--border); color: var(--accent); box-shadow: 0 1px 3px rgba(20,32,51,.08); }
.row-act.danger:hover { color: var(--danger); }
.row-act.busy svg { animation: pulse 1s ease-in-out infinite; color: var(--accent); }
@keyframes pulse { 50% { opacity: .3; } }

.status, .role-tag { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; white-space: nowrap; }
.status::before, .role-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.status.on { color: #15803d; } .status.off { color: var(--muted); }
.role-tag { color: var(--text); font-weight: 500; }
.role-tag.sysadmin::before { background: var(--accent); }
.role-tag.admin::before { background: #0e7490; }
.role-tag.user::before { background: #9aa5b6; }
.badge { background: var(--bg-3); color: var(--muted); border-radius: 6px; font-weight: 500; padding: 2px 7px; }
.badge.accent { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.help { border-radius: 10px; background: var(--bg-2); border-color: var(--border); }

/* ---------- fotos de perfil ---------- */
.avatar { overflow: hidden; background: var(--accent); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.sm { width: 26px; height: 26px; font-size: 11.5px; }
.avatar.md { width: 44px; height: 44px; font-size: 17px; }
.avatar.xl { width: 96px; height: 96px; font-size: 36px; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.avatar-edit { display: flex; align-items: center; gap: 20px; }
.avatar-edit .btn { margin: 0 6px 6px 0; }
.user-photo-row { display: flex; align-items: center; gap: 12px; margin: 4px 0 12px; }

/* ---------- seguridad ---------- */
.sec-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; margin: 18px 0 10px; }
.sec-title:first-child, #sec-blocks .sec-title { margin-top: 0; }
.sec-title svg { color: var(--accent); }
.sec-rule { font-size: 12.5px; color: var(--muted); margin: 8px 0 22px; }
.sec-filters input, .sec-filters select { max-width: 200px; min-height: 36px; border-radius: 10px; }
.sec-filters { justify-content: flex-start; }
.block-list { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.block-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.block-item:last-child { border-bottom: 0; }
.block-item .grow { flex: 1; }
.block-item .muted, td .muted, .muted { color: var(--muted); }
.status.locked { color: var(--danger); font-weight: 500; }
.evt { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; white-space: nowrap; }
.evt::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.evt.ok { color: #15803d; } .evt.bad { color: var(--danger); } .evt.warn { color: #b45309; } .evt.info { color: var(--accent); } .evt.neutral { color: var(--muted); }
td.mono, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
td.nowrap { white-space: nowrap; }
table.grid td a { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--muted); }
table.grid td a:hover { color: var(--accent); border-color: var(--accent); }
table.grid td small { color: var(--muted); font-size: 11.5px; }

/* ======================= pantalla de entrada (estilo AntecSystems) ======================= */
.login { --o: #ff5a1f; --o2: #ff7a45; --ink: #f3f1ec; --mut: #a3a3a3; --line: rgba(255,255,255,.10);
  position: relative; min-height: 100vh; display: flex; flex-direction: column; background: #0d0d0e; color: var(--ink); overflow: hidden; }
.login-bg { position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(900px 600px at 82% 18%, rgba(255,90,31,.22), transparent 60%),
    radial-gradient(700px 500px at 10% 100%, rgba(255,90,31,.08), transparent 60%); }
.login-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 60%, #0d0d0e); }
.login-top, .login-main, .login-foot { position: relative; z-index: 1; }
.login-top { display: flex; align-items: center; justify-content: space-between; padding: 22px clamp(16px, 5vw, 64px); border-bottom: 1px solid var(--line); background: rgba(13,13,14,.6); backdrop-filter: blur(8px); }
.login-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; letter-spacing: -.02em; }
.login-brand img { width: 32px; height: 32px; filter: invert(1); }
.login-tag { font: 600 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .14em; text-transform: uppercase; color: var(--mut); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; }
.login-main { flex: 1; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 420px); gap: clamp(32px, 6vw, 96px); align-items: center; padding: clamp(32px, 6vh, 80px) clamp(16px, 5vw, 64px); max-width: 1320px; width: 100%; margin: 0 auto; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; font: 600 13px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .16em; text-transform: uppercase; color: var(--mut, var(--muted)); margin-bottom: 22px; }
.eyebrow .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--o, var(--accent)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--o, var(--accent)) 25%, transparent); }
.eyebrow.small { font-size: 11.5px; margin-bottom: 14px; }
.login-hero h1 { font-size: clamp(42px, 6.4vw, 92px); line-height: .98; letter-spacing: -.055em; font-weight: 800; margin: 0 0 26px; }
.login-hero h1 .hl, .welcome h2 .hl { display: block; color: var(--o, var(--accent)); }
.login-hero p { font-size: clamp(16px, 1.4vw, 20px); line-height: 1.55; color: #c9c7c2; max-width: 620px; margin: 0 0 30px; }
.login-points { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-width: 680px; }
.login-points li { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: rgba(255,255,255,.025); }
.login-points b { display: block; font-size: 14px; margin-bottom: 4px; }
.login-points span { font-size: 12.5px; color: var(--mut); line-height: 1.4; }
.login-card { background: rgba(20,20,22,.78); border: 1px solid var(--line); border-radius: 20px; padding: 32px; backdrop-filter: blur(14px); box-shadow: 0 30px 80px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.05); }
.login-card h2 { font-size: 28px; letter-spacing: -.035em; font-weight: 800; margin: 0 0 6px; }
.login-sub { color: var(--mut); margin: 0 0 22px; font-size: 14px; }
.login-card label.f > span { color: var(--mut); font-size: 12.5px; }
.login-card input { background: rgba(255,255,255,.04) !important; border: 1px solid var(--line) !important; color: var(--ink) !important; border-radius: 10px !important; padding: 12px 14px !important; font-size: 15px; }
.login-card input:focus { border-color: var(--o) !important; box-shadow: 0 0 0 3px rgba(255,90,31,.22) !important; }
.login-card .err { color: #ff8a65; min-height: 20px; font-size: 13px; }
.login-btn { width: 100%; margin-top: 6px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 0; border-radius: 10px; background: var(--o); color: #fff; font-weight: 700; font-size: 16px; padding: 15px 20px; cursor: pointer; box-shadow: 0 10px 28px rgba(255,90,31,.28); transition: background .2s, transform .2s, box-shadow .2s; }
.login-btn:hover { background: var(--o2); transform: translateY(-2px); box-shadow: 0 14px 34px rgba(255,90,31,.36); }
.login-btn:disabled { opacity: .6; transform: none; }
.login-foot { padding: 18px clamp(16px, 5vw, 64px); font-size: 12px; color: #6f6f6f; border-top: 1px solid var(--line); }
@media (max-width: 900px) {
  .login-main { grid-template-columns: 1fr; gap: 28px; }
  .login-points { grid-template-columns: 1fr; }
  .login-hero p { margin-bottom: 20px; }
  .login-tag { display: none; }
}

/* ======================= tema Antec ======================= */
:root[data-theme="antec"] {
  --bg: #0f0f10; --bg-2: #18181a; --bg-3: #232326; --side: #121213; --text: #f3f1ec; --muted: #a09f9b;
  --border: rgba(255,255,255,.10); --accent: #ff5a1f; --accent-2: #ff7a45; --user-bubble: #232326; --code-bg: #0a0a0b;
  --shadow: 0 20px 50px rgba(0,0,0,.55); --danger: #ff6b5b; --ok: #3ccf7a; color-scheme: dark;
}
:root[data-theme="antec"] body { background: #0f0f10; }
:root[data-theme="antec"] .main {
  background:
    radial-gradient(800px 520px at 88% 0%, rgba(255,90,31,.14), transparent 60%), #0f0f10;
}
:root[data-theme="antec"] .sidebar { background: rgba(18,18,19,.92); }
:root[data-theme="antec"] .welcome { text-align: left; max-width: 760px; margin: 0 auto; padding-top: 16vh; }
:root[data-theme="antec"] .welcome h2 { font-size: clamp(38px, 5vw, 68px); line-height: 1; letter-spacing: -.055em; font-weight: 800; }
:root[data-theme="antec"] .composer { background: rgba(24,24,26,.9); border-color: rgba(255,255,255,.12); backdrop-filter: blur(10px); }
:root[data-theme="antec"] .send-btn { background: var(--accent); color: #fff; }
:root[data-theme="antec"] .msg.user .bubble { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); }
:root[data-theme="antec"] .btn.primary { box-shadow: 0 8px 22px rgba(255,90,31,.25); }
:root[data-theme="antec"] .avatar { background: var(--accent); }
:root[data-theme="antec"] .status.on, :root[data-theme="antec"] .evt.ok { color: #3ccf7a; }
:root[data-theme="antec"] .role-tag.admin::before { background: #3fb6c9; }
:root[data-theme="antec"] .file-card { background: rgba(255,255,255,.04); }
:root[data-theme="antec"] .modal { background: #151517; border: 1px solid var(--border); }
:root[data-theme="antec"] input, :root[data-theme="antec"] select, :root[data-theme="antec"] textarea { background: rgba(255,255,255,.04); }
.welcome .eyebrow { display: none; }
:root[data-theme="antec"] .welcome .eyebrow { display: inline-flex; }
.welcome h2 .hl { font-size: .62em; font-weight: 400; color: var(--muted); margin-top: 6px; letter-spacing: 0; }
:root[data-theme="antec"] .welcome h2 .hl { font-size: 1em; font-weight: 800; color: var(--accent); letter-spacing: -.055em; margin-top: 0; }

/* ======================= selector de apariencia ======================= */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.theme-card { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 10px; border: 1.5px solid var(--border); border-radius: 14px; background: var(--bg); cursor: pointer; text-align: left; color: var(--text); transition: border-color .15s, transform .15s, box-shadow .15s; }
.theme-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.theme-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.theme-check { position: absolute; top: 16px; right: 16px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; display: none; place-items: center; }
.theme-card.on .theme-check { display: grid; }
.theme-meta b { display: block; font-size: 14px; }
.theme-meta small { color: var(--muted); font-size: 12px; }
.theme-prev { display: flex; height: 112px; border-radius: 9px; overflow: hidden; border: 1px solid rgba(0,0,0,.08); }
.tp-side { width: 28%; }
.tp-main { flex: 1; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.tp-h { height: 9px; width: 70%; border-radius: 3px; }
.tp-h2 { height: 9px; width: 50%; border-radius: 3px; }
.tp-box { margin-top: auto; height: 22px; border-radius: 6px; display: flex; justify-content: flex-end; align-items: center; padding: 0 4px; }
.tp-btn { width: 14px; height: 14px; border-radius: 50%; }
.tp-light { background: #fff; } .tp-light .tp-side { background: #f4f6f9; } .tp-light .tp-h { background: #142033; } .tp-light .tp-h2 { background: #c9d0db; } .tp-light .tp-box { border: 1px solid #e1e6ee; } .tp-light .tp-btn { background: #142033; }
.tp-dark { background: #1e1f22; } .tp-dark .tp-side { background: #18191c; } .tp-dark .tp-h { background: #e6e6e6; } .tp-dark .tp-h2 { background: #4a4d55; } .tp-dark .tp-box { border: 1px solid #34363c; } .tp-dark .tp-btn { background: #8b82ff; }
.tp-system { background: linear-gradient(135deg, #fff 50%, #1e1f22 50%); } .tp-system .tp-side { background: linear-gradient(135deg, #f4f6f9 50%, #18191c 50%); } .tp-system .tp-h { background: #6b7280; } .tp-system .tp-h2 { background: #9aa0a6; } .tp-system .tp-box { border: 1px solid #9aa0a6; } .tp-system .tp-btn { background: #4438cf; }
.tp-antec { background: radial-gradient(120px 80px at 90% 0%, rgba(255,90,31,.35), transparent 70%), #0f0f10; }
.tp-antec .tp-side { background: rgba(18,18,19,.9); border-right: 1px solid rgba(255,255,255,.08); } .tp-antec .tp-h { background: #f3f1ec; height: 11px; } .tp-antec .tp-h2 { background: #ff5a1f; height: 11px; width: 62%; } .tp-antec .tp-box { border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.04); } .tp-antec .tp-btn { background: #ff5a1f; }
.side-search input { background: transparent !important; }
@media (min-width: 720px) { .theme-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* portada solo con el formulario */
.login.solo { justify-content: center; }
.login-center { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; padding: 32px 16px; }
.login-center .login-brand { font-size: 24px; }
.login-center .login-brand img { width: 38px; height: 38px; }
.login-center .login-card { width: 100%; max-width: 420px; }

.composer textarea { background: transparent !important; }

/* ---------- cara de EON en la portada ---------- */
.eon-hero { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.eon-face { width: 132px; height: auto; overflow: visible; filter: drop-shadow(0 0 28px rgba(255,255,255,.18)) drop-shadow(0 0 60px rgba(255,90,31,.18)); animation: eon-float 6s ease-in-out infinite; }
.eon-face .eon-body { fill: #f5f3ee; }
.eon-face .eon-eye { fill: #0f0f10; transform-box: fill-box; transform-origin: center; animation: eon-blink 4.6s infinite; }
.eon-face .eon-eyes { animation: eon-look 9s ease-in-out infinite; }
.eon-word { font-size: 40px; font-weight: 800; letter-spacing: .18em; padding-left: .18em; line-height: 1; }
.login-by { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #8a8a8a; }
.login-by img { width: 18px; height: 18px; filter: invert(1); opacity: .75; }
@keyframes eon-blink { 0%, 90%, 100% { transform: scaleY(1); } 93% { transform: scaleY(.08); } 96% { transform: scaleY(1); } }
@keyframes eon-look { 0%, 35%, 100% { transform: translateX(0); } 42%, 55% { transform: translateX(-14px); } 62%, 75% { transform: translateX(14px); } 82% { transform: translateX(0); } }
@keyframes eon-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

.theme-grid.locked .theme-card:not(.on) { opacity: .45; }
.theme-card:disabled { cursor: default; transform: none !important; box-shadow: none; }
.theme-card.on:disabled { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.org-theme { border: 1px solid var(--border); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; background: var(--bg-2); }
.org-theme label.check { align-items: flex-start; }
.org-theme label.check input { margin-top: 3px; }
.org-theme label.check b { display: block; font-weight: 600; }
.org-theme label.check small { color: var(--muted); font-size: 12.5px; }
/* conversaciones tabuladas bajo su grupo */
.group-items .conv { padding-left: 24px; }
.group-items .empty-group { padding-left: 24px; }
/* EON dentro de la tarjeta */
.login-card .eon-hero { gap: 12px; margin: 4px 0 22px; }
.login-card .eon-face { width: 96px; }
.login-card .eon-word { font-size: 28px; }
.login-card h2, .login-card .login-sub { text-align: center; }

/* malla interactiva de la portada */
.login .mesh-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; opacity: .55;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 20%, transparent 78%); mask-image: radial-gradient(ellipse at center, #000 20%, transparent 78%); }
.login-center { z-index: 1; }
.eon-word { display: inline-flex; align-items: flex-start; }
.eon-ai { font: 700 .38em/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; color: var(--o, var(--accent)); border: 1px solid color-mix(in srgb, var(--o, var(--accent)) 45%, transparent); border-radius: 5px; padding: .28em .32em .22em; margin-left: .35em; margin-top: .05em; }
.login .mesh-canvas { opacity: .75; -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 85%); mask-image: radial-gradient(ellipse at center, #000 30%, transparent 85%); }
.eon-ai { font-size: .44em; }

/* fondo red neuronal: menos máscara para que se vea en toda la pantalla */
.login.neural .mesh-canvas { opacity: .9; -webkit-mask-image: radial-gradient(ellipse at center, #000 45%, rgba(0,0,0,.35) 100%); mask-image: radial-gradient(ellipse at center, #000 45%, rgba(0,0,0,.35) 100%); }
/* pestaña perfil */
.profile-photo { display: flex; align-items: center; gap: 22px; }
.profile-photo .btn { margin: 0 6px 6px 0; }
.profile-name { display: block; font-size: 17px; }
.profile-pass { max-width: 640px; }

/* ======================= EON en el chat ======================= */
.eon-mini, .eon-hello { overflow: visible; display: block; }
.eon-mini .eon-body, .eon-hello .eon-body { fill: var(--text); }
.eon-mini .eon-eye, .eon-hello .eon-eye { fill: var(--bg); transform-box: fill-box; transform-origin: center; }
.eon-mini .eon-eyes, .eon-hello .eon-eyes { transform-box: view-box; }

/* marca en la barra lateral */
.side-logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: .12em; font-size: 15px; }
.side-logo .eon-mini { width: 30px; }
.side-logo .eon-ai { font-size: 9.5px; margin-left: 0; letter-spacing: .1em; }

/* cara viva de la barra superior */
.eon-live { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border); background: color-mix(in srgb, var(--bg-2) 70%, transparent); }
.eon-live .eon-mini { width: 38px; transition: filter .3s; }
.eon-status { font: 600 10.5px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); min-width: 0; }
.eon-live[data-mood="idle"] .eon-status::after { content: "En línea"; }
.eon-live[data-mood="thinking"] .eon-status::after { content: "Pensando"; color: var(--accent); }
.eon-live[data-mood="speaking"] .eon-status::after { content: "Escribiendo"; color: var(--accent); }
.eon-live[data-mood="idle"] .eon-eye { animation: eon-blink 4.6s infinite; }
.eon-live[data-mood="idle"] .eon-eyes { animation: eon-look 9s ease-in-out infinite; }
.eon-live[data-mood="thinking"] .eon-mini { filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 70%, transparent)); animation: eon-pulse 1.4s ease-in-out infinite; }
.eon-live[data-mood="thinking"] .eon-eyes { animation: eon-ponder 2.4s ease-in-out infinite; }
.eon-live[data-mood="thinking"] .eon-eye { animation: eon-squint 2.4s ease-in-out infinite; }
.eon-live[data-mood="speaking"] .eon-eye { animation: eon-talk .5s ease-in-out infinite; }
.eon-live[data-mood="speaking"] .eon-mini { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 45%, transparent)); }
@keyframes eon-ponder { 0%, 100% { transform: translate(-16px, -22px); } 45% { transform: translate(16px, -22px); } 55% { transform: translate(16px, -22px); } }
@keyframes eon-squint { 0%, 100% { transform: scaleY(.72); } 50% { transform: scaleY(.6); } }
@keyframes eon-talk { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.55); } }
@keyframes eon-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* bienvenida */
.eon-hello { width: 112px; margin: 0 auto 22px; }
.welcome .eon-hello .eon-eye { animation: eon-blink 4.6s infinite; }
.welcome .eon-hello .eon-eyes { animation: eon-look 9s ease-in-out infinite; }
:root[data-theme="antec"] .welcome .eon-hello { margin-left: 0; filter: drop-shadow(0 0 30px rgba(255,255,255,.12)) drop-shadow(0 0 50px rgba(255,90,31,.2)); }

/* mensajes de EON con avatar */
.msg.assistant { flex-direction: row; align-items: flex-start; gap: 14px; }
.ai-av { flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--bg-2); border: 1px solid var(--border); margin-top: 1px; }
.ai-av .eon-mini { width: 22px; }
.ai-body { flex: 1; min-width: 0; }
.msg.assistant .meta { gap: 8px; }
.msg.assistant .meta b { color: var(--text); font-weight: 700; letter-spacing: .06em; font-size: 12.5px; }
.msg.assistant .meta span { font-size: 11.5px; color: var(--muted); }
.msg.assistant.error { flex-direction: row; }
.typing { display: inline-flex; gap: 5px; padding: 8px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); opacity: .3; animation: eon-dot 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes eon-dot { 0%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }

/* tus mensajes con el color de acento */
.msg.user .bubble { background: color-mix(in srgb, var(--accent) 10%, var(--bg)); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); }
:root[data-theme="antec"] .msg.user .bubble { background: linear-gradient(135deg, rgba(255,90,31,.26), rgba(255,90,31,.12)); border: 1px solid rgba(255,90,31,.42); color: #fff; box-shadow: 0 6px 20px rgba(255,90,31,.10); }
:root[data-theme="antec"] .ai-av { background: rgba(255,255,255,.04); }

@media (prefers-reduced-motion: reduce) { .eon-face, .eon-face *, .eon-live *, .eon-hello *, .typing i { animation: none !important; } }
@media (max-width: 800px) { .eon-status { display: none; } .eon-live { padding: 4px 8px; } }

/* icono de visión en el selector de modelos */
.ctx-menu button { align-items: center; }
.ctx-ico { margin-left: auto; padding-left: 14px; display: inline-grid; color: var(--accent); opacity: .85; }
.model-vis { display: inline-grid; color: var(--accent); margin-right: 2px; }
/* tus mensajes: naranja sólido de marca (tema Antec) */
:root[data-theme="antec"] .msg.user .bubble { background: linear-gradient(135deg, #ff6a2b 0%, #ff5a1f 55%, #f24e12 100%); border: 0; color: #fff; font-weight: 500; box-shadow: 0 8px 24px rgba(255,90,31,.28); }
:root[data-theme="antec"] .msg.user .msg-doc { background: rgba(255,90,31,.12); border-color: rgba(255,90,31,.4); }

/* ---------- velocidad de la respuesta ---------- */
.metrics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; font: 500 11.5px/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); }
.metrics span { display: inline-flex; align-items: baseline; gap: 5px; padding: 5px 8px; border-radius: 7px; background: var(--bg-2); border: 1px solid var(--border); }
.metrics i { font-style: normal; text-transform: uppercase; letter-spacing: .08em; font-size: 10px; opacity: .8; }
.metrics b { color: var(--text); font-weight: 700; }
:root[data-theme="antec"] .metrics span { background: rgba(255,255,255,.03); }
:root[data-theme="antec"] .metrics span:first-child b, :root[data-theme="antec"] .metrics span:nth-child(2) b { color: #ff8a5c; }

/* ---------- tus mensajes: término medio (tema Antec) ---------- */
:root[data-theme="antec"] .msg.user .bubble { background: linear-gradient(135deg, rgba(255,90,31,.34), rgba(255,90,31,.20)); border: 1px solid rgba(255,120,70,.45); color: #fff; font-weight: 400; box-shadow: none; }

/* ---------- barra lateral de cristal con toque naranja (tema Antec) ---------- */
:root[data-theme="antec"] .layout {
  background:
    radial-gradient(600px 520px at 0% 0%, rgba(255,90,31,.16), transparent 65%),
    radial-gradient(500px 420px at 6% 100%, rgba(255,90,31,.08), transparent 70%),
    radial-gradient(800px 520px at 88% 0%, rgba(255,90,31,.14), transparent 60%), #0f0f10;
}
:root[data-theme="antec"] .main { background: transparent; }
:root[data-theme="antec"] .sidebar {
  background: linear-gradient(180deg, rgba(255,110,60,.08) 0%, rgba(255,90,31,.03) 45%, rgba(255,255,255,.015) 100%), rgba(22,20,20,.42);
  -webkit-backdrop-filter: blur(22px) saturate(160%); backdrop-filter: blur(22px) saturate(160%);
  border-right: 1px solid rgba(255,140,90,.16);
  box-shadow: inset -1px 0 0 rgba(255,255,255,.04), 8px 0 40px rgba(0,0,0,.25);
}
:root[data-theme="antec"] .side-bottom, :root[data-theme="antec"] .side-section { border-color: rgba(255,140,90,.12); }
:root[data-theme="antec"] .conv:hover, :root[data-theme="antec"] .conv.active, :root[data-theme="antec"] .side-action:hover, :root[data-theme="antec"] .side-user-btn:hover { background: rgba(255,140,90,.10); }

/* ---------- pruebas de tono del fondo de la portada (?tono=1|2|3) ---------- */
.login[data-tone="1"] .login-bg { background: radial-gradient(900px 620px at 82% 18%, rgba(255,90,31,.09), transparent 62%), radial-gradient(700px 500px at 10% 100%, rgba(255,90,31,.03), transparent 60%); }
.login[data-tone="1"].neural .mesh-canvas { opacity: .62; }
.login[data-tone="2"] .login-bg { background: radial-gradient(1000px 700px at 80% 15%, rgba(255,90,31,.045), transparent 65%); }
.login[data-tone="2"].neural .mesh-canvas { opacity: .38; }
.login[data-tone="3"] .login-bg { background: radial-gradient(760px 560px at 50% 46%, rgba(255,90,31,.085), transparent 68%); }
.login[data-tone="3"].neural .mesh-canvas { opacity: .55; -webkit-mask-image: none; mask-image: none; }

/* campos autorrellenados por el navegador: mantener el estilo oscuro */
.login-card input:-webkit-autofill, .login-card input:-webkit-autofill:hover, .login-card input:-webkit-autofill:focus {
  -webkit-text-fill-color: #f3f1ec; caret-color: #f3f1ec;
  -webkit-box-shadow: 0 0 0 1000px #1b1b1d inset !important; box-shadow: 0 0 0 1000px #1b1b1d inset !important;
  transition: background-color 9999s ease-in-out 0s;
}

.ios-steps { margin: 0; padding-left: 20px; line-height: 1.7; }

/* selector de razonamiento */
#model-slot { display: inline-flex; align-items: center; gap: 2px; }
.reason-btn svg:first-child { color: var(--accent); }
.reason-btn.off svg:first-child { color: var(--muted); }
.ctx-menu button.has-hint { flex-wrap: wrap; row-gap: 1px; }
.ctx-menu button.has-hint small { flex-basis: 100%; color: var(--muted); font-size: 11.5px; font-weight: 400; }

/* archivos creados por EON */
.gen-files { display: flex; flex-direction: column; gap: 8px; margin: 2px 0 12px; }
a.file-card.gen { text-decoration: none; color: var(--text); margin: 0; transition: border-color .15s, transform .15s; }
a.file-card.gen:hover { border-color: var(--accent); transform: translateY(-1px); }
.tool-status { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); margin-bottom: 10px; padding: 8px 12px; border: 1px dashed var(--border); border-radius: 10px; }
.tool-status.live { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.tool-status.err { color: var(--danger); }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--accent) 25%, transparent); border-top-color: var(--accent); animation: eon-spin .8s linear infinite; }
@keyframes eon-spin { to { transform: rotate(360deg); } }
