/* bitacora.css — Cuaderno de bitácora del proyecto (anotaciones + notas de
   HighLevel). Compartido por proyectos.html (pestaña Anotaciones del detalle)
   y clientes.html (pestaña Anotaciones de la ficha en Cascada CS); la lógica
   vive en js/lib/bitacora-proyecto.js. Solo tokens: sirve con style.css y con
   css-gestor/styles.css. */

.bitacora-titulo {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
}

.bitacora-nueva-acciones {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

/* Páginas sin .form-control (Cascada CS): caja propia del textarea. */
.bitacora-textarea.bitacora-textarea-base {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-base);
    color: var(--text);
}

.bitacora-textarea.bitacora-textarea-base:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

/* ── Cuaderno de bitácora ───────────────────────────────────── */
.bitacora-textarea {
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.55;
}

.bitacora-nueva {
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 16px;
}

.bitacora-meta-nueva {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
}

.bitacora-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-fill);
    color: var(--primary-on-fill);
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.bitacora-lista {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.bitacora-empty {
    text-align: center;
    padding: 28px 16px;
    color: var(--text-muted);
    font-size: 13px;
    background: var(--surface-muted);
    border-radius: 10px;
    border: 1px dashed var(--border);
}

.bitacora-entrada {
    background: var(--surface-base);
    border: 1px solid var(--border);
    border-left: 2px solid var(--primary);
    border-radius: 10px;
    padding: 12px 14px;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.bitacora-entrada:hover {
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

.bitacora-entrada-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.bitacora-entrada-meta {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-width: 0;
}

.bitacora-usuario {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.bitacora-fecha {
    font-size: 11px;
    color: var(--text-muted);
}

.bitacora-acciones {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.bitacora-entrada:hover .bitacora-acciones,
.bitacora-entrada:focus-within .bitacora-acciones {
    opacity: 1;
}

.bitacora-btn-icon {
    background: none;
    border: none;
    padding: 6px;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.bitacora-btn-icon:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.bitacora-btn-danger:hover {
    background: var(--primary-soft);
    color: var(--danger-strong);
}

.bitacora-texto {
    font-size: 13px;
    line-height: 1.55;
    color: var(--text);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.bitacora-edit-text {
    margin-top: 4px;
}

.bitacora-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 8px;
}

/* Bitácora ↔ HighLevel */
.bitacora-hl-estado {
    margin: 0 0 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.bitacora-hl-error {
    color: var(--danger);
}

.bitacora-hl-retry {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-weight: 600;
    color: var(--primary);
    text-decoration: underline;
    cursor: pointer;
}

.bitacora-origen-hl {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-muted);
    color: var(--text-muted);
}

/* ── Menciones «@usuario» (js/lib/menciones.js) ─────────────── */
.bitacora-mencion {
    font-weight: 600;
    color: var(--tone-indigo-fg);
    background: var(--tone-indigo-bg);
    border-radius: var(--radius-xs, 4px);
    padding: 0 3px;
}

/* Me mencionan a mí: más visible que al resto. */
.bitacora-mencion-yo {
    outline: 1px solid var(--tone-indigo-border);
}

.bitacora-entrada-mencion {
    border-left-color: var(--tone-indigo-fg);
}

/* Entrada a la que se llega desde el aviso del home. */
.bitacora-entrada-destacada {
    box-shadow: 0 0 0 2px var(--tone-indigo-border);
}

.menciones-lista {
    position: absolute;
    left: 12px;
    z-index: 30;
    min-width: 220px;
    max-width: calc(100% - 24px);
    max-height: 240px;
    overflow-y: auto;
    margin: 4px 0 0;
    padding: 4px;
    list-style: none;
    background: var(--surface-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 10px);
    box-shadow: var(--shadow-lg);
}

.menciones-lista[hidden] {
    display: none;
}

.menciones-opcion,
.menciones-vacio {
    padding: 7px 10px;
    border-radius: var(--radius-sm, 6px);
    font-size: 13px;
    color: var(--text);
}

.menciones-opcion {
    cursor: pointer;
}

.menciones-opcion:hover,
.menciones-opcion[aria-selected="true"] {
    background: var(--tone-indigo-bg);
    color: var(--tone-indigo-fg);
}

.menciones-vacio {
    color: var(--text-muted);
    cursor: default;
}

/* Comercial en la lista de «@»: lo leerá desde el home, sin acceso a la página. */
.menciones-etiqueta {
    margin-left: 8px;
    padding: 0 6px;
    border-radius: var(--radius-xs, 4px);
    border: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Lectura en el home (index.html?mencion=): comerciales sin acceso a la
      página leen la bitácora del proyecto donde les mencionaron. ───────── */
.mlec-overlay {
    position: fixed;
    inset: 0;
    z-index: 1500;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s, visibility 0s 0.18s;
}

.mlec-overlay.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.18s, visibility 0s;
}

.mlec-modal {
    width: 100%;
    max-width: 680px;
    max-height: min(86vh, 820px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--surface-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 18px 18px 14px;
}

.mlec-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.mlec-head h2 {
    font-size: 17px;
    font-weight: 800;
    color: var(--text);
}

.mlec-sub {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 3px;
}

.mlec-cerrar {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-muted);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.mlec-cerrar:hover {
    color: var(--text);
}

.mlec-cerrar:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.mlec-cuerpo {
    overflow-y: auto;
    min-height: 0;
}

.mlec-cuerpo .bitacora-lista {
    margin-bottom: 0;
}

.mlec-estado {
    padding: 24px 8px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

@media (max-width: 560px) {
    .mlec-overlay {
        align-items: flex-end;
        padding: 0;
    }
    .mlec-modal {
        max-width: none;
        max-height: 92vh;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mlec-overlay {
        transition: none;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .bitacora-entrada-destacada {
        animation: bitacora-destacar 1.6s ease-out;
    }
    @keyframes bitacora-destacar {
        from { box-shadow: 0 0 0 6px var(--tone-indigo-border); }
    }
}
