/* Jarvis — botón, aviso urgente, sugerencia de voz y panel. Usa los tokens de color de noa.css (claro/oscuro). */
.jarvis-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; position: relative; flex-shrink: 0; }
.jarvis-btn:hover { background: var(--surface-2); color: var(--text); }
.jarvis-btn.urgent { border-color: var(--urgent-dot); color: var(--urgent-fg); }
.jarvis-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.jarvis-btn.urgent .jarvis-badge, .jarvis-fab.urgent .jarvis-badge { background: var(--urgent-dot); }
.jarvis-badge.hidden { display: none; }
.topbar .jarvis-btn + .top-new { margin-left: 0; }
.topbar .jarvis-btn { margin-left: auto; }

/* En celular la barra superior no existe: botón flotante, solo cuando hay algo nuevo */
.jarvis-fab { display: none; }
@media (max-width: 900px) {
  .jarvis-fab.has-new { position: fixed; left: 16px; bottom: var(--float-bottom, calc(80px + env(safe-area-inset-bottom))); z-index: 40; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); box-shadow: var(--shadow-1, 0 4px 14px rgba(0,0,0,.12)); cursor: pointer; }
  .jarvis-fab.urgent { border-color: var(--urgent-dot); color: var(--urgent-fg); }
}

/* Aviso urgente (discreto, arriba a la derecha) */
.jarvis-alert { position: fixed; top: 76px; right: 20px; z-index: 60; width: min(380px, calc(100vw - 32px)); padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line-strong); border-left: 4px solid var(--urgent-dot); box-shadow: 0 12px 32px rgba(0,0,0,.18); display: flex; flex-direction: column; gap: 4px; animation: jarvisIn 220ms ease-out; color: var(--text); }
.ja-head { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--urgent-fg); }
.ja-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--urgent-dot); animation: jarvisPulse 1.4s ease-in-out infinite; }
.ja-x { margin-left: auto; width: 28px; height: 28px; border: none; border-radius: 8px; background: none; color: var(--text-2); font-size: 20px; line-height: 1; cursor: pointer; }
.ja-x:hover { background: var(--surface-2); }
.ja-name { font-size: 15px; }
.ja-sum { margin: 0; font-size: 14px; line-height: 1.45; }
.ja-why { margin: 0; font-size: 12px; color: var(--text-2); }
.ja-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
@media (max-width: 900px) { .jarvis-alert { top: calc(12px + env(safe-area-inset-top)); right: 16px; left: 16px; width: auto; } }
@keyframes jarvisIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes jarvisPulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .jarvis-alert, .ja-dot { animation: none; } }

/* Sugerencia para activar la voz (requiere un gesto del usuario) */
.jarvis-hint { position: fixed; right: 20px; bottom: 20px; z-index: 45; width: min(400px, calc(100vw - 32px)); padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line-strong); box-shadow: 0 12px 32px rgba(0,0,0,.14); display: flex; flex-direction: column; gap: 10px; color: var(--text); }
.jh-text { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.jh-text span { color: var(--text-2); font-size: 13px; }
.jh-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
@media (max-width: 900px) { .jarvis-hint { left: 16px; right: 16px; width: auto; bottom: calc(132px + env(safe-area-inset-bottom)); } }

/* Panel */
.jarvis-panel { display: flex; flex-direction: column; gap: 12px; }
.jp-intro { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.jp-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; font-weight: 600; }
.jp-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); }
.jp-dot.on { background: var(--ok-dot, #16a34a); }
.jp-grow { flex: 1; }
.jp-settings { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface); }
.jp-settings summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.jp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin-top: 10px; }
.jp-grid .field:nth-child(2) { grid-column: 1 / -1; }
.jp-grid .field span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.jp-grid input[type=time] { height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); }
.jp-check { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.jp-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.jp-note { margin: 8px 0 0; font-size: 12px; color: var(--text-3); }
.jp-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: min(52vh, 480px); overflow-y: auto; }
.jp-item { padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.jp-row { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.jp-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jp-n, .jp-time { font-size: 12px; color: var(--text-3); }
.jp-time { margin-left: auto; }
.jp-sum { margin: 0; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.jp-why { margin: 0; font-size: 12px; color: var(--text-2); }
.jp-open { align-self: flex-start; margin-top: 4px; }
.jp-empty { padding: 16px; text-align: center; color: var(--text-2); font-size: 14px; }
@media (max-width: 600px) { .jp-grid { grid-template-columns: 1fr 1fr; } }

/* Con la pantalla de pausa abierta no se muestran la sugerencia de voz ni el botón flotante (las alertas urgentes sí) */
body:has(#calm) .jarvis-hint, body:has(#calm) .jarvis-fab { display: none !important; }
