/* ============================ TWEAKS (Config) ============================ */
.tweaks { display: grid; gap: 18px; }
.tweaks-sec-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.tweaks-field { display: grid; gap: 8px; }
.tweaks-field > .tweaks-name { font-size: 13px; font-weight: 500; color: var(--text); }
.seg { display: inline-grid; grid-auto-flow: column; gap: 3px; padding: 3px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 11px; width: fit-content; }
.seg button { border: none; background: transparent; color: var(--muted); padding: 7px 18px; border-radius: 8px;
  font-size: 13px; font-weight: 500; }
.seg button:hover { background: transparent; color: var(--text); }
.seg button.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow-soft); font-weight: 600; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 52px; height: 52px; border-radius: 13px; border: 1px solid var(--border); cursor: pointer; position: relative;
  display: grid; place-items: center; transition: transform .12s, box-shadow .12s, border-color .12s; padding: 0; }
.swatch:hover { transform: translateY(-2px); }
.swatch.active { border-color: var(--text); box-shadow: 0 0 0 3px var(--ring); }
.swatch .ico { color: #fff; opacity: 0; transition: opacity .12s; }
.swatch.active .ico { opacity: 1; }
.toggle { position: relative; width: 46px; height: 27px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--panel-2); cursor: pointer; padding: 0; flex: none; transition: background .18s, border-color .18s; }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 21px; height: 21px; border-radius: 50%;
  background: var(--muted); transition: transform .2s cubic-bezier(.4,1.3,.5,1), background .2s; }
.toggle.on { background: var(--accent); border-color: transparent; }
.toggle.on::after { transform: translateX(19px); background: var(--accent-fg); }
.tweaks-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }

/* ============================ ANIMACIONES ============================ */
@keyframes statusRing { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(2.6); opacity: 0; } }
@keyframes statusPulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 55%, transparent); }
  70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes dimPulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes dotty { 0%, 80%, 100% { transform: translateY(0); opacity: .35; } 40% { transform: translateY(-3px); opacity: 1; } }
@keyframes bIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes upIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadeStagger { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .modal, .modal.wide:has(.hermes-shell), .login-card,
  .hermes-att.uploading::after, .hermes-send.is-stop,
  .badge.running::before, .agent-btn .agent-dot::after, .hermes-activity-dot { animation: none; }
  .card:hover, .hermes-conv, .hermes-usage-mini, .chip, .swatch:hover,
  .hermes-input .hermes-send:not(:disabled):hover { transform: none; }
}

/* ============================ RESPONSIVE (móvil chat) ============================ */
@media (max-width: 760px) {
  .overlay:has(.hermes-shell) { align-items: stretch; padding: 0; overflow: hidden; background: var(--panel); }
  .modal.wide:has(.hermes-shell) {
    width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0;
    box-shadow: none; display: flex; flex-direction: column;
  }
  .modal.wide:has(.hermes-shell) header {
    flex: none; min-height: 40px; padding: 4px 12px; border-bottom-color: var(--border);
  }
  .modal.wide:has(.hermes-shell) header h2 { font-size: 14.5px; }
  .modal.wide:has(.hermes-shell) header button { width: 32px; height: 32px; }
  .modal.wide:has(.hermes-shell) .body { flex: 1; min-height: 0; }
  .hermes-shell { min-height: 0; }
  .hermes-layout { height: 100%; max-height: none; background: var(--panel); }
  .hermes-main { width: 100%; gap: 10px; padding: 12px 14px max(12px, env(safe-area-inset-bottom)); min-height: 0; overflow: hidden; }
  .modal.wide:has(.hermes-shell).hermes-kb .hermes-main { padding-bottom: 0; }
  .modal.wide:has(.hermes-shell).hermes-kb .hermes-input-wrap { padding-bottom: 0; }
  .hermes-pane { min-height: 0; overflow: hidden; }
  .hermes-pane.hermes-scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
  .hermes-sidebar {
    padding: 18px 14px calc(18px + env(safe-area-inset-bottom)); background: var(--panel);
    border-radius: 0 18px 18px 0; box-shadow: 0 0 60px rgba(0,0,0,.48);
  }
  .hermes-conv { padding: 12px; border-radius: 13px; }
  .hermes-conv-act { opacity: 1; width: 34px; height: 34px; }
  .hermes-mobilebar {
    display: flex; align-items: center; gap: 6px; padding: 0 0 6px;
    border-bottom: 1px solid var(--border); flex-wrap: nowrap;
  }
  .hermes-mobilebar-title {
    font-size: 15px; font-weight: 700; min-width: 0; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
  }
  .hermes-mobilebar .sm {
    min-width: 34px; height: 34px; padding: 0 8px; justify-content: center; border-radius: 10px;
  }
  .hermes-mobilebar .hermes-model-btn { max-width: 130px; }
  .hermes-chat-top { display: none; }
  .hermes-main .hermes-banner,
  .hermes-main .hermes-banner.ok,
  .hermes-main .hermes-banner.warn { display: none; }
  .hermes-welcome { width: 100%; padding: 28px 10px; gap: 14px; }
  .hermes-welcome-h { justify-content: center; }
  .hermes-suggestions { display: grid; grid-template-columns: 1fr; width: 100%; gap: 8px; }
  .hermes-suggestions .chip { justify-content: flex-start; border-radius: 14px; padding: 12px 14px; }
  .hermes-msgs-wrap { min-height: 0; }
  .hermes-messages {
    min-height: 0; border: 0; border-radius: 0; padding: 6px 2px 12px; gap: 20px;
    background: transparent; max-height: none; overflow-y: auto;
    -webkit-overflow-scrolling: touch; touch-action: pan-y; overscroll-behavior: contain;
  }
  .hermes-avatar { display: none; }
  .hermes-msg { max-width: 100%; gap: 0; }
  .hermes-msg .hermes-role { display: none; }
  .hermes-msg .hermes-meta { margin-bottom: 2px; }
  .hermes-msg.assistant { max-width: 100%; justify-self: stretch; }
  .hermes-msg.assistant .hermes-bubble { border: none; background: transparent; box-shadow: none; padding: 0; }
  .hermes-msg.user { max-width: 86%; justify-self: end; }
  .hermes-msg.user .hermes-bubble {
    border-radius: 20px 20px 6px 20px; padding: 12px 15px;
    background: color-mix(in srgb, var(--accent) 22%, var(--panel)); border-color: transparent;
  }
  .hermes-msg.user .hermes-meta { display: none; }
  .hermes-text { font-size: 16px; line-height: 1.6; }
  .hermes-msg-foot { margin-top: 10px; }
  .hermes-input-wrap { padding-bottom: 2px; flex: none; position: relative; }
  .hermes-input { border-radius: 22px; padding: 6px 7px; position: relative; z-index: 1;
    background: var(--panel-2); border-color: var(--border); box-shadow: var(--shadow-soft); }
  .hermes-input textarea { min-height: 40px; padding: 9px 6px; font-size: 16px; }
  .hermes-input .hermes-cmd,
  .hermes-input .hermes-send { width: 44px; height: 44px; }
  .hermes-hint { display: none; }
  .hermes-fab { right: 12px; bottom: 12px; }
  .hermes-model-menu { left: 12px !important; right: 12px; top: auto !important; bottom: max(12px, env(safe-area-inset-bottom)); width: auto !important; }
  .hermes-action-intro { margin: -2px 0 4px; padding-bottom: 10px; }
  .hermes-action { padding: 14px; border-radius: 15px; }
  .hermes-action-top { gap: 10px; flex-wrap: wrap; }
  .hermes-action-icon { width: 38px; height: 38px; }
  .hermes-action-pills { flex-direction: row; align-items: center; justify-content: flex-start; grid-column: 1 / -1; }
  .hermes-confirm-row { display: grid; grid-template-columns: 1fr; }
  .hermes-confirm-row input,
  .hermes-confirm-row .primary,
  .hermes-confirm-row .danger { width: 100%; min-width: 0; }
}

@media (max-width: 640px) {
  .cols { grid-template-columns: 1fr; }
  header.topbar { flex-wrap: wrap; gap: 6px; padding: 8px 14px; height: auto; }
  header.topbar .brand { font-size: 15px; }
  header.topbar #who { display: none; }
  .topdiv { display: none; }
  .topnav { gap: 2px; }
  header.topbar button { padding: 6px 11px; font-size: 12px; }
  .container { padding: 16px 14px 60px; }
  .grid { grid-template-columns: 1fr; }
  .overlay { padding: 2vh 8px 16px; }
  .modal { max-height: 94vh; }
  .modal .body { padding: 16px; }
  .hermes-messages { max-height: none; }
  .hermes-shell { min-height: 0; }
  .modal table { display: block; overflow-x: auto; white-space: nowrap; }
  pre.console { font-size: 11.5px; max-height: 50vh; }
  .swatch { width: 46px; height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  .hermes-conv,
  .hermes-usage-mini,
  .chip,
  .hermes-input .hermes-send:not(:disabled):hover { transform: none; }
}

/* PWA instalada: respetar el notch */
@media (display-mode: standalone) {
  header.topbar { height: auto; padding-top: calc(10px + env(safe-area-inset-top)); padding-bottom: 10px; }
  .modal.wide:has(.hermes-shell) header { padding-top: calc(6px + env(safe-area-inset-top)); }
  .login-wrap { padding-top: env(safe-area-inset-top); }
  .overlay:not(:has(.hermes-shell)) { padding-top: calc(env(safe-area-inset-top) + 14px); align-items: flex-start; }
  .modal header { padding-top: calc(16px + env(safe-area-inset-top)); }
}

/* ===== /hermes standalone: SOLO el chat de Hermes a pantalla completa =====
   La vista /hermes carga este mismo styles.css con <body class="chat-only">.
   Ocultamos el panel de proyectos y el modal del chat ocupa toda la ventana (sin
   overlay atenuado ni bordes), como una app de chat dedicada. Inerte en el panel
   (/) porque el body no lleva la clase chat-only. */
.chat-only header.topbar,
.chat-only .container { display: none !important; }
.chat-only #app { min-height: 0; }
.chat-only .overlay:has(.hermes-shell) {
  position: fixed; inset: 0; padding: 0; overflow: hidden;
  background: var(--panel); align-items: stretch;
}
.chat-only .modal.wide:has(.hermes-shell) {
  width: 100vw; height: 100dvh; max-height: 100dvh;
  border-radius: 0; border: 0; box-shadow: none;
  display: flex; flex-direction: column; animation: none;
}
.chat-only .modal.wide:has(.hermes-shell) .body { flex: 1; min-height: 0; }
/* página dedicada: sin botón de cerrar (no hay panel al que volver) */
.chat-only .modal.wide:has(.hermes-shell) > header > button { display: none; }
/* …pero sí el tema y Salir, que montarControlesChat trae de la cabecera oculta del panel (PF36-15). */
.chat-controles { display: flex; align-items: center; gap: 8px; }
@media (display-mode: standalone) {
  .chat-only .modal.wide:has(.hermes-shell) > header { padding-top: calc(14px + env(safe-area-inset-top)); }
}



